All checks were successful
Build and Deploy Nuxt / build (push) Successful in 11s
The backend image ships no .env (gitignored) and compose passed no env, so MONGO_URI fell back to the container's own 127.0.0.1, the API died on connect, and nginx answered 502 for every /api request. - docker-compose.yml: mongo:7 service with a data volume; backend gets MONGO_URI=mongodb://mongo:27017/mathew and waits on its healthcheck - nginx.conf: resolve service names through Docker's DNS per request (stale cached IPs 502 after every container recreate); match bare /api too so it cannot loop through the frontend's SSR proxy
45 lines
1.0 KiB
YAML
45 lines
1.0 KiB
YAML
version: "3.9"
|
|
|
|
services:
|
|
nginx:
|
|
image: nginx:latest
|
|
ports:
|
|
- "3000:80"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
depends_on:
|
|
- frontend
|
|
- backend
|
|
restart: always
|
|
|
|
frontend:
|
|
image: git.aranroig.com/syndria98/mathew-frontend:latest
|
|
restart: always
|
|
|
|
backend:
|
|
image: git.aranroig.com/syndria98/mathew-backend:latest
|
|
environment:
|
|
# The image carries no .env (it is gitignored), and a container's
|
|
# 127.0.0.1 is itself — with the default URI the API crashed on connect
|
|
# and nginx answered 502. Mongo is a service of this stack now.
|
|
MONGO_URI: mongodb://mongo:27017/mathew
|
|
depends_on:
|
|
mongo:
|
|
condition: service_healthy
|
|
restart: always
|
|
|
|
mongo:
|
|
image: mongo:7
|
|
volumes:
|
|
- mongo-data:/data/db
|
|
healthcheck:
|
|
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 20s
|
|
restart: always
|
|
|
|
volumes:
|
|
mongo-data:
|