mirror of
https://github.com/plankanban/planka.git
synced 2026-02-26 03:21:55 +03:00
docker-compose fails to start: KnexTimeoutError: Knex: Timeout acquiring a connection.
#441
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ky-bean on GitHub (Mar 20, 2024).
Ubuntu 22.04.4 LTS
Linux kernel 5.15.0-101-generic
x86_64
Running
docker compose upafter setting SECRET_KEY and uncommenting the DEFAULT_ADMIN_* lines in thedocker-compose.ymlpulled directly from the repo fails to start the container:The planka-1 set of logs repeats every few seconds as the container is restarted and encounters the same error.
I have no clue what Knex is and no idea where to begin debugging/solving it and I'm not terribly familiar with the development side of docker containers. Some quick Google searches seem to indicate an out of date package, but I don't know what to do with that information.
Here is my docker-compose:
The only major deviation from the default docker-compose is the DATABASE_URL, which is changed to the IP address of the postgres container as
postgres@postgresdoesn't work, the planka container fails to connect to the postgres container.Probably a duplicate of #93 but there's been no updates there in the 3 years it's been open.
@meltyshev commented on GitHub (Mar 20, 2024):
Hi! I'm not very familiar with Docker, but clearly the problem is connecting to a database with
DATABASE_URLspecified. Maybe there's something with Docker's settings. I'll add a "help wanted" label in hopes that someone will respond.@ky-bean commented on GitHub (Mar 20, 2024):
Just to give a bit more context on the change for
DATABASE_URL, here's the log if I leave it as the defaultpostgresql://postgres@postgres/planka(from a fresh startup, no pre-existing volumes):Additionally I've discovered that the ip assigned to the postgres container changes each time the container is restarted, so using the IP in the
DATABASE_URLisn't a functional solution. Sopostgres@postgresdoesn't work, and addinghostname: postgresunder the postgres service doesn't change the output from the above.@meltyshev commented on GitHub (Mar 20, 2024):
Hmm, I have an idea to try to specify
networksfor each service, for example:Added
networksto each service and at the bottom (note thatdocker-compose.ymlis the default one without your settings).@ky-bean commented on GitHub (Mar 21, 2024):
Unfortunately no apparent change, with and without setting the hostname for the postgres container:
@ky-bean commented on GitHub (Mar 21, 2024):
I'm noticing that those ECONNREFUSED exceptions only show up in the long on the first start of a clean container, but something still isn't connecting right. Log for a restart:
Trying to connect to Planka in my browser (Firefox) in either condition yields a blank white screen. There's a single warning in the browser's console log:
@meltyshev commented on GitHub (Mar 21, 2024):
It seems those errors were simply because Planka was trying to connect to the database before it was created. According to the latest log, everything is running correctly.
I'm trying to figure out...
@meltyshev commented on GitHub (Mar 21, 2024):
Are you trying to connect to http://192.168.5.69:3000 in the browser? Then your
BASE_URLindocker-compose.ymlis http://192.168.5.69:3000?@ky-bean commented on GitHub (Mar 21, 2024):
I have goofed somewhere along the line. The
BASE_URLgot reset tolocalhostso those GETs were failing because it was trying to connect to the local machine, not the server.I'm working backwards now to figure out what changes got things to work
@ky-bean commented on GitHub (Mar 21, 2024):
I didn't make it clear above, but fixing
BASE_URLlet me connect to the server login page.@ky-bean commented on GitHub (Mar 21, 2024):
Alright so I think I understand what's happened now. When I first started the container I was watching the logs as it spun up and saw the
triggerUncaughtExceptionmessage onECONNREFUSEDfollowed byplanka-1 exited with code 0and naively assumed that the container had failed to start becuase that it couldn't connect to the database, so I messed with theDATABASE_URLwhich triggered theKnexTimeoutError. At some point in messing with the docker-compose file I reset theBASE_URLto the defaultlocalhostaddress which meant that when I did finally try to connect to the running Planka it failed to fetch the website. So the default docker-compose file does indeed work, you just need to ignore the errors that show up when the container first starts.Sorry for wasting your time, thank you for lending your help even though it was for nothing.
Maybe it'd be worth adding a note to the install docs for docker that the
ECONNREFUSEDerrors on the first container startup can be safely ignored.@meltyshev commented on GitHub (Mar 21, 2024):
No worries at all :)
That's a nice suggestion, thanks!