[GH-ISSUE #37] could not ping DB error #26

Closed
opened 2026-02-26 21:34:04 +03:00 by kerem · 4 comments
Owner

Originally created by @geertvanleemputten on GitHub (Sep 5, 2024).
Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/37

postgres:
image: postgres:16
restart: always
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=XXX
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

pgbackweb:
image: eduardolat/pgbackweb:latest
ports:
- "8085:8085"
environment:
- PBW_ENCRYPTION_KEY="Af0r82HUCP6Xrt7aV1MTZK87DmnYPVGX"
- PBW_POSTGRES_CONN_STRING="postgresql://root:XXX@postgres:5432/pgbackweb?sslmode=disable"
- TZ="Europe/Brussels"
depends_on:
postgres:
condition: service_healthy

ERROR msg=could not ping DB error=dial tcp 127.0.0.1:5432: connect: connection refused
task: Failed to run task "serve": exit status 1
task: Failed to run task "migrate-serve": exit status 201

Originally created by @geertvanleemputten on GitHub (Sep 5, 2024). Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/37 postgres: image: postgres:16 restart: always environment: - POSTGRES_USER=root - POSTGRES_PASSWORD=XXX volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s timeout: 5s retries: 5 pgbackweb: image: eduardolat/pgbackweb:latest ports: - "8085:8085" environment: - PBW_ENCRYPTION_KEY="Af0r82HUCP6Xrt7aV1MTZK87DmnYPVGX" - PBW_POSTGRES_CONN_STRING="postgresql://root:XXX@postgres:5432/pgbackweb?sslmode=disable" - TZ="Europe/Brussels" depends_on: postgres: condition: service_healthy ERROR msg=could not ping DB error=dial tcp 127.0.0.1:5432: connect: connection refused task: Failed to run task "serve": exit status 1 task: Failed to run task "migrate-serve": exit status 201
kerem closed this issue 2026-02-26 21:34:04 +03:00
Author
Owner

@Persil090 commented on GitHub (Sep 10, 2024):

Did you add Postgresql you want to backup under PGBackWeb network?
I used portainer for this and once new IP was assigned I used that new IP to connect and it worked.
I used connection string as per official documentation.

<!-- gh-comment-id:2341748800 --> @Persil090 commented on GitHub (Sep 10, 2024): Did you add Postgresql you want to backup under PGBackWeb network? I used portainer for this and once new IP was assigned I used that new IP to connect and it worked. I used connection string as per official documentation.
Author
Owner

@geertvanleemputten commented on GitHub (Sep 11, 2024):

I have tried setting it up again, but no difference:

task: [migrate-serve] task goose -- up
task: [goose] eval $(go run ./cmd/goose/. up)
2024/09/11 17:24:41 OK 20240720055349_enable_extensions.sql (545.29ms)
2024/09/11 17:24:41 OK 20240720055620_add_change_updated_at_function.sql (92.87ms)
2024/09/11 17:24:41 OK 20240720055717_add_users_table.sql (210.84ms)
2024/09/11 17:24:41 OK 20240720055720_add_sessions_table.sql (137.99ms)
2024/09/11 17:24:41 OK 20240720055723_add_databases_table.sql (131.85ms)
2024/09/11 17:24:42 OK 20240720055730_add_destinations_table.sql (259.52ms)
2024/09/11 17:24:42 OK 20240720060503_add_backups_table.sql (295.45ms)
2024/09/11 17:24:42 OK 20240720060508_add_executions_table.sql (254.99ms)
2024/09/11 17:24:42 OK 20240803171113_add_is_local_to_backups_table.sql (22.33ms)
2024/09/11 17:24:42 OK 20240805000451_add_restorations_table.sql (276.49ms)
2024/09/11 17:24:42 goose: successfully migrated database to version: 20240805000451
task: [migrate-serve] task serve
task: [serve] ./dist/app
2024-09-11T17:24:43.541034421Z INFO msg=using .env file
2024-09-11T17:24:43.555437773Z INFO msg=cron scheduler initialized
2024-09-11T17:24:43.564657902Z ERROR msg=could not ping DB error=dial tcp [::1]:5432: connect: connection refused
task: Failed to run task "serve": exit status 1
task: Failed to run task "migrate-serve": exit status 201

I also use portainer. Used a docker-compose file, so they are both automatically in the same network. Im also able to generate the tables as you can see, but somehow the ping fails ?

<!-- gh-comment-id:2344275793 --> @geertvanleemputten commented on GitHub (Sep 11, 2024): I have tried setting it up again, but no difference: task: [migrate-serve] task goose -- up task: [goose] eval $(go run ./cmd/goose/. up) 2024/09/11 17:24:41 OK 20240720055349_enable_extensions.sql (545.29ms) 2024/09/11 17:24:41 OK 20240720055620_add_change_updated_at_function.sql (92.87ms) 2024/09/11 17:24:41 OK 20240720055717_add_users_table.sql (210.84ms) 2024/09/11 17:24:41 OK 20240720055720_add_sessions_table.sql (137.99ms) 2024/09/11 17:24:41 OK 20240720055723_add_databases_table.sql (131.85ms) 2024/09/11 17:24:42 OK 20240720055730_add_destinations_table.sql (259.52ms) 2024/09/11 17:24:42 OK 20240720060503_add_backups_table.sql (295.45ms) 2024/09/11 17:24:42 OK 20240720060508_add_executions_table.sql (254.99ms) 2024/09/11 17:24:42 OK 20240803171113_add_is_local_to_backups_table.sql (22.33ms) 2024/09/11 17:24:42 OK 20240805000451_add_restorations_table.sql (276.49ms) 2024/09/11 17:24:42 goose: successfully migrated database to version: 20240805000451 task: [migrate-serve] task serve task: [serve] ./dist/app 2024-09-11T17:24:43.541034421Z INFO msg=using .env file 2024-09-11T17:24:43.555437773Z INFO msg=cron scheduler initialized 2024-09-11T17:24:43.564657902Z ERROR msg=could not ping DB error=dial tcp [::1]:5432: connect: connection refused task: Failed to run task "serve": exit status 1 task: Failed to run task "migrate-serve": exit status 201 I also use portainer. Used a docker-compose file, so they are both automatically in the same network. Im also able to generate the tables as you can see, but somehow the ping fails ?
Author
Owner

@Persil090 commented on GitHub (Sep 11, 2024):

Hm ok as I am beginner in docker I would not know more answers for now unfortunately...I just know that I setup standalone pgbackweb container with docker compose and Odoo via different docker compose file so I needed to add them to network and connection worked....

<!-- gh-comment-id:2344703476 --> @Persil090 commented on GitHub (Sep 11, 2024): Hm ok as I am beginner in docker I would not know more answers for now unfortunately...I just know that I setup standalone pgbackweb container with docker compose and Odoo via different docker compose file so I needed to add them to network and connection worked....
Author
Owner

@geertvanleemputten commented on GitHub (Sep 16, 2024):

I completely do not understand it, but I solved it by changing:

environment:
- PBW_ENCRYPTION_KEY="my_secret_key" # Change this to a strong key
- PBW_POSTGRES_CONN_STRING="postgresql://postgres:password@postgres:5432/pgbackweb?sslmode=disable"
- TZ="Europe/Brussels"

to

environment:
PBW_ENCRYPTION_KEY: "my_secret_key" # Change this to a strong key
PBW_POSTGRES_CONN_STRING: "postgresql://postgres:password@postgres:5432/pgbackweb?sslmode=disable"
TZ: "Europe/Brussels"

<!-- gh-comment-id:2352223321 --> @geertvanleemputten commented on GitHub (Sep 16, 2024): I completely do not understand it, but I solved it by changing: environment: - PBW_ENCRYPTION_KEY="my_secret_key" # Change this to a strong key - PBW_POSTGRES_CONN_STRING="postgresql://postgres:password@postgres:5432/pgbackweb?sslmode=disable" - TZ="Europe/Brussels" to environment: PBW_ENCRYPTION_KEY: "my_secret_key" # Change this to a strong key PBW_POSTGRES_CONN_STRING: "postgresql://postgres:password@postgres:5432/pgbackweb?sslmode=disable" TZ: "Europe/Brussels"
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pgbackweb#26
No description provided.