From b3714c2d39c40f323f8676ffafed53d41260f388 Mon Sep 17 00:00:00 2001 From: James Gorrie Date: Tue, 26 Nov 2024 16:52:35 +0000 Subject: [PATCH 1/6] feat: add pgadmin to docker compose --- docker-compose.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7c494ee8..4b5ab97a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: "3.7" services: admin_backend_db: image: postgres:14 @@ -7,10 +6,11 @@ services: - .env ports: - 5432:5432 + hostname: admin_backend_db volumes: - admin-data:/var/lib/postgresql/data:cached healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] + test: [CMD-SHELL, "pg_isready -U ${POSTGRES_USER}"] interval: 5s timeout: 3s retries: 30 @@ -32,6 +32,14 @@ services: depends_on: admin_backend_db: condition: service_healthy - + pgadmin: + image: dpage/pgadmin4 + container_name: pgadmin4 + restart: always + ports: + - 8000:80 + environment: + PGADMIN_DEFAULT_EMAIL: dev@cpr.com + PGADMIN_DEFAULT_PASSWORD: cpr volumes: - admin-data: + admin-data: {} From deebbd59c308a823ae425359972ae6341591a785 Mon Sep 17 00:00:00 2001 From: James Gorrie Date: Tue, 26 Nov 2024 17:39:14 +0000 Subject: [PATCH 2/6] feat: make pgadmin a bit more streamline --- docker-compose.yml | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4b5ab97a..36a7e300 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,10 +36,45 @@ services: image: dpage/pgadmin4 container_name: pgadmin4 restart: always + env_file: + - .env ports: - 8000:80 + # This has to have world & group access denied to work + entrypoint: /bin/sh -c "chmod 600 /pgpass; /entrypoint.sh;" + configs: + - source: servers.json + target: /pgadmin4/servers.json + - source: pgpass + target: /pgpass environment: - PGADMIN_DEFAULT_EMAIL: dev@cpr.com - PGADMIN_DEFAULT_PASSWORD: cpr + # This deavctivates the login screen + PGADMIN_CONFIG_SERVER_MODE: "False" + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False" + volumes: + - pgadmin-data:/var/lib/pgadmin + # This is just nice to know as if it fails, it fails quietly + healthcheck: + test: [CMD, wget, -O, "-", http://localhost:80/misc/ping] +configs: + pgpass: + content: "admin_backend_db:5432:*:${POSTGRES_USER}:${POSTGRES_PASSWORD}" + servers.json: + content: | + { + "Servers": { + "1": { + "Group": "Servers", + "Name": "Navigator Admin Backend", + "Host": "admin_backend_db", + "Port": 5432, + "MaintenanceDB": "postgres", + "Username": "${POSTGRES_USER}", + "Password": "${POSTGRES_PASSWORD}", + "SSLMode": "prefer" + } + } + } volumes: admin-data: {} + pgadmin-data: {} From 46cde2920f18e6e2d95b830e46cd87464537508a Mon Sep 17 00:00:00 2001 From: James Gorrie Date: Tue, 26 Nov 2024 17:45:16 +0000 Subject: [PATCH 3/6] fix: remove unecesssary hostname --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 36a7e300..b31709d6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,6 @@ services: - .env ports: - 5432:5432 - hostname: admin_backend_db volumes: - admin-data:/var/lib/postgresql/data:cached healthcheck: From 417d07ddf171f9d37d242572585b9432f01ce9a6 Mon Sep 17 00:00:00 2001 From: James Gorrie Date: Tue, 3 Dec 2024 09:22:05 +0000 Subject: [PATCH 4/6] fix: add trunk ignore to docker-compose --- docker-compose.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index f10deaae..d518d68a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -66,7 +66,11 @@ services: - pgadmin-data:/var/lib/pgadmin # This is just nice to know as if it fails, it fails quietly healthcheck: - test: [CMD, wget, -O, "-", http://localhost:80/misc/ping] + # there are conflicting trunk errors here. Either + # - having `:` in the URL (fails in Github actions) + # - redundantly quoting the URL (fails locally) + # trunk-ignore(yamllint/quoted-strings) + test: [CMD, wget, -O, "-", "http://localhost:80/misc/ping"] configs: pgpass: content: "admin_backend_db:5432:*:${POSTGRES_USER}:${POSTGRES_PASSWORD}" From 37d6887b651575598e4dcb9f1376c741a58ced09 Mon Sep 17 00:00:00 2001 From: James Gorrie Date: Tue, 3 Dec 2024 10:26:43 +0000 Subject: [PATCH 5/6] fix: add space for consistency --- docker-compose-fulldata.yml | 0 docker-compose.yml | 1 + 2 files changed, 1 insertion(+) create mode 100644 docker-compose-fulldata.yml diff --git a/docker-compose-fulldata.yml b/docker-compose-fulldata.yml new file mode 100644 index 00000000..e69de29b diff --git a/docker-compose.yml b/docker-compose.yml index d518d68a..39c22bac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,6 +43,7 @@ services: depends_on: admin_backend_db: condition: service_healthy + pgadmin: image: dpage/pgadmin4 container_name: pgadmin4 From c86363a76cf0c365d8fcf0a1e5027b2ddf8f733c Mon Sep 17 00:00:00 2001 From: James Gorrie Date: Tue, 3 Dec 2024 10:35:06 +0000 Subject: [PATCH 6/6] fix: put depends on localstck back into docker compose --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 39c22bac..2612e395 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,6 +43,8 @@ services: depends_on: admin_backend_db: condition: service_healthy + localstack: + condition: service_started pgadmin: image: dpage/pgadmin4