postgres service for external use

This commit is contained in:
2025-04-19 20:00:57 +03:00
commit 7d1acd8469
17 changed files with 1093 additions and 0 deletions

33
environments/dev.yaml Normal file
View File

@@ -0,0 +1,33 @@
version: '3.8'
services:
postgres:
environment:
POSTGRES_USER: postgres_dev
POSTGRES_PASSWORD: postgres_dev_password
POSTGRES_DB: postgres_dev
ports:
- "5432:5432"
volumes:
- postgres_data_dev:/var/lib/postgresql/data
- ./config/postgres-dev.conf:/etc/postgresql/postgresql.conf
command: postgres -c config_file=/etc/postgresql/postgresql.conf
pgadmin:
environment:
PGADMIN_DEFAULT_EMAIL: dev@example.com
PGADMIN_DEFAULT_PASSWORD: pgadmin_dev_password
ports:
- "5050:80"
volumes:
- pgadmin_data_dev:/var/lib/pgadmin
volumes:
postgres_data_dev:
name: postgres_data_dev
pgadmin_data_dev:
name: pgadmin_data_dev
networks:
postgres_network:
name: postgres_network_dev

View File

@@ -0,0 +1,82 @@
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

43
environments/staging.yaml Normal file
View File

@@ -0,0 +1,43 @@
version: '3.8'
services:
postgres:
environment:
POSTGRES_USER: postgres_staging
POSTGRES_PASSWORD: postgres_staging_password
POSTGRES_DB: postgres_staging
ports:
- "5433:5432"
volumes:
- postgres_data_staging:/var/lib/postgresql/data
- ./config/postgres-staging.conf:/etc/postgresql/postgresql.conf
command: postgres -c config_file=/etc/postgresql/postgresql.conf
deploy:
resources:
limits:
cpus: '1'
memory: 1G
pgadmin:
environment:
PGADMIN_DEFAULT_EMAIL: staging@example.com
PGADMIN_DEFAULT_PASSWORD: pgadmin_staging_password
ports:
- "5051:80"
volumes:
- pgadmin_data_staging:/var/lib/pgadmin
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
volumes:
postgres_data_staging:
name: postgres_data_staging
pgadmin_data_staging:
name: pgadmin_data_staging
networks:
postgres_network:
name: postgres_network_staging