From 828cb5114153aa41f24bcd47d65a51a2eda982cc Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Tue, 4 Jun 2024 09:28:54 -0500 Subject: [PATCH] Use `pgweb` to allow changes to be seen in a GUI --- .env.example | 3 ++- docker-compose.yml | 29 +++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index c127f07..3aa6ecc 100644 --- a/.env.example +++ b/.env.example @@ -2,4 +2,5 @@ POSTGRES_DB = db DB_HOST = localhost DB_PORT = 5433 POSTGRES_USER = dbusername -POSTGRES_PASSWORD = dbpassword \ No newline at end of file +POSTGRES_PASSWORD = dbpassword +PGWEB_DATABASE_URL = postgres://dbusername:dbpassword@postgres:5432/db?sslmode=disable \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 54fd501..328aedb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,4 @@ +# Modified version of https://github.com/sosedoff/pgweb/blob/master/docker-compose.yml services: postgres: container_name: postgres @@ -14,14 +15,30 @@ services: env_file: - .env healthcheck: - test: pg_isready -U hello-postgres -h 127.0.0.1 + test: pg_isready -U db -h 127.0.0.1 interval: 5s - # networks: - # - db-net + networks: + - db-net + pgweb: + container_name: pgweb + image: sosedoff/pgweb + ports: + - 8081:8081 + env_file: + - .env + networks: + - db-net + depends_on: + postgres: + condition: service_healthy + healthcheck: + test: ["CMD", "nc", "-vz", "127.0.0.1", "8081"] + interval: 5s + # volumes: # data: # name: hello-postgres -# networks: -# db-net: -# name: db-net \ No newline at end of file +networks: + db-net: + name: db-net \ No newline at end of file