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