Files
my-links/compose.yml
2024-10-27 18:39:43 +01:00

80 lines
1.8 KiB
YAML

name: my-links
services:
postgres:
container_name: postgres
image: postgres:16
restart: always
environment:
- POSTGRES_DB=${DB_DATABASE}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
healthcheck:
test: ['CMD-SHELL', 'pg_isready', '-U', '${DB_USER}']
volumes:
- postgres-volume:/var/lib/postgresql/data
ports:
- '${DB_PORT}:5432'
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4:8
restart: always
entrypoint: /bin/sh -c "chmod 0600 /pgpass; /entrypoint.sh;"
healthcheck:
test: ['CMD', 'wget', '-O', '-', 'http://localhost:80/misc/ping']
interval: 2s
timeout: 10s
retries: 30
env_file: .env
environment:
- PGADMIN_DEFAULT_EMAIL=myemail@gmail.com
- PGADMIN_DEFAULT_PASSWORD=a12345678
- PGADMIN_CONFIG_SERVER_MODE=False
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
depends_on:
- postgres
ports:
- '5050:80'
user: root
configs:
- source: servers.json
target: /pgadmin4/servers.json
- source: pgpass
target: /pgpass
my-links:
container_name: my-links
restart: always
build:
context: .
environment:
- DB_HOST=postgres
- HOST=0.0.0.0
- NODE_ENV=production
env_file:
- .env
depends_on:
postgres:
condition: service_healthy
ports:
- ${PORT}:3333
volumes:
postgres-volume:
configs:
pgpass:
content: postgres:${DB_PORT}:*:${DB_USER}:${DB_PASSWORD}
servers.json:
content: |
{"Servers": {"1": {
"Group": "Servers",
"Name": "project",
"Host": "postgres",
"Port": ${DB_PORT},
"MaintenanceDB": "${DB_DATABASE}",
"Username": "${DB_USER}",
"PassFile": "/pgpass",
"SSLMode": "prefer"
}}}