postgres-service/environments/production.yaml

83 lines
1.8 KiB
YAML

version: '3.8'
services:
postgres:
image: postgres:15-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5432:5432"
volumes:
- postgres_data_prod:/var/lib/postgresql/data
- ./config/postgres-production.conf:/etc/postgresql/postgresql.conf
command: postgres -c config_file=/etc/postgresql/postgresql.conf
deploy:
resources:
limits:
cpus: '2'
memory: 4G
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: "json-file"
options:
max-size: "200m"
max-file: "10"
pgadmin:
image: dpage/pgadmin4:latest
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
PGADMIN_CONFIG_SERVER_MODE: 'True'
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'True'
ports:
- "5050:80"
volumes:
- pgadmin_data_prod:/var/lib/pgadmin
deploy:
resources:
limits:
cpus: '1'
memory: 1G
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
volumes:
postgres_data_prod:
name: postgres_data_prod
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/data/postgres'
pgadmin_data_prod:
name: pgadmin_data_prod
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/data/pgadmin'
networks:
postgres_network:
name: postgres_network_prod
driver: bridge
ipam:
driver: default
config:
- subnet: 172.28.0.0/16