Point production at the LAN MongoDB (192.168.1.7:27017)
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 8s
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 8s
Production uses the network's database server instead of a mongo service inside the stack (the compose-managed one never served the API). Dev is unchanged: backend/.env keeps localhost:27017. - docker-compose.yml: MONGO_URI=mongodb://192.168.1.7:27017/mathew; drop the in-stack mongo service, its volume and the healthcheck gate - deploy.yml: up -d --remove-orphans so yesterday's mongo container is retired when the new compose lands
This commit is contained in:
@@ -19,32 +19,14 @@ services:
|
||||
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
|
||||
# Production MongoDB — the LAN database server, not a container of this
|
||||
# stack and not the container's own 127.0.0.1 (where nothing listens).
|
||||
# Development keeps localhost:27017 via backend/.env.
|
||||
MONGO_URI: mongodb://192.168.1.7:27017/mathew
|
||||
# Interpolated from /var/www/app/.env on the deploy host (never
|
||||
# committed, never overwritten by the pipeline's scp). Create it once:
|
||||
# echo "JWT_SECRET=$(openssl rand -hex 32)" >> /var/www/app/.env
|
||||
# Left unset, the backend falls back to the dev key in the repo —
|
||||
# anyone could then forge sessions against the public site.
|
||||
JWT_SECRET: ${JWT_SECRET:-}
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user