mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 14:43:24 +00:00
refactor: compose files
This commit is contained in:
31
compose.yml
31
compose.yml
@@ -9,7 +9,7 @@ services:
|
|||||||
- POSTGRES_USER=${DB_USER}
|
- POSTGRES_USER=${DB_USER}
|
||||||
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD-SHELL', 'pg_isready']
|
test: ['CMD-SHELL', 'pg_isready', '-U', '${DB_USER}']
|
||||||
volumes:
|
volumes:
|
||||||
- postgres-volume:/var/lib/postgresql/data
|
- postgres-volume:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
@@ -19,20 +19,28 @@ services:
|
|||||||
container_name: pgadmin
|
container_name: pgadmin
|
||||||
image: dpage/pgadmin4:8
|
image: dpage/pgadmin4:8
|
||||||
restart: always
|
restart: always
|
||||||
|
entrypoint: /bin/sh -c "chmod 0600 /pgpass; /entrypoint.sh;"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'wget', '-O', '-', 'http://localhost:80/misc/ping']
|
test: ['CMD', 'wget', '-O', '-', 'http://localhost:80/misc/ping']
|
||||||
interval: 2s
|
interval: 2s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 30
|
retries: 30
|
||||||
|
env_file: .env
|
||||||
environment:
|
environment:
|
||||||
- PGADMIN_DEFAULT_EMAIL=myemail@gmail.com
|
- PGADMIN_DEFAULT_EMAIL=myemail@gmail.com
|
||||||
- PGADMIN_DEFAULT_PASSWORD=a12345678
|
- PGADMIN_DEFAULT_PASSWORD=a12345678
|
||||||
|
- PGADMIN_CONFIG_SERVER_MODE=False
|
||||||
|
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
volumes:
|
|
||||||
- ./docker-config/servers_pgadmin.json:/pgadmin4/servers.json
|
|
||||||
ports:
|
ports:
|
||||||
- '5050:80'
|
- '5050:80'
|
||||||
|
user: root
|
||||||
|
configs:
|
||||||
|
- source: servers.json
|
||||||
|
target: /pgadmin4/servers.json
|
||||||
|
- source: pgpass
|
||||||
|
target: /pgpass
|
||||||
|
|
||||||
my-links:
|
my-links:
|
||||||
container_name: my-links
|
container_name: my-links
|
||||||
@@ -53,4 +61,19 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres-volume:
|
postgres-volume:
|
||||||
name: postgres-prod-my-links
|
|
||||||
|
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"
|
||||||
|
}}}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: dev-stack
|
name: my-links-dev
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
container_name: postgres
|
container_name: postgres
|
||||||
@@ -9,26 +9,54 @@ services:
|
|||||||
- POSTGRES_USER=${DB_USER}
|
- POSTGRES_USER=${DB_USER}
|
||||||
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD-SHELL', 'pg_isready']
|
test: ["CMD-SHELL", "pg_isready", "-U", "${DB_USER}"]
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_volume:/var/lib/postgresql/data
|
- postgres-volume:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
- '${DB_PORT}:5432'
|
- "${DB_PORT}:5432"
|
||||||
|
|
||||||
pgadmin:
|
pgadmin:
|
||||||
container_name: pgadmin
|
container_name: pgadmin
|
||||||
image: dpage/pgadmin4:8
|
image: dpage/pgadmin4:8
|
||||||
restart: always
|
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:
|
environment:
|
||||||
- PGADMIN_DEFAULT_EMAIL=myemail@gmail.com
|
- PGADMIN_DEFAULT_EMAIL=myemail@gmail.com
|
||||||
- PGADMIN_DEFAULT_PASSWORD=a12345678
|
- PGADMIN_DEFAULT_PASSWORD=a12345678
|
||||||
|
- PGADMIN_CONFIG_SERVER_MODE=False
|
||||||
|
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
volumes:
|
|
||||||
- ./docker-config/servers_pgadmin.json:/pgadmin4/servers.json
|
|
||||||
ports:
|
ports:
|
||||||
- '5050:80'
|
- "5050:80"
|
||||||
|
user: root
|
||||||
|
configs:
|
||||||
|
- source: servers.json
|
||||||
|
target: /pgadmin4/servers.json
|
||||||
|
- source: pgpass
|
||||||
|
target: /pgpass
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_volume:
|
postgres-volume:
|
||||||
name: postgres_test_dev_stack
|
|
||||||
|
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"
|
||||||
|
}}}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"Servers": {
|
|
||||||
"1": {
|
|
||||||
"Name": "project",
|
|
||||||
"Group": "Servers",
|
|
||||||
"Port": 5432,
|
|
||||||
"Username": "postgres",
|
|
||||||
"Host": "postgres",
|
|
||||||
"SSLMode": "prefer",
|
|
||||||
"MaintenanceDB": "my-links"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user