version: "3.4"
services:
frontend:
image: jfahrer/swarm-demo-frontend:v8
secrets:
- pg_secret
env_file:
- app.env
deploy:
replicas: 10
update_config:
failure_action: rollback
parallelism: 3
delay: 3s
max_failure_ratio: 0.1
db:
image: jfahrer/swarm-demo-db:v1
env_file:
- db.env
secrets:
- pg_secret
volumes:
- pg-data:/var/lib/postgresql/data
deploy:
resources:
reservations:
memory: 256M
placement:
constraints:
- node.hostname == node1
lb:
image: jfahrer/swarm-demo-lb:v1
environment:
- PROXY_UPSTREAM=frontend:8080
ports:
- 80:80
deploy:
replicas: 3
volumes:
pg-data:
secrets:
pg_secret:
file: ./pg_secret
POSTGRES_USER=demo
POSTGRES_PASSWORD_FILE=/run/secrets/pg_secret
POSTGRES_DB=demo
POSTGRES_HOST=db
POSTGRES_USER=demo
POSTGRES_PASSWORD_FILE=/run/secrets/pg_secret
POSTGRES_DB=demo