Scaffold builds one Docker image for every part of the app and deploys it to DigitalOcean App Platform with GitHub Actions. Locally it runs with Sail.
compose.yaml runs the app with MySQL, Valkey and Mailpit.
cp .env.example .env # then set DB_HOST=mysql, REDIS_HOST=valkey, MAIL_HOST=mailpit, MAIL_PORT=1025 ./vendor/bin/sail up -d ./vendor/bin/sail artisan key:generate ./vendor/bin/sail artisan migrate ./vendor/bin/sail npm run dev
CI runs on PHP 8.4 against .env.example, so keep that file's keys in sync with any new config.
The Dockerfile builds one image (PHP 8.4 on serversideup/php fpm-nginx, port 8080, non-root, with the Vite assets compiled in). It runs the web server by default, and queue:work, schedule:work or migrate when given that command.
To try it locally the way production runs it:
docker compose -f compose.production.yaml up --build # https://localhost:8443
At boot the web container caches config, routes, views and events. It never migrates: the migrate job does that. Anything that breaks php artisan optimize, such as an uncacheable route, breaks the deploy.
Configuration comes only from environment variables (.env files are not copied into the image), and the container filesystem is temporary.
FILESYSTEM_DISK=s3).PASSPORT_PRIVATE_KEY / PASSPORT_PUBLIC_KEY.docker/entrypoint.d/20-mysql-ca.sh writes the managed MySQL CA from DB_CA_CERT.VITE_* values are compiled into the JavaScript, so they are Docker build args, not runtime environment variables.
After the Tests workflow passes on main, .github/workflows/deploy.yml builds the image, pushes it to DigitalOcean Container Registry, and deploys .do/app.yaml. You can also run the workflow by hand from the Actions tab. docker.yml builds and smoke-tests the image on pull requests.
The app spec defines:
web: the HTTP service, health-checked at /upqueue: a queue:work workerscheduler: a schedule:work worker. Keep it at one instance.migrate: a pre-deploy job. A failed migration stops the deploy.db and cache: managed MySQL and managed Valkey. Valkey handles cache, sessions, queues and scheduler locks.1. In DigitalOcean, create:
2. Generate the app and Passport keys locally. The Passport keys must be stored on a single line with \n:
php artisan key:generate --show php artisan passport:keys --force awk '{printf "%s\\n", $0}' storage/oauth-private.key # PASSPORT_PRIVATE_KEY awk '{printf "%s\\n", $0}' storage/oauth-public.key # PASSPORT_PUBLIC_KEY
3. In GitHub, go to Settings → Secrets and variables → Actions. You can add these to the production environment or to the repository.
Variables:
DOCR_REGISTRY, DOCR_REPOSITORY DO_APP_NAME, DO_PROJECT_ID (optional) DO_MYSQL_CLUSTER, DO_MYSQL_DATABASE, DO_MYSQL_USER, DO_VALKEY_CLUSTER SPACES_REGION (for example tor1), SPACES_BUCKET MAIL_HOST, MAIL_PORT, MAIL_FROM_ADDRESS PUSHER_APP_ID, PUSHER_APP_KEY, PUSHER_APP_CLUSTER STRIPE_KEY, PLAN_MONTHLY, PLAN_YEARLY VAPID_SUBJECT, VAPID_PUBLIC_KEY MISSION_CONTROL_PROJECT_UUID
Secrets:
DIGITALOCEAN_ACCESS_TOKEN APP_KEY, PASSPORT_PRIVATE_KEY, PASSPORT_PUBLIC_KEY SPACES_ACCESS_KEY_ID, SPACES_SECRET_ACCESS_KEY MAIL_USERNAME, MAIL_PASSWORD PUSHER_APP_SECRET STRIPE_SECRET, STRIPE_WEBHOOK_SECRET ANTHROPIC_API_KEY, OPENAI_API_KEY VAPID_PRIVATE_KEY MISSION_CONTROL_USER_TOKEN, MISSION_CONTROL_PROJECT_KEY
4. Push to main, or run the Deploy workflow by hand. The first run creates the app; later runs update it.
5. To use a custom domain, uncomment domains: in .do/app.yaml and point a CNAME at the app's ondigitalocean.app address.
.do/app.yaml, so set secrets in GitHub, not in the DigitalOcean dashboard. A secret or variable that isn't set is sent as an empty value.
To add a new setting:
.do/app.yaml.env: in .github/workflows/deploy.yml. digitalocean/app_action substitutes ${VARS} in the app spec from the workflow env..env.example.