Joplin Server Issues with Synology NAS: Postgres Database Connection Problem

Hi Everyone,

I am currently trying to spin up a Joplin server on my Synology NAS and I am currently having some issues where when I attempt to start my Joplin server container I then receive the following error message:

  • "[error] db: Timeout trying to connect to database: KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?"

I have a feeling that my issues are related to me using a different port then the standard 5432 port that postgres uses due to my Synology device reserving that port for itself. I can successfully connect to my postgres db via pgAdmin. Are my problems related to the fact that I am not using a docker-compose file? Or is my custom postgres db password screwing things up?

If it helps, I am running the latest container versions of postgres and the Joplin server.

Here is the command that I used to spin up my postgres container:

  • docker run --name sql01 -e POSTGRES_USER=joplin -e POSTGRES_PASSWORD=XXXX -v /volume1/docker/XXXX:/var/lib/postgresql/data -p 22301:5432 --net=joplin_network -d postgres
    This is the command that I used to spin up my Joplin server container:
  • docker run --name joplin01 --env-file .env -p 22300:22300 --net=joplin_network joplin/server

Here are the parameters of the ".env" file that I use:

  • APP_BASE_URL=XXXX
  • APP_PORT=22300
  • DB_CLIENT=pg
  • POSTGRES_PASSWORD= (custom password)
  • POSTGRES_DATABASE=joplin
  • POSTGRES_USER=joplin
  • POSTGRES_PORT=5432
  • POSTGRES_HOST=sql01
  • MAX_TIME_DRIFT=0

Here are some more detailed logs:

  • 2022-04-21 23:02:27 stderr at fulfilled (/home/joplin/packages/server/dist/db.js:5:58)
  • 2022-04-21 23:02:27 stderr at Generator.next ()
  • 2022-04-21 23:02:27 stderr at Object. (/home/joplin/packages/server/src/db.ts:113:10)
  • 2022-04-21 23:02:27 stderr Error: Timeout trying to connect to database. Last error was: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
  • 2022-04-21 23:02:27 stderr }
  • 2022-04-21 23:02:27 stderr bindings: undefined
  • 2022-04-21 23:02:27 stderr sql: undefined,
  • 2022-04-21 23:02:27 stderr at Runner.run (/home/joplin/packages/server/node_modules/knex/lib/execution/runner.js:30:19) {
  • 2022-04-21 23:02:27 stderr at Runner.ensureConnection (/home/joplin/packages/server/node_modules/knex/lib/execution/runner.js:259:28)
  • 2022-04-21 23:02:27 stderr at Client_PG.acquireConnection (/home/joplin/packages/server/node_modules/knex/lib/client.js:295:26)
  • 2022-04-21 23:02:27 stderr 2022-04-21 23:02:27: [error] db: Timeout trying to connect to database: KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
  • 2022-04-21 23:02:27 stdout 2022-04-21 23:02:27: db: Could not connect. Will try again. Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
  • 2022-04-21 23:01:57 stdout 2022-04-21 23:01:57: App: Trying to connect to database...
  • 2022-04-21 23:01:57 stdout 2022-04-21 23:01:57: App: Content driver (fallback): null
  • 2022-04-21 23:01:57 stdout 2022-04-21 23:01:57: App: Content driver: { type: 1 }

Any ideas anyone? I am sure that it is something minor that I missed as I am relatively new to Docker and I am still figuring things out. Thanks for all the help everyone!

The POSTGRES_PORT in the .env file is wrong, I assume, as it has to be set to 22301 which you specified for Postgres...maybe thats the solution :blush:

Best Regards

Thanks for the reply. I just tried changing the POSTGRES_PORT to "22301" but I still receive the same error message.

I am going to attempt to run both containers on my local machine first and see if I have the same issue.

Well I figured out the problem. Because I had enabled my Synology's firewall, my containers could not talk to each other or to anything external. After tweaking my firewall rules so my containers could talk to each other then everything started to work.

1 Like

Ah, perfect! Please mark your answer as the solution to your problem

Best regards

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.