fix(deploy): allow dev and prod stacks on the same Dokploy server

Stop publishing web on host port 8080, which clashed between stacks; Traefik
reaches port 80 of the container through dokploy-network. Local testing now
uses docker-compose.local.yml to publish the port.

Proxy nginx to a `gruperly-api` alias that only exists on the stack's own
network: the `api` service name is also registered on dokploy-network, so
with two stacks nginx could reach the other environment's API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-11-10 15:36:25 -03:00
parent f4a6f2653f
commit 8cb5fe9b08
4 changed files with 30 additions and 11 deletions

View File

@@ -101,8 +101,14 @@ services:
expose:
- "4000"
networks:
- default
- dokploy-network
default:
# nginx (web) proxies to this alias. It only exists on this stack's own
# network: the service name `api` is also registered on dokploy-network,
# where another stack from this repo (dev/prod on the same server) has an
# `api` too, and Docker DNS would mix them up.
aliases:
- gruperly-api
dokploy-network: {}
web:
build:
@@ -115,10 +121,12 @@ services:
restart: unless-stopped
depends_on:
- api
ports:
# Host publishing, only for local testing. On Dokploy the domain goes to
# port 80 of the container: Traefik does not go through the mapping.
- "8080:80"
# No host port: on Dokploy the domain goes to port 80 of the container
# through Traefik, and a published port would clash between stacks on the
# same server (dev/prod). For local testing, docker-compose.local.yml
# publishes 8080.
expose:
- "80"
networks:
- default
# Dokploy adds dokploy-network only to the service with a domain, so it has