eduardolat / pgbackweb

🐘 Effortless PostgreSQL backups with a user-friendly web interface! 🌐💾
MIT License
716 stars 30 forks source link

could not ping DB error #37

Closed geertvanleemputten closed 17 hours ago

geertvanleemputten commented 1 week ago

postgres: image: postgres:16 restart: always environment:

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

Persil090 commented 6 days ago

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.

geertvanleemputten commented 5 days ago

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 ?

Persil090 commented 5 days ago

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....

geertvanleemputten commented 17 hours ago

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

environment:

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"