Skip to content

Commit

Permalink
more orbstack updates
Browse files Browse the repository at this point in the history
  • Loading branch information
joelclermont committed Jun 12, 2024
1 parent 655c57b commit 4347c6c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
19 changes: 8 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 13 additions & 9 deletions README_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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**

Expand Down Expand Up @@ -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`.

Expand Down
6 changes: 0 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4347c6c

Please sign in to comment.