fix: join Dokploy network so Compose reaches managed Postgres (#9)

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>
This commit is contained in:
2026-08-04 23:15:52 -03:00
committed by GitHub
parent 1a31dd1cf6
commit 3e68192cf3
2 changed files with 17 additions and 1 deletions

View File

@@ -4,6 +4,8 @@
# IMAGE_TAG=staging|production|<git-sha> # IMAGE_TAG=staging|production|<git-sha>
# PostgreSQL is a separate Dokploy database service (not defined here). # PostgreSQL is a separate Dokploy database service (not defined here).
# Traefik/Dokploy domains should target service `web` port 8000. # 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: services:
migrate: migrate:
@@ -13,6 +15,8 @@ services:
env_file: env_file:
- .env - .env
command: ["php", "artisan", "migrate", "--force", "--no-interaction"] command: ["php", "artisan", "migrate", "--force", "--no-interaction"]
networks:
- dokploy-network
web: web:
image: ${APP_IMAGE}:${IMAGE_TAG} image: ${APP_IMAGE}:${IMAGE_TAG}
@@ -31,6 +35,8 @@ services:
timeout: 5s timeout: 5s
start_period: 40s start_period: 40s
retries: 3 retries: 3
networks:
- dokploy-network
queue: queue:
image: ${APP_IMAGE}:${IMAGE_TAG} image: ${APP_IMAGE}:${IMAGE_TAG}
@@ -44,6 +50,8 @@ services:
command: ["php", "artisan", "queue:work", "--sleep=2", "--tries=3", "--max-time=3600"] command: ["php", "artisan", "queue:work", "--sleep=2", "--tries=3", "--max-time=3600"]
stop_grace_period: 60s stop_grace_period: 60s
stop_signal: SIGTERM stop_signal: SIGTERM
networks:
- dokploy-network
scheduler: scheduler:
image: ${APP_IMAGE}:${IMAGE_TAG} image: ${APP_IMAGE}:${IMAGE_TAG}
@@ -57,3 +65,9 @@ services:
command: ["php", "artisan", "schedule:work"] command: ["php", "artisan", "schedule:work"]
stop_grace_period: 30s stop_grace_period: 30s
stop_signal: SIGTERM stop_signal: SIGTERM
networks:
- dokploy-network
networks:
dokploy-network:
external: true

View File

@@ -50,6 +50,8 @@ IMAGE_TAG=staging # or production
Point Dokploy domain(s) at service **`web`**, port **`8000`**. Do not publish PostgreSQL or host ports for app processes. Point Dokploy domain(s) at service **`web`**, port **`8000`**. Do not publish PostgreSQL or host ports for app processes.
Compose services must join the external Docker network `dokploy-network` (declared in `docker-compose.deploy.yml`) so they can resolve the Dokploy-managed Postgres internal host (e.g. `amare-stg-pez43e`). Set `DB_HOST` to that **Internal Host** from the Dokploy database UI — not a public hostname.
Source can be GitHub (so Dokploy clones the compose file) or Raw paste of `docker-compose.deploy.yml`. Prefer GitHub + fixed compose path so updates stay in sync with `main`. Source can be GitHub (so Dokploy clones the compose file) or Raw paste of `docker-compose.deploy.yml`. Prefer GitHub + fixed compose path so updates stay in sync with `main`.
## Required Laravel env (Dokploy only) ## Required Laravel env (Dokploy only)
@@ -68,7 +70,7 @@ APP_FALLBACK_LOCALE=pt_BR
APP_TIMEZONE=America/Fortaleza APP_TIMEZONE=America/Fortaleza
DB_CONNECTION=pgsql DB_CONNECTION=pgsql
DB_HOST=<dokploy-postgres-host> DB_HOST=<dokploy-postgres-internal-host> # Internal Host from Dokploy UI (requires dokploy-network)
DB_PORT=5432 DB_PORT=5432
DB_DATABASE=amare_staging DB_DATABASE=amare_staging
DB_USERNAME=... DB_USERNAME=...