Open rickyelopez opened 4 years ago
Hi! It seems that the server cannot connect to the database. Do you have postgres service in the docker-compose.yml?
Hi there! Yes, I do, I'm pretty much using the sample docker-compose.yml. See below for full docker-compose.yml file:
version: '3'
services:
planka:
image: meltyshev/planka:latest
command: >
bash -c
"for i in `seq 1 30`; do
./start.sh &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 seconds...\";
sleep 5;
done; (exit $$s)"
restart: unless-stopped
volumes:
- /servers/planka/user-avatars:/app/public/user-avatars
- /servers/planka/project-background-images:/app/public/project-background-images
- /servers/planka/attachments:/app/public/attachments
ports:
- 4000:1337
environment:
- BASE_URL=http://192.168.2.15:4000
- DATABASE_URL=postgresql://postgres@postgres/planka
- SECRET_KEY=a0bafe5f4166c7b7052597dd61a715f72c12dcb40ba1fa6a03da879af6d864b0357a406dbf8f548a014d037dffabc157d40d25414d4016eb18adb1de949cfc12
depends_on:
- postgres
postgres:
image: postgres:alpine
restart: unless-stopped
volumes:
- /servers/planka/db-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=planka
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
user-avatars:
project-background-images:
attachments:
db-data:
Ah no, it's an ok error, I have the same. It happens because Postgres doesn't have enough time to initialize (it fixes by retry timeout in the command section). What address do you use in the browser to access Planka?
OK makes sense. I tried with the hostname and the ip, nothing. I also tried using the hostname, localhost and 0.0.0.0 in the base url in the docker-compose.yml. Tried different ports too. No luck
Could it be because the containers that end up getting created are called planka_postgres_1
and planka_planka_1
but the docker-compose refers to the postgres server with postgres/planka
?
Nevermind, just tried adjusting the url in docker-compose.yml accordingly and it didn't change anything
Here's a full log, maybe that will point to something:
Attaching to planka_postgres_1, planka_planka_1
[36mpostgres_1 |[0m ********************************************************************************
[36mpostgres_1 |[0m WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow
[36mpostgres_1 |[0m anyone with access to the Postgres port to access your database without
[36mpostgres_1 |[0m a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
[36mpostgres_1 |[0m documentation about "trust":
[36mpostgres_1 |[0m https://www.postgresql.org/docs/current/auth-trust.html
[36mpostgres_1 |[0m In Docker's default configuration, this is effectively any other
[36mpostgres_1 |[0m container on the same system.
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace
[36mpostgres_1 |[0m it with "-e POSTGRES_PASSWORD=password" instead to set a password in
[36mpostgres_1 |[0m "docker run".
[36mpostgres_1 |[0m ********************************************************************************
[36mpostgres_1 |[0m The files belonging to this database system will be owned by user "postgres".
[36mpostgres_1 |[0m This user must also own the server process.
[36mpostgres_1 |[0m
[33mplanka_1 |[0m (node:9) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 192.168.64.2:5432
[33mplanka_1 |[0m at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
[36mpostgres_1 |[0m The database cluster will be initialized with locale "en_US.utf8".
[36mpostgres_1 |[0m The default database encoding has accordingly been set to "UTF8".
[36mpostgres_1 |[0m The default text search configuration will be set to "english".
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m Data page checksums are disabled.
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m fixing permissions on existing directory /var/lib/postgresql/data ... ok
[33mplanka_1 |[0m (node:9) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
[33mplanka_1 |[0m (node:9) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[36mpostgres_1 |[0m creating subdirectories ... ok
[36mpostgres_1 |[0m selecting dynamic shared memory implementation ... posix
[36mpostgres_1 |[0m selecting default max_connections ... 100
[36mpostgres_1 |[0m selecting default shared_buffers ... 128MB
[36mpostgres_1 |[0m selecting default time zone ... UTC
[36mpostgres_1 |[0m creating configuration files ... ok
[36mpostgres_1 |[0m running bootstrap script ... ok
[36mpostgres_1 |[0m performing post-bootstrap initialization ... sh: locale: not found
[36mpostgres_1 |[0m 2020-09-09 20:31:51.540 UTC [32] WARNING: no usable system locales were found
[36mpostgres_1 |[0m ok
[36mpostgres_1 |[0m syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections
[36mpostgres_1 |[0m You can change this by editing pg_hba.conf or using the option -A, or
[36mpostgres_1 |[0m --auth-local and --auth-host, the next time you run initdb.
[36mpostgres_1 |[0m ok
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m Success. You can now start the database server using:
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m pg_ctl -D /var/lib/postgresql/data -l logfile start
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m waiting for server to start....2020-09-09 20:31:52.642 UTC [37] LOG: starting PostgreSQL 12.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.3.0) 9.3.0, 64-bit
[36mpostgres_1 |[0m 2020-09-09 20:31:52.659 UTC [37] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
[33mplanka_1 |[0m Tried 1 times. Waiting 5 seconds...
[36mpostgres_1 |[0m 2020-09-09 20:31:52.735 UTC [38] LOG: database system was shut down at 2020-09-09 20:31:51 UTC
[36mpostgres_1 |[0m 2020-09-09 20:31:52.752 UTC [37] LOG: database system is ready to accept connections
[36mpostgres_1 |[0m done
[36mpostgres_1 |[0m server started
[36mpostgres_1 |[0m CREATE DATABASE
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m waiting for server to shut down....2020-09-09 20:31:53.137 UTC [37] LOG: received fast shutdown request
[36mpostgres_1 |[0m 2020-09-09 20:31:53.158 UTC [37] LOG: aborting any active transactions
[36mpostgres_1 |[0m 2020-09-09 20:31:53.159 UTC [37] LOG: background worker "logical replication launcher" (PID 44) exited with exit code 1
[36mpostgres_1 |[0m 2020-09-09 20:31:53.159 UTC [39] LOG: shutting down
[36mpostgres_1 |[0m 2020-09-09 20:31:53.248 UTC [37] LOG: database system is shut down
[36mpostgres_1 |[0m done
[36mpostgres_1 |[0m server stopped
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m PostgreSQL init process complete; ready for start up.
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m 2020-09-09 20:31:53.362 UTC [1] LOG: starting PostgreSQL 12.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.3.0) 9.3.0, 64-bit
[36mpostgres_1 |[0m 2020-09-09 20:31:53.362 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
[36mpostgres_1 |[0m 2020-09-09 20:31:53.362 UTC [1] LOG: listening on IPv6 address "::", port 5432
[36mpostgres_1 |[0m 2020-09-09 20:31:53.396 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
[36mpostgres_1 |[0m 2020-09-09 20:31:53.480 UTC [48] LOG: database system was shut down at 2020-09-09 20:31:53 UTC
[36mpostgres_1 |[0m 2020-09-09 20:31:53.502 UTC [1] LOG: database system is ready to accept connections
[33mplanka_1 |[0m FS-related option specified for migration configuration. This resets migrationSource to default FsMigrations
[33mplanka_1 |[0m FS-related option specified for migration configuration. This resets migrationSource to default FsMigrations
[33mplanka_1 |[0m debug: Detected Sails environment is "production", but NODE_ENV is `undefined`.
[33mplanka_1 |[0m debug: Automatically setting the NODE_ENV environment variable to "production".
[33mplanka_1 |[0m debug:
[33mplanka_1 |[0m debug: -------------------------------------------------------
[33mplanka_1 |[0m debug: :: Wed Sep 09 2020 20:32:00 GMT+0000 (Coordinated Universal Time)
[33mplanka_1 |[0m debug: Environment : production
[33mplanka_1 |[0m debug: Port : 1337
[33mplanka_1 |[0m debug: -------------------------------------------------------
Gracefully stopping... (press Ctrl+C again to force)
It looks like the server is properly lifted, so something in the network or docker settings. Try to exec docker container ls
it should be 0.0.0.0:[YOUR_PORT]->1337/tcp
in the PORTS column. Can you try to run some other app like Rocket.Chat?
Yes the output of that command is as expected. I'm running about 5 other apps through docker containers, and all of the rest of them are accessible, so I doubt it's a network thing...
I tried to reproduce this error but could not. My docker environment is on Windows 10 with the Linux subsystem. I set ports to 4000:1337
and BASE_URL=http://localhost:4000
docker ps
gives 0.0.0.0:4000->1337/tcp
What is the output of docker-compose exec planka wget -qO- 'http://0.0.0.0:1337'
? Is the web server in the container responding?
I have the same issue, anyone found out something?
I had the same issue was really disappointed because I wanted to get give this a go. Instead of using docker compose, I used the docker CLI. I created a separate Postgres container for shared databases across containers, a Postgres network and it all ran fine. I can post my docker CLI code if anyone is interested.
I was running into this same error, I fixed it by changing the postgres container's image to postgres:12-alpine
in the docker-compose file.
For me the problem was related to planka not finding postgres (I'm using Portainer). I fixed it by changing this line:
- DATABASE_URL=postgresql://postgres@postgres/planka
to my the ip of my portainer machine:
- DATABASE_URL=postgresql://postgres@10.10.10.10/planka
.
I also had this issue, and it was due to my Nginx Proxy Manager setup. Had the proxy configured properly, with websockets enabled, but forgot to setup a stream for the database. Added a proxy stream with the protgres port pointing to postgres container and all started working.
Maybe I'm doing something silly, but don't see where I could be messing up...
docker-compose.yml:
Can't connect at all (double checked port is open), I see this error in the docker-compose logs on first startup, no errors following that:
Any other info I can provide to be helpful?