Files
test-assignment/compose.production.yaml

74 lines
1.8 KiB
YAML

name: merchantflow
x-logging: &logging
driver: json-file
options:
max-size: '10m'
max-file: '3'
services:
db:
image: postgres:17.6-alpine
restart: unless-stopped
environment:
POSTGRES_USER: merchantflow
POSTGRES_DB: merchantflow
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in the production env file}
volumes:
- database:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U merchantflow -d merchantflow']
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
logging: *logging
api:
image: merchantflow-api:${APP_IMAGE_TAG:-local}
build:
context: .
target: api
restart: unless-stopped
init: true
environment:
NODE_ENV: production
API_HOST: 0.0.0.0
API_PORT: '3001'
APP_ORIGIN: ${APP_ORIGIN:?Set APP_ORIGIN in the production env file}
DATABASE_URL: ${DATABASE_URL:?Set DATABASE_URL in the production env file}
ports:
- '127.0.0.1:13001:3001'
depends_on:
db:
condition: service_healthy
healthcheck:
test:
- CMD
- node
- -e
- "fetch('http://127.0.0.1:3001/api/health', {signal: AbortSignal.timeout(4000)}).then(r => {if (!r.ok) process.exit(1)}).catch(() => process.exit(1))"
interval: 10s
timeout: 5s
retries: 12
start_period: 15s
logging: *logging
web:
image: merchantflow-web:${APP_IMAGE_TAG:-local}
build:
context: .
target: web
restart: unless-stopped
ports:
- '127.0.0.1:18080:80'
healthcheck:
test: ['CMD', 'wget', '-q', '-O', '/dev/null', 'http://127.0.0.1/healthz']
interval: 10s
timeout: 5s
retries: 6
logging: *logging
volumes:
database: