Container restarting: Postgres + Docker + Digital Ocean

Hello everyone,

I’m facing a problem when deploy to Digital Ocean using docker (node.js) and Postgres database.
I searched on forum and saw that 2 people had a similar problem, but how they they solved is not working for me.

After make the deploy to DO, the target production light doesn’t turn green:

Captura de Tela 2021-02-17 às 18.22.55

On project settings, the connection with the remote container is working:

BUT, when I try to connect to the database to create the tables:

I tried to copy db_save.sql I generated on development enviroment to the production target folder and did not work as well.

Then I clicked on “Show logs” button, and found this:

2021-02-17 21:29:24.063 UTC [1] LOG: database system is shut down
db_1 | 2021-02-17 21:30:24.529 UTC [1] LOG: listening on IPv4 address “0.0.0.0”, port 5432
db_1 | 2021-02-17 21:30:24.529 UTC [1] LOG: listening on IPv6 address “::”, port 5432
db_1 | 2021-02-17 21:30:24.530 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
db_1 | 2021-02-17 21:30:24.546 UTC [1] FATAL: could not open log file “/custom_sql_log/postgres_query.log”: No such file or directory
db_1 | 2021-02-17 21:30:24.547 UTC [1] LOG: database system is shut down
web_1 | [nodemon] 2.0.7
web_1 | [nodemon] to restart at any time, enter rs
web_1 | [nodemon] watching path(s): app//* lib//* views//* extensions//* tmp/**/restart.txt
web_1 | [nodemon] watching extensions: ejs,js,json
web_1 | [nodemon] starting node ./index.js
web_1 | Warning: connect.session() MemoryStore is not
web_1 | designed for a production environment, as it will leak
web_1 | memory, and will not scale past a single process.
web_1 | App listening at http://localhost:3000

Then, I logged to my web server and run “docker ps” command and look what I got:


The DB container keeps on restarting again on again!
Is this a bug? Thanks!

@George @patrick any idea? Thanks!

@Teodor heeeelp!!

From what I see in the logging above you have enabled the logging option for your database?

Maybe disable that and redeploy

@George Thanks! All working now…so, for the first deploy, logging must be disabled?

Logging is for local debugging only and it logs quite a lot, like all queries.

So you don’t want that on a remote.

Good catch anyway, I will make sure it can’t be enabled on production deployments

1 Like

brilliant! Thanks!