72 lines
1.8 KiB
YAML
72 lines
1.8 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
args:
|
|
- NODE_ENV=production
|
|
- MONGODB_URI=${MONGODB_URI}
|
|
container_name: stripstream-app
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3020:3000"
|
|
environment:
|
|
- NODE_ENV=production
|
|
- MONGODB_URI=${MONGODB_URI}
|
|
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
|
|
- NEXTAUTH_URL=${NEXTAUTH_URL}
|
|
- AUTH_TRUST_HOST=true
|
|
depends_on:
|
|
- mongodb
|
|
networks:
|
|
- stripstream-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "1"
|
|
memory: 1G
|
|
labels:
|
|
- "com.centurylinklabs.watchtower.enable=false"
|
|
healthcheck:
|
|
test:
|
|
["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
|
|
interval: 30s
|
|
timeout: 3s
|
|
retries: 3
|
|
|
|
mongodb:
|
|
image: mongo:latest
|
|
container_name: stripstream-mongodb
|
|
restart: unless-stopped
|
|
environment:
|
|
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
|
|
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
|
|
volumes:
|
|
- stripstream_mongodb_data:/data/db
|
|
- ./mongo-keyfile:/data/keyfile:ro
|
|
networks:
|
|
- stripstream-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "0.5"
|
|
memory: 512M
|
|
ports:
|
|
- "27017:27017"
|
|
command: ["mongod", "--auth", "--bind_ip_all", "--replSet", "rs0", "--keyFile", "/data/keyfile"]
|
|
healthcheck:
|
|
test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'mongodb:27017'}]}) }" | mongosh -u ${MONGO_USER} -p ${MONGO_PASSWORD} --authenticationDatabase admin --quiet
|
|
interval: 10s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 40s
|
|
|
|
networks:
|
|
stripstream-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
stripstream_mongodb_data:
|