Migrate could not resolve the database internal hostname because the Compose stack used an isolated project network. Attach services to the external dokploy-network used by Dokploy Postgres. Co-authored-by: Cursor <cursoragent@cursor.com>
74 lines
1.9 KiB
YAML
74 lines
1.9 KiB
YAML
# Shared Compose for Dokploy staging and production.
|
|
# Both stacks use the same file with different env:
|
|
# APP_IMAGE=ghcr.io/<owner>/<repo>
|
|
# IMAGE_TAG=staging|production|<git-sha>
|
|
# PostgreSQL is a separate Dokploy database service (not defined here).
|
|
# Traefik/Dokploy domains should target service `web` port 8000.
|
|
# App services join dokploy-network so they can resolve Dokploy-managed
|
|
# Postgres internal hosts (e.g. amare-stg-pez43e).
|
|
|
|
services:
|
|
migrate:
|
|
image: ${APP_IMAGE}:${IMAGE_TAG}
|
|
pull_policy: always
|
|
restart: "no"
|
|
env_file:
|
|
- .env
|
|
command: ["php", "artisan", "migrate", "--force", "--no-interaction"]
|
|
networks:
|
|
- dokploy-network
|
|
|
|
web:
|
|
image: ${APP_IMAGE}:${IMAGE_TAG}
|
|
pull_policy: always
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
expose:
|
|
- "8000"
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8000/up"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
start_period: 40s
|
|
retries: 3
|
|
networks:
|
|
- dokploy-network
|
|
|
|
queue:
|
|
image: ${APP_IMAGE}:${IMAGE_TAG}
|
|
pull_policy: always
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
command: ["php", "artisan", "queue:work", "--sleep=2", "--tries=3", "--max-time=3600"]
|
|
stop_grace_period: 60s
|
|
stop_signal: SIGTERM
|
|
networks:
|
|
- dokploy-network
|
|
|
|
scheduler:
|
|
image: ${APP_IMAGE}:${IMAGE_TAG}
|
|
pull_policy: always
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
command: ["php", "artisan", "schedule:work"]
|
|
stop_grace_period: 30s
|
|
stop_signal: SIGTERM
|
|
networks:
|
|
- dokploy-network
|
|
|
|
networks:
|
|
dokploy-network:
|
|
external: true
|