diff --git a/.env.example b/.env.example index 87bfc8b..b97f9e5 100644 --- a/.env.example +++ b/.env.example @@ -1,18 +1,11 @@ +COMPOSE_PROJECT_NAME=my-project +DOCKER_SERVER_NAME=my-project.local + APP_NAME=Laravel APP_ENV=local APP_KEY= APP_DEBUG=true -APP_URL=https://my-project.local:30080 - -COMPOSE_PROJECT_NAME=my-project -DOCKER_MYSQL_LOCAL_PORT=33306 -DOCKER_NGINX_LOCAL_PORT=30080 -DOCKER_REDIS_LOCAL_PORT=36379 -DOCKER_SERVER_NAME=my-project.local - -SENTRY_LARAVEL_DSN= -SENTRY_TRACES_SAMPLE_RATE=1.0 -SENTRY_SEND_DEFAULT_PII=true +APP_URL=https://my-project.local LOG_CHANNEL=stack LOG_DEPRECATIONS_CHANNEL=null @@ -66,3 +59,7 @@ VITE_PUSHER_HOST="${PUSHER_HOST}" VITE_PUSHER_PORT="${PUSHER_PORT}" VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +SENTRY_LARAVEL_DSN= +SENTRY_TRACES_SAMPLE_RATE=1.0 +SENTRY_SEND_DEFAULT_PII=true diff --git a/README.md b/README.md index f364007..cd712ad 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ You can also remove: Modifications are needed to the following files already in a default Laravel install: * `.env.example` and `.env` - * copy from `APP_URL`, `COMPOSER_PROJECT_NAME`, `DOCKER_MYSQL_LOCAL_PORT`, `DOCKER_NGINX_LOCAL_PORT`, and `DOCKER_SERVER_NAME` + * copy from `APP_URL`, `COMPOSE_PROJECT_NAME`, and `DOCKER_SERVER_NAME` * copy `DB_HOST`, `DB_DATABASE`, `DB_USERNAME`, and `DB_PASSWORD` Update your Composer packages and scripts: diff --git a/README_TEMPLATE.md b/README_TEMPLATE.md index 19bdf1d..e79786e 100644 --- a/README_TEMPLATE.md +++ b/README_TEMPLATE.md @@ -26,9 +26,12 @@ To get started with local development, follow these steps. Make sure you run all > Decide on a local domain to use for this project. Substitute that any place you see `my-project.local` or `my-project` below. -By default, this project will run on the host `my-project.local`. This requires some sort of local DNS resolution for that hostname -to your localhost IP address. One easy way to do this for the entire `.local` top-level domain, is to run a lightweight tool -called `dnsmasq`. You can install it via Homebrew on a Mac with: `brew install dnsmasq`. +By default, this project will run on the host `my-project.local`. +OrbStack (see below) is already configured to serve on this top-level domain. + +If you're not using OrbStack, you will need some sort of local DNS resolution for that hostname to your localhost IP address. +One easy way to do this for the entire `.local` top-level domain, is to run a lightweight tool called `dnsmasq`. +You can install it via Homebrew on a Mac with: `brew install dnsmasq`. > If you've ever setup Valet, it already installed dnsmasq for you. You can verify if it's already installed by running > `brew services` and see if `dnsmasq` is listed. @@ -59,19 +62,20 @@ Then, generate the certificates for this project and put them into a location ac `mkcert -cert-file docker/nginx/ssl.pem -key-file docker/nginx/key.pem my-project.local` ### Node environment -The best option to ensure you're using the correct versions of Node and npm with this project is to install [Volta](https://volta.sh). Volta will read the pinned versions of Node and npm from the `package.json` so you can be sure you're using the correct versions. +The best option to ensure you're using the correct versions of Node and npm with this project is to install [Volta](https://volta.sh). +Volta will read the pinned versions of Node and npm from the `package.json` so you can be sure you're using the correct versions. ### Get the project running in Docker Docker is used for local development. It's self-contained, easy to set up, and matches the exact versions of key services -running in production. It requires that you have [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed. +running in production. We use [OrbStack](https://orbstack.dev) as our Docker engine, since it handles domain resolution and port mapping. +This config also works with [Docker Desktop](https://www.docker.com/products/docker-desktop/), but you may need to add explicit port mappings. **Setup the environment** -Make a copy of the example env file: `cp .env.example .env` +Open the `.env.example` file and update the `COMPOSE_PROJECT_NAME` and `DOCKER_SERVER_NAME` settings to match your project. -Open the `.env` file and review the settings prefixed with `DOCKER_`. The defaults should work, but if you want a different -host name, or to change the port numbers, make those modifications before continuing with the Docker setup. +Make a copy of the example env file: `cp .env.example .env` **Get Docker running** @@ -112,7 +116,7 @@ Run these commands to finish the local development setup * `docker/bin/artisan horizon:install` * `docker/bin/artisan migrate --seed` -You're good to go - surf to https://my-project.local:30080 (or a different host/port if you've configured it) +You're good to go - surf to https://my-project.local You can also use any normal database management tools and connect to the database using the port specified in `.env`. diff --git a/docker-compose.yml b/docker-compose.yml index 68bfc62..b2eb426 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,8 +29,6 @@ services: MYSQL_DATABASE: app # update .env and .env.example if you change any of these values MYSQL_USER: app MYSQL_PASSWORD: app - ports: - - "${DOCKER_MYSQL_LOCAL_PORT}:3306" # Uncomment the command section if you need to deviate from MySQL defaults (like on a legacy database schema) # command: # - "--character-set-server=utf8mb4" @@ -61,8 +59,6 @@ services: redis: container_name: "${COMPOSE_PROJECT_NAME}-redis" image: redis:7.2.5-alpine3.20 - ports: - - "${DOCKER_REDIS_LOCAL_PORT}:6379" restart: unless-stopped ## NGINX to support the app, configured to use the php-fpm-debug server @@ -77,8 +73,6 @@ services: - .:/app labels: - "dev.orbstack.domains=${DOCKER_SERVER_NAME}" - ports: - - "${DOCKER_NGINX_LOCAL_PORT}:443" depends_on: - php-fpm-debug restart: unless-stopped