docker-compose fails to start: KnexTimeoutError: Knex: Timeout acquiring a connection. #441

Closed
opened 2026-02-04 19:31:38 +03:00 by OVERLORD · 11 comments
Owner

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 up after setting SECRET_KEY and uncommenting the DEFAULT_ADMIN_* lines in the docker-compose.yml pulled directly from the repo fails to start the container:

postgres-1  | ********************************************************
postgres-1  | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trus
postgres-1  |          anyone with access to the Postgres port to acce
postgres-1  |          a password, even if POSTGRES_PASSWORD is set. S
postgres-1  |          documentation about "trust":
postgres-1  |          https://www.postgresql.org/docs/current/auth-tr
postgres-1  |          In Docker's default configuration, this is effe
postgres-1  |          container on the same system.
postgres-1  |
postgres-1  |          It is not recommended to use POSTGRES_HOST_AUTH
postgres-1  |          it with "-e POSTGRES_PASSWORD=password" instead
postgres-1  |          "docker run".
postgres-1  | ********************************************************
postgres-1  | The files belonging to this database system will be owne
postgres-1  | This user must also own the server process.
postgres-1  |
postgres-1  | The database cluster will be initialized with locale "en
postgres-1  | The default database encoding has accordingly been set t
postgres-1  | The default text search configuration will be set to "en
postgres-1  |
postgres-1  | Data page checksums are disabled.
postgres-1  |
postgres-1  | fixing permissions on existing directory /var/lib/postgr
postgres-1  | creating subdirectories ... ok
postgres-1  | selecting dynamic shared memory implementation ... posix
postgres-1  | selecting default max_connections ... 100
postgres-1  | selecting default shared_buffers ... 128MB
postgres-1  | selecting default time zone ... UTC
postgres-1  | creating configuration files ... ok
postgres-1  | running bootstrap script ... ok
postgres-1  | sh: locale: not found
postgres-1  | 2024-03-20 03:29:52.069 UTC [31] WARNING:  no usable sys
postgres-1  | performing post-bootstrap initialization ... ok
postgres-1  | syncing data to disk ... ok
postgres-1  |
postgres-1  |
postgres-1  | Success. You can now start the database server using:
postgres-1  |
postgres-1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres-1  |
postgres-1  | initdb: warning: enabling "trust" authentication for loc
postgres-1  | You can change this by editing pg_hba.conf or using the
postgres-1  | --auth-local and --auth-host, the next time you run init
postgres-1  | waiting for server to start....2024-03-20 03:30:01.145 U
postgres-1  | 2024-03-20 03:30:01.151 UTC [37] LOG:  listening on Unix
postgres-1  | 2024-03-20 03:30:01.180 UTC [38] LOG:  database system w
postgres-1  | 2024-03-20 03:30:01.195 UTC [37] LOG:  database system i
postgres-1  |  done
postgres-1  | server started
postgres-1  | 2024-03-20 03:30:01.550 UTC [56] FATAL:  database "plank
postgres-1  | CREATE DATABASE
postgres-1  |
postgres-1  |
postgres-1  | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-en
postgres-1  |
postgres-1  | waiting for server to shut down....2024-03-20 03:30:04.4
postgres-1  | 2024-03-20 03:30:04.429 UTC [37] LOG:  aborting any acti
postgres-1  | 2024-03-20 03:30:04.435 UTC [37] LOG:  background worker
postgres-1  | 2024-03-20 03:30:04.435 UTC [39] LOG:  shutting down
postgres-1  | 2024-03-20 03:30:04.547 UTC [37] LOG:  database system i
postgres-1  |  done
postgres-1  | server stopped
postgres-1  |
postgres-1  | PostgreSQL init process complete; ready for start up.
postgres-1  |
postgres-1  | 2024-03-20 03:30:04.678 UTC [1] LOG:  starting PostgreSQ
postgres-1  | 2024-03-20 03:30:04.678 UTC [1] LOG:  listening on IPv4
postgres-1  | 2024-03-20 03:30:04.678 UTC [1] LOG:  listening on IPv6
postgres-1  | 2024-03-20 03:30:04.709 UTC [1] LOG:  listening on Unix
postgres-1  | 2024-03-20 03:30:04.728 UTC [59] LOG:  database system w
postgres-1  | 2024-03-20 03:30:04.737 UTC [1] LOG:  database system is
planka-1    | /app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules
planka-1    |         convertedError = new KnexTimeoutError(
planka-1    |                          ^
planka-1    |
planka-1    | KnexTimeoutError: Knex: Timeout acquiring a connection.
planka-1    |     at Client_PG.acquireConnection (/app/node_modules/.p
planka-1    |     at async Runner.ensureConnection (/app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules/knex/lib/execution/runner.js:305:28)
planka-1    |     at async Runner.run (/app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules/knex/lib/execution/runner.js:30:19)
planka-1    |     at async listCompleted (/app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules/knex/lib/migrations/migrate/migration-list-resolver.js:12:3)
planka-1    |     at async Promise.all (index 1)
planka-1    |     at async Migrator.latest (/app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules/knex/lib/migrations/migrate/Migrator.js:63:29)
planka-1    |     at async /app/db/init.js:9:5 {
planka-1    |   sql: undefined,
planka-1    |   bindings: undefined
planka-1    | }
planka-1    |
planka-1    | Node.js v18.19.1
planka-1 exited with code 0

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:

version: '3'

services:
  planka:
    image: ghcr.io/plankanban/planka:latest
    restart: on-failure
    volumes:
      - user-avatars:/app/public/user-avatars
      - project-background-images:/app/public/project-background-images
      - attachments:/app/private/attachments
    ports:
      - 3000:1337
    environment:
      - BASE_URL=http://localhost:3000
      - DATABASE_URL=postgresql://postgres@172.29.0.2/planka
      - SECRET_KEY=# SECRET #

      # - TRUST_PROXY=0
      # - TOKEN_EXPIRES_IN=365 # In days

      # related: https://github.com/knex/knex/issues/2354
      # As knex does not pass query parameters from the connection string we
      # have to use environment variables in order to pass the desired values, e.g.
      # - PGSSLMODE=<value>

      # Configure knex to accept SSL certificates
      # - KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false

      - DEFAULT_ADMIN_EMAIL=demo@demo.demo
      - DEFAULT_ADMIN_PASSWORD=demo
      - DEFAULT_ADMIN_NAME=Demo Demo
      - DEFAULT_ADMIN_USERNAME=demo

      # - OIDC_ISSUER=
      # - OIDC_CLIENT_ID=
      # - OIDC_CLIENT_SECRET=
      # - OIDC_SCOPES=openid email profile
      # - OIDC_ADMIN_ROLES=admin
      # - OIDC_EMAIL_ATTRIBUTE=email
      # - OIDC_NAME_ATTRIBUTE=name
      # - OIDC_USERNAME_ATTRIBUTE=preferred_username
      # - OIDC_ROLES_ATTRIBUTE=groups
      # - OIDC_IGNORE_USERNAME=true
      # - OIDC_IGNORE_ROLES=true
      # - OIDC_ENFORCED=true
    depends_on:
      postgres:
        condition: service_healthy

  postgres:
    image: postgres:14-alpine
    restart: on-failure
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=planka
      - POSTGRES_HOST_AUTH_METHOD=trust
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d planka"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  user-avatars:
  project-background-images:
  attachments:
  db-data:

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@postgres doesn'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.

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 up` after setting SECRET_KEY and uncommenting the DEFAULT\_ADMIN\_\* lines in the `docker-compose.yml` pulled directly from the repo fails to start the container: ``` postgres-1 | ******************************************************** postgres-1 | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trus postgres-1 | anyone with access to the Postgres port to acce postgres-1 | a password, even if POSTGRES_PASSWORD is set. S postgres-1 | documentation about "trust": postgres-1 | https://www.postgresql.org/docs/current/auth-tr postgres-1 | In Docker's default configuration, this is effe postgres-1 | container on the same system. postgres-1 | postgres-1 | It is not recommended to use POSTGRES_HOST_AUTH postgres-1 | it with "-e POSTGRES_PASSWORD=password" instead postgres-1 | "docker run". postgres-1 | ******************************************************** postgres-1 | The files belonging to this database system will be owne postgres-1 | This user must also own the server process. postgres-1 | postgres-1 | The database cluster will be initialized with locale "en postgres-1 | The default database encoding has accordingly been set t postgres-1 | The default text search configuration will be set to "en postgres-1 | postgres-1 | Data page checksums are disabled. postgres-1 | postgres-1 | fixing permissions on existing directory /var/lib/postgr postgres-1 | creating subdirectories ... ok postgres-1 | selecting dynamic shared memory implementation ... posix postgres-1 | selecting default max_connections ... 100 postgres-1 | selecting default shared_buffers ... 128MB postgres-1 | selecting default time zone ... UTC postgres-1 | creating configuration files ... ok postgres-1 | running bootstrap script ... ok postgres-1 | sh: locale: not found postgres-1 | 2024-03-20 03:29:52.069 UTC [31] WARNING: no usable sys postgres-1 | performing post-bootstrap initialization ... ok postgres-1 | syncing data to disk ... ok postgres-1 | postgres-1 | postgres-1 | Success. You can now start the database server using: postgres-1 | postgres-1 | pg_ctl -D /var/lib/postgresql/data -l logfile start postgres-1 | postgres-1 | initdb: warning: enabling "trust" authentication for loc postgres-1 | You can change this by editing pg_hba.conf or using the postgres-1 | --auth-local and --auth-host, the next time you run init postgres-1 | waiting for server to start....2024-03-20 03:30:01.145 U postgres-1 | 2024-03-20 03:30:01.151 UTC [37] LOG: listening on Unix postgres-1 | 2024-03-20 03:30:01.180 UTC [38] LOG: database system w postgres-1 | 2024-03-20 03:30:01.195 UTC [37] LOG: database system i postgres-1 | done postgres-1 | server started postgres-1 | 2024-03-20 03:30:01.550 UTC [56] FATAL: database "plank postgres-1 | CREATE DATABASE postgres-1 | postgres-1 | postgres-1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-en postgres-1 | postgres-1 | waiting for server to shut down....2024-03-20 03:30:04.4 postgres-1 | 2024-03-20 03:30:04.429 UTC [37] LOG: aborting any acti postgres-1 | 2024-03-20 03:30:04.435 UTC [37] LOG: background worker postgres-1 | 2024-03-20 03:30:04.435 UTC [39] LOG: shutting down postgres-1 | 2024-03-20 03:30:04.547 UTC [37] LOG: database system i postgres-1 | done postgres-1 | server stopped postgres-1 | postgres-1 | PostgreSQL init process complete; ready for start up. postgres-1 | postgres-1 | 2024-03-20 03:30:04.678 UTC [1] LOG: starting PostgreSQ postgres-1 | 2024-03-20 03:30:04.678 UTC [1] LOG: listening on IPv4 postgres-1 | 2024-03-20 03:30:04.678 UTC [1] LOG: listening on IPv6 postgres-1 | 2024-03-20 03:30:04.709 UTC [1] LOG: listening on Unix postgres-1 | 2024-03-20 03:30:04.728 UTC [59] LOG: database system w postgres-1 | 2024-03-20 03:30:04.737 UTC [1] LOG: database system is planka-1 | /app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules planka-1 | convertedError = new KnexTimeoutError( planka-1 | ^ planka-1 | planka-1 | KnexTimeoutError: Knex: Timeout acquiring a connection. planka-1 | at Client_PG.acquireConnection (/app/node_modules/.p planka-1 | at async Runner.ensureConnection (/app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules/knex/lib/execution/runner.js:305:28) planka-1 | at async Runner.run (/app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules/knex/lib/execution/runner.js:30:19) planka-1 | at async listCompleted (/app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules/knex/lib/migrations/migrate/migration-list-resolver.js:12:3) planka-1 | at async Promise.all (index 1) planka-1 | at async Migrator.latest (/app/node_modules/.pnpm/knex@3.0.1_pg@8.8.0/node_modules/knex/lib/migrations/migrate/Migrator.js:63:29) planka-1 | at async /app/db/init.js:9:5 { planka-1 | sql: undefined, planka-1 | bindings: undefined planka-1 | } planka-1 | planka-1 | Node.js v18.19.1 planka-1 exited with code 0 ``` 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: ``` version: '3' services: planka: image: ghcr.io/plankanban/planka:latest restart: on-failure volumes: - user-avatars:/app/public/user-avatars - project-background-images:/app/public/project-background-images - attachments:/app/private/attachments ports: - 3000:1337 environment: - BASE_URL=http://localhost:3000 - DATABASE_URL=postgresql://postgres@172.29.0.2/planka - SECRET_KEY=# SECRET # # - TRUST_PROXY=0 # - TOKEN_EXPIRES_IN=365 # In days # related: https://github.com/knex/knex/issues/2354 # As knex does not pass query parameters from the connection string we # have to use environment variables in order to pass the desired values, e.g. # - PGSSLMODE=<value> # Configure knex to accept SSL certificates # - KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false - DEFAULT_ADMIN_EMAIL=demo@demo.demo - DEFAULT_ADMIN_PASSWORD=demo - DEFAULT_ADMIN_NAME=Demo Demo - DEFAULT_ADMIN_USERNAME=demo # - OIDC_ISSUER= # - OIDC_CLIENT_ID= # - OIDC_CLIENT_SECRET= # - OIDC_SCOPES=openid email profile # - OIDC_ADMIN_ROLES=admin # - OIDC_EMAIL_ATTRIBUTE=email # - OIDC_NAME_ATTRIBUTE=name # - OIDC_USERNAME_ATTRIBUTE=preferred_username # - OIDC_ROLES_ATTRIBUTE=groups # - OIDC_IGNORE_USERNAME=true # - OIDC_IGNORE_ROLES=true # - OIDC_ENFORCED=true depends_on: postgres: condition: service_healthy postgres: image: postgres:14-alpine restart: on-failure volumes: - db-data:/var/lib/postgresql/data environment: - POSTGRES_DB=planka - POSTGRES_HOST_AUTH_METHOD=trust healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d planka"] interval: 10s timeout: 5s retries: 5 volumes: user-avatars: project-background-images: attachments: db-data: ``` 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@postgres` doesn'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.
OVERLORD added the help wanted label 2026-02-04 19:31:38 +03:00
Author
Owner

@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_URL specified. Maybe there's something with Docker's settings. I'll add a "help wanted" label in hopes that someone will respond.

@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_URL` specified. Maybe there's something with Docker's settings. I'll add a "help wanted" label in hopes that someone will respond.
Author
Owner

@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 default postgresql://postgres@postgres/planka (from a fresh startup, no pre-existing volumes):

postgres-1  | *****************************************************************
postgres-1  | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This
postgres-1  |          anyone with access to the Postgres port to access your d
postgres-1  |          a password, even if POSTGRES_PASSWORD is set. See Postgr
postgres-1  |          documentation about "trust":
postgres-1  |          https://www.postgresql.org/docs/current/auth-trust.html
postgres-1  |          In Docker's default configuration, this is effectively a
postgres-1  |          container on the same system.
postgres-1  |
postgres-1  |          It is not recommended to use POSTGRES_HOST_AUTH_METHOD=t
postgres-1  |          it with "-e POSTGRES_PASSWORD=password" instead to set a
postgres-1  |          "docker run".
postgres-1  | *****************************************************************
postgres-1  | The files belonging to this database system will be owned by user
postgres-1  | This user must also own the server process.
postgres-1  |
postgres-1  | The database cluster will be initialized with locale "en_US.utf8"
postgres-1  | The default database encoding has accordingly been set to "UTF8".
postgres-1  | The default text search configuration will be set to "english".
postgres-1  |
postgres-1  | Data page checksums are disabled.
postgres-1  |
postgres-1  | fixing permissions on existing directory /var/lib/postgresql/data
postgres-1  | creating subdirectories ... ok
postgres-1  | selecting dynamic shared memory implementation ... posix
postgres-1  | selecting default max_connections ... 100
postgres-1  | selecting default shared_buffers ... 128MB
postgres-1  | selecting default time zone ... UTC
postgres-1  | creating configuration files ... ok
postgres-1  | running bootstrap script ... ok
postgres-1  | sh: locale: not found
postgres-1  | 2024-03-20 19:21:55.256 UTC [31] WARNING:  no usable system local
postgres-1  | performing post-bootstrap initialization ... ok
postgres-1  | syncing data to disk ... ok
postgres-1  |
postgres-1  |
postgres-1  | Success. You can now start the database server using:
postgres-1  |
postgres-1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres-1  |
postgres-1  | initdb: warning: enabling "trust" authentication for local connec
postgres-1  | You can change this by editing pg_hba.conf or using the option -A
postgres-1  | --auth-local and --auth-host, the next time you run initdb.
postgres-1  | waiting for server to start....2024-03-20 19:22:04.387 UTC [37] L
postgres-1  | 2024-03-20 19:22:04.397 UTC [37] LOG:  listening on Unix socket "
postgres-1  | 2024-03-20 19:22:04.423 UTC [38] LOG:  database system was shut d
postgres-1  | 2024-03-20 19:22:04.441 UTC [37] LOG:  database system is ready t
postgres-1  |  done
postgres-1  | server started
postgres-1  | 2024-03-20 19:22:04.743 UTC [55] FATAL:  database "planka" does n
planka-1    | node:internal/process/promises:288
planka-1    |             triggerUncaughtException(err, true /* fromPromise */)
planka-1    |             ^
planka-1    |
planka-1    | Error: connect ECONNREFUSED 192.168.112.2:5432
planka-1    |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555
planka-1    |   errno: -111,
planka-1    |   code: 'ECONNREFUSED',
planka-1    |   syscall: 'connect',
planka-1    |   address: '192.168.112.2',
planka-1    |   port: 5432
planka-1    | }
planka-1    |
planka-1    | Node.js v18.19.1
planka-1 exited with code 0
postgres-1  | CREATE DATABASE
postgres-1  |
postgres-1  |
postgres-1  | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-
postgres-1  |
postgres-1  | waiting for server to shut down....2024-03-20 19:22:07.797 UTC [3
postgres-1  | 2024-03-20 19:22:07.807 UTC [37] LOG:  aborting any active transa
postgres-1  | 2024-03-20 19:22:07.808 UTC [37] LOG:  background worker "logical
postgres-1  | 2024-03-20 19:22:07.808 UTC [39] LOG:  shutting down
postgres-1  | 2024-03-20 19:22:07.876 UTC [37] LOG:  database system is shut do
planka-1    | node:internal/process/promises:288
planka-1    |             triggerUncaughtException(err, true /* fromPromise */)
planka-1    |             ^
planka-1    |
planka-1    | Error: connect ECONNREFUSED 192.168.112.2:5432
planka-1    |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555
planka-1    |   errno: -111,
planka-1    |   code: 'ECONNREFUSED',
planka-1    |   syscall: 'connect',
planka-1    |   address: '192.168.112.2',
planka-1    |   port: 5432
planka-1    | }
planka-1    |
planka-1    | Node.js v18.19.1
postgres-1  |  done
postgres-1  | server stopped
postgres-1  |
postgres-1  | PostgreSQL init process complete; ready for start up.
postgres-1  |
postgres-1  | 2024-03-20 19:22:07.950 UTC [1] LOG:  starting PostgreSQL 14.11 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
postgres-1  | 2024-03-20 19:22:07.950 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres-1  | 2024-03-20 19:22:07.950 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres-1  | 2024-03-20 19:22:07.971 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1  | 2024-03-20 19:22:07.989 UTC [58] LOG:  database system was shut down at 2024-03-20 19:22:07 UTC
postgres-1  | 2024-03-20 19:22:08.008 UTC [1] LOG:  database system is ready to accept connections
planka-1 exited with code 0
planka-1    | debug: It looks like your `sails.config.sockets.onlyAllowOrigins` array only includes
planka-1    | debug: references to the `localhost` origin.  This is completely valid, but be sure
planka-1    | debug: to add any other origins to this list that you'd like to accept socket
planka-1    | debug: connections from!
planka-1    | debug:

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_URL isn't a functional solution. So postgres@postgres doesn't work, and adding hostname: postgres under the postgres service doesn't change the output from the above.

@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 default `postgresql://postgres@postgres/planka` (from a fresh startup, no pre-existing volumes): ``` postgres-1 | ***************************************************************** postgres-1 | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This postgres-1 | anyone with access to the Postgres port to access your d postgres-1 | a password, even if POSTGRES_PASSWORD is set. See Postgr postgres-1 | documentation about "trust": postgres-1 | https://www.postgresql.org/docs/current/auth-trust.html postgres-1 | In Docker's default configuration, this is effectively a postgres-1 | container on the same system. postgres-1 | postgres-1 | It is not recommended to use POSTGRES_HOST_AUTH_METHOD=t postgres-1 | it with "-e POSTGRES_PASSWORD=password" instead to set a postgres-1 | "docker run". postgres-1 | ***************************************************************** postgres-1 | The files belonging to this database system will be owned by user postgres-1 | This user must also own the server process. postgres-1 | postgres-1 | The database cluster will be initialized with locale "en_US.utf8" postgres-1 | The default database encoding has accordingly been set to "UTF8". postgres-1 | The default text search configuration will be set to "english". postgres-1 | postgres-1 | Data page checksums are disabled. postgres-1 | postgres-1 | fixing permissions on existing directory /var/lib/postgresql/data postgres-1 | creating subdirectories ... ok postgres-1 | selecting dynamic shared memory implementation ... posix postgres-1 | selecting default max_connections ... 100 postgres-1 | selecting default shared_buffers ... 128MB postgres-1 | selecting default time zone ... UTC postgres-1 | creating configuration files ... ok postgres-1 | running bootstrap script ... ok postgres-1 | sh: locale: not found postgres-1 | 2024-03-20 19:21:55.256 UTC [31] WARNING: no usable system local postgres-1 | performing post-bootstrap initialization ... ok postgres-1 | syncing data to disk ... ok postgres-1 | postgres-1 | postgres-1 | Success. You can now start the database server using: postgres-1 | postgres-1 | pg_ctl -D /var/lib/postgresql/data -l logfile start postgres-1 | postgres-1 | initdb: warning: enabling "trust" authentication for local connec postgres-1 | You can change this by editing pg_hba.conf or using the option -A postgres-1 | --auth-local and --auth-host, the next time you run initdb. postgres-1 | waiting for server to start....2024-03-20 19:22:04.387 UTC [37] L postgres-1 | 2024-03-20 19:22:04.397 UTC [37] LOG: listening on Unix socket " postgres-1 | 2024-03-20 19:22:04.423 UTC [38] LOG: database system was shut d postgres-1 | 2024-03-20 19:22:04.441 UTC [37] LOG: database system is ready t postgres-1 | done postgres-1 | server started postgres-1 | 2024-03-20 19:22:04.743 UTC [55] FATAL: database "planka" does n planka-1 | node:internal/process/promises:288 planka-1 | triggerUncaughtException(err, true /* fromPromise */) planka-1 | ^ planka-1 | planka-1 | Error: connect ECONNREFUSED 192.168.112.2:5432 planka-1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555 planka-1 | errno: -111, planka-1 | code: 'ECONNREFUSED', planka-1 | syscall: 'connect', planka-1 | address: '192.168.112.2', planka-1 | port: 5432 planka-1 | } planka-1 | planka-1 | Node.js v18.19.1 planka-1 exited with code 0 postgres-1 | CREATE DATABASE postgres-1 | postgres-1 | postgres-1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint- postgres-1 | postgres-1 | waiting for server to shut down....2024-03-20 19:22:07.797 UTC [3 postgres-1 | 2024-03-20 19:22:07.807 UTC [37] LOG: aborting any active transa postgres-1 | 2024-03-20 19:22:07.808 UTC [37] LOG: background worker "logical postgres-1 | 2024-03-20 19:22:07.808 UTC [39] LOG: shutting down postgres-1 | 2024-03-20 19:22:07.876 UTC [37] LOG: database system is shut do planka-1 | node:internal/process/promises:288 planka-1 | triggerUncaughtException(err, true /* fromPromise */) planka-1 | ^ planka-1 | planka-1 | Error: connect ECONNREFUSED 192.168.112.2:5432 planka-1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555 planka-1 | errno: -111, planka-1 | code: 'ECONNREFUSED', planka-1 | syscall: 'connect', planka-1 | address: '192.168.112.2', planka-1 | port: 5432 planka-1 | } planka-1 | planka-1 | Node.js v18.19.1 postgres-1 | done postgres-1 | server stopped postgres-1 | postgres-1 | PostgreSQL init process complete; ready for start up. postgres-1 | postgres-1 | 2024-03-20 19:22:07.950 UTC [1] LOG: starting PostgreSQL 14.11 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit postgres-1 | 2024-03-20 19:22:07.950 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres-1 | 2024-03-20 19:22:07.950 UTC [1] LOG: listening on IPv6 address "::", port 5432 postgres-1 | 2024-03-20 19:22:07.971 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres-1 | 2024-03-20 19:22:07.989 UTC [58] LOG: database system was shut down at 2024-03-20 19:22:07 UTC postgres-1 | 2024-03-20 19:22:08.008 UTC [1] LOG: database system is ready to accept connections planka-1 exited with code 0 planka-1 | debug: It looks like your `sails.config.sockets.onlyAllowOrigins` array only includes planka-1 | debug: references to the `localhost` origin. This is completely valid, but be sure planka-1 | debug: to add any other origins to this list that you'd like to accept socket planka-1 | debug: connections from! planka-1 | debug: ``` 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_URL` isn't a functional solution. So `postgres@postgres` doesn't work, and adding `hostname: postgres` under the postgres service doesn't change the output from the above.
Author
Owner

@meltyshev commented on GitHub (Mar 20, 2024):

Hmm, I have an idea to try to specify networks for each service, for example:

version: '3'

services:
  planka:
    image: ghcr.io/plankanban/planka:latest
    restart: on-failure
    volumes:
      - user-avatars:/app/public/user-avatars
      - project-background-images:/app/public/project-background-images
      - attachments:/app/private/attachments
    ports:
      - 3000:1337
    environment:
      - BASE_URL=http://localhost:3000
      - DATABASE_URL=postgresql://postgres@postgres/planka
      - SECRET_KEY=notsecretkey

      # - TRUST_PROXY=0
      # - TOKEN_EXPIRES_IN=365 # In days

      # related: https://github.com/knex/knex/issues/2354
      # As knex does not pass query parameters from the connection string we
      # have to use environment variables in order to pass the desired values, e.g.
      # - PGSSLMODE=<value>

      # Configure knex to accept SSL certificates
      # - KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false

      # - DEFAULT_ADMIN_EMAIL=demo@demo.demo # Do not remove if you want to prevent this user from being edited/deleted
      # - DEFAULT_ADMIN_PASSWORD=demo
      # - DEFAULT_ADMIN_NAME=Demo Demo
      # - DEFAULT_ADMIN_USERNAME=demo

      # - OIDC_ISSUER=
      # - OIDC_CLIENT_ID=
      # - OIDC_CLIENT_SECRET=
      # - OIDC_SCOPES=openid email profile
      # - OIDC_ADMIN_ROLES=admin
      # - OIDC_EMAIL_ATTRIBUTE=email
      # - OIDC_NAME_ATTRIBUTE=name
      # - OIDC_USERNAME_ATTRIBUTE=preferred_username
      # - OIDC_ROLES_ATTRIBUTE=groups
      # - OIDC_IGNORE_USERNAME=true
      # - OIDC_IGNORE_ROLES=true
      # - OIDC_ENFORCED=true
    depends_on:
      postgres:
        condition: service_healthy
    networks:
      - postgres-network

  postgres:
    image: postgres:14-alpine
    restart: on-failure
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=planka
      - POSTGRES_HOST_AUTH_METHOD=trust
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d planka"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - postgres-network

volumes:
  user-avatars:
  project-background-images:
  attachments:
  db-data:

networks:
  postgres-network:
    driver: bridge

Added networks to each service and at the bottom (note that docker-compose.yml is the default one without your settings).

@meltyshev commented on GitHub (Mar 20, 2024): Hmm, I have an idea to try to specify `networks` for each service, for example: ``` version: '3' services: planka: image: ghcr.io/plankanban/planka:latest restart: on-failure volumes: - user-avatars:/app/public/user-avatars - project-background-images:/app/public/project-background-images - attachments:/app/private/attachments ports: - 3000:1337 environment: - BASE_URL=http://localhost:3000 - DATABASE_URL=postgresql://postgres@postgres/planka - SECRET_KEY=notsecretkey # - TRUST_PROXY=0 # - TOKEN_EXPIRES_IN=365 # In days # related: https://github.com/knex/knex/issues/2354 # As knex does not pass query parameters from the connection string we # have to use environment variables in order to pass the desired values, e.g. # - PGSSLMODE=<value> # Configure knex to accept SSL certificates # - KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false # - DEFAULT_ADMIN_EMAIL=demo@demo.demo # Do not remove if you want to prevent this user from being edited/deleted # - DEFAULT_ADMIN_PASSWORD=demo # - DEFAULT_ADMIN_NAME=Demo Demo # - DEFAULT_ADMIN_USERNAME=demo # - OIDC_ISSUER= # - OIDC_CLIENT_ID= # - OIDC_CLIENT_SECRET= # - OIDC_SCOPES=openid email profile # - OIDC_ADMIN_ROLES=admin # - OIDC_EMAIL_ATTRIBUTE=email # - OIDC_NAME_ATTRIBUTE=name # - OIDC_USERNAME_ATTRIBUTE=preferred_username # - OIDC_ROLES_ATTRIBUTE=groups # - OIDC_IGNORE_USERNAME=true # - OIDC_IGNORE_ROLES=true # - OIDC_ENFORCED=true depends_on: postgres: condition: service_healthy networks: - postgres-network postgres: image: postgres:14-alpine restart: on-failure volumes: - db-data:/var/lib/postgresql/data environment: - POSTGRES_DB=planka - POSTGRES_HOST_AUTH_METHOD=trust healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d planka"] interval: 10s timeout: 5s retries: 5 networks: - postgres-network volumes: user-avatars: project-background-images: attachments: db-data: networks: postgres-network: driver: bridge ``` Added `networks` to each service and at the bottom (note that `docker-compose.yml` is the default one without your settings).
Author
Owner

@ky-bean commented on GitHub (Mar 21, 2024):

Unfortunately no apparent change, with and without setting the hostname for the postgres container:

postgres-1  | *****************************************************************
postgres-1  | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This
postgres-1  |          anyone with access to the Postgres port to access your d
postgres-1  |          a password, even if POSTGRES_PASSWORD is set. See Postgr
postgres-1  |          documentation about "trust":
postgres-1  |          https://www.postgresql.org/docs/current/auth-trust.html
postgres-1  |          In Docker's default configuration, this is effectively a
postgres-1  |          container on the same system.
postgres-1  |
postgres-1  |          It is not recommended to use POSTGRES_HOST_AUTH_METHOD=t
postgres-1  |          it with "-e POSTGRES_PASSWORD=password" instead to set a
postgres-1  |          "docker run".
postgres-1  | *****************************************************************
postgres-1  | The files belonging to this database system will be owned by user
postgres-1  | This user must also own the server process.
postgres-1  |
postgres-1  | The database cluster will be initialized with locale "en_US.utf8"
postgres-1  | The default database encoding has accordingly been set to "UTF8".
postgres-1  | The default text search configuration will be set to "english".
postgres-1  |
postgres-1  | Data page checksums are disabled.
postgres-1  |
postgres-1  | fixing permissions on existing directory /var/lib/postgresql/data
postgres-1  | creating subdirectories ... ok
postgres-1  | selecting dynamic shared memory implementation ... posix
postgres-1  | selecting default max_connections ... 100
postgres-1  | selecting default shared_buffers ... 128MB
postgres-1  | selecting default time zone ... UTC
postgres-1  | creating configuration files ... ok
postgres-1  | running bootstrap script ... ok
postgres-1  | sh: locale: not found
postgres-1  | 2024-03-20 22:00:07.895 UTC [31] WARNING:  no usable system local
postgres-1  | performing post-bootstrap initialization ... ok
postgres-1  | initdb: warning: enabling "trust" authentication for local connec
postgres-1  | You can change this by editing pg_hba.conf or using the option -A
postgres-1  | --auth-local and --auth-host, the next time you run initdb.
postgres-1  | syncing data to disk ... ok
postgres-1  |
postgres-1  |
postgres-1  | Success. You can now start the database server using:
postgres-1  |
postgres-1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres-1  |
postgres-1  | waiting for server to start....2024-03-20 22:00:17.006 UTC [37] L
postgres-1  | 2024-03-20 22:00:17.012 UTC [37] LOG:  listening on Unix socket "
postgres-1  | 2024-03-20 22:00:17.042 UTC [38] LOG:  database system was shut d
postgres-1  | 2024-03-20 22:00:17.058 UTC [37] LOG:  database system is ready t
postgres-1  |  done
postgres-1  | server started
postgres-1  | 2024-03-20 22:00:17.362 UTC [56] FATAL:  database "planka" does n
planka-1    | node:internal/process/promises:288
planka-1    |             triggerUncaughtException(err, true /* fromPromise */)
planka-1    |             ^
planka-1    |
planka-1    | Error: connect ECONNREFUSED 172.22.0.2:5432
planka-1    |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555
planka-1    |   errno: -111,
planka-1    |   code: 'ECONNREFUSED',
planka-1    |   syscall: 'connect',
planka-1    |   address: '172.22.0.2',
planka-1    |   port: 5432
planka-1    | }
planka-1    |
planka-1    | Node.js v18.19.1
planka-1 exited with code 0
postgres-1  | CREATE DATABASE
postgres-1  |
postgres-1  |
postgres-1  | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-
postgres-1  |
postgres-1  | waiting for server to shut down....2024-03-20 22:00:20.435 UTC [3
postgres-1  | 2024-03-20 22:00:20.441 UTC [37] LOG:  aborting any active transa
postgres-1  | 2024-03-20 22:00:20.444 UTC [37] LOG:  background worker "logical
postgres-1  | 2024-03-20 22:00:20.444 UTC [39] LOG:  shutting down
postgres-1  | 2024-03-20 22:00:20.505 UTC [37] LOG:  database system is shut do
planka-1    | node:internal/process/promises:288
planka-1    |             triggerUncaughtException(err, true /* fromPromise */)
planka-1    |             ^
planka-1    |
planka-1    | Error: connect ECONNREFUSED 172.22.0.2:5432
planka-1    |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555
planka-1    |   errno: -111,
planka-1    |   code: 'ECONNREFUSED',
planka-1    |   syscall: 'connect',
planka-1    |   address: '172.22.0.2',
planka-1    |   port: 5432
planka-1    | }
planka-1    |
planka-1    | Node.js v18.19.1
postgres-1  |  done
postgres-1  | server stopped
postgres-1  |
postgres-1  | PostgreSQL init process complete; ready for start up.
postgres-1  |
postgres-1  | 2024-03-20 22:00:20.581 UTC [1] LOG:  starting PostgreSQL 14.11 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
postgres-1  | 2024-03-20 22:00:20.581 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres-1  | 2024-03-20 22:00:20.581 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres-1  | 2024-03-20 22:00:20.597 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1  | 2024-03-20 22:00:20.618 UTC [59] LOG:  database system was shut down at 2024-03-20 22:00:20 UTC
postgres-1  | 2024-03-20 22:00:20.637 UTC [1] LOG:  database system is ready to accept connections
planka-1 exited with code 0
planka-1    | debug: It looks like your `sails.config.sockets.onlyAllowOrigins` array only includes
planka-1    | debug: references to the `localhost` origin.  This is completely valid, but be sure
planka-1    | debug: to add any other origins to this list that you'd like to accept socket
planka-1    | debug: connections from!
planka-1    | debug:
@ky-bean commented on GitHub (Mar 21, 2024): Unfortunately no apparent change, with and without setting the hostname for the postgres container: ``` postgres-1 | ***************************************************************** postgres-1 | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This postgres-1 | anyone with access to the Postgres port to access your d postgres-1 | a password, even if POSTGRES_PASSWORD is set. See Postgr postgres-1 | documentation about "trust": postgres-1 | https://www.postgresql.org/docs/current/auth-trust.html postgres-1 | In Docker's default configuration, this is effectively a postgres-1 | container on the same system. postgres-1 | postgres-1 | It is not recommended to use POSTGRES_HOST_AUTH_METHOD=t postgres-1 | it with "-e POSTGRES_PASSWORD=password" instead to set a postgres-1 | "docker run". postgres-1 | ***************************************************************** postgres-1 | The files belonging to this database system will be owned by user postgres-1 | This user must also own the server process. postgres-1 | postgres-1 | The database cluster will be initialized with locale "en_US.utf8" postgres-1 | The default database encoding has accordingly been set to "UTF8". postgres-1 | The default text search configuration will be set to "english". postgres-1 | postgres-1 | Data page checksums are disabled. postgres-1 | postgres-1 | fixing permissions on existing directory /var/lib/postgresql/data postgres-1 | creating subdirectories ... ok postgres-1 | selecting dynamic shared memory implementation ... posix postgres-1 | selecting default max_connections ... 100 postgres-1 | selecting default shared_buffers ... 128MB postgres-1 | selecting default time zone ... UTC postgres-1 | creating configuration files ... ok postgres-1 | running bootstrap script ... ok postgres-1 | sh: locale: not found postgres-1 | 2024-03-20 22:00:07.895 UTC [31] WARNING: no usable system local postgres-1 | performing post-bootstrap initialization ... ok postgres-1 | initdb: warning: enabling "trust" authentication for local connec postgres-1 | You can change this by editing pg_hba.conf or using the option -A postgres-1 | --auth-local and --auth-host, the next time you run initdb. postgres-1 | syncing data to disk ... ok postgres-1 | postgres-1 | postgres-1 | Success. You can now start the database server using: postgres-1 | postgres-1 | pg_ctl -D /var/lib/postgresql/data -l logfile start postgres-1 | postgres-1 | waiting for server to start....2024-03-20 22:00:17.006 UTC [37] L postgres-1 | 2024-03-20 22:00:17.012 UTC [37] LOG: listening on Unix socket " postgres-1 | 2024-03-20 22:00:17.042 UTC [38] LOG: database system was shut d postgres-1 | 2024-03-20 22:00:17.058 UTC [37] LOG: database system is ready t postgres-1 | done postgres-1 | server started postgres-1 | 2024-03-20 22:00:17.362 UTC [56] FATAL: database "planka" does n planka-1 | node:internal/process/promises:288 planka-1 | triggerUncaughtException(err, true /* fromPromise */) planka-1 | ^ planka-1 | planka-1 | Error: connect ECONNREFUSED 172.22.0.2:5432 planka-1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555 planka-1 | errno: -111, planka-1 | code: 'ECONNREFUSED', planka-1 | syscall: 'connect', planka-1 | address: '172.22.0.2', planka-1 | port: 5432 planka-1 | } planka-1 | planka-1 | Node.js v18.19.1 planka-1 exited with code 0 postgres-1 | CREATE DATABASE postgres-1 | postgres-1 | postgres-1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint- postgres-1 | postgres-1 | waiting for server to shut down....2024-03-20 22:00:20.435 UTC [3 postgres-1 | 2024-03-20 22:00:20.441 UTC [37] LOG: aborting any active transa postgres-1 | 2024-03-20 22:00:20.444 UTC [37] LOG: background worker "logical postgres-1 | 2024-03-20 22:00:20.444 UTC [39] LOG: shutting down postgres-1 | 2024-03-20 22:00:20.505 UTC [37] LOG: database system is shut do planka-1 | node:internal/process/promises:288 planka-1 | triggerUncaughtException(err, true /* fromPromise */) planka-1 | ^ planka-1 | planka-1 | Error: connect ECONNREFUSED 172.22.0.2:5432 planka-1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555 planka-1 | errno: -111, planka-1 | code: 'ECONNREFUSED', planka-1 | syscall: 'connect', planka-1 | address: '172.22.0.2', planka-1 | port: 5432 planka-1 | } planka-1 | planka-1 | Node.js v18.19.1 postgres-1 | done postgres-1 | server stopped postgres-1 | postgres-1 | PostgreSQL init process complete; ready for start up. postgres-1 | postgres-1 | 2024-03-20 22:00:20.581 UTC [1] LOG: starting PostgreSQL 14.11 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit postgres-1 | 2024-03-20 22:00:20.581 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres-1 | 2024-03-20 22:00:20.581 UTC [1] LOG: listening on IPv6 address "::", port 5432 postgres-1 | 2024-03-20 22:00:20.597 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres-1 | 2024-03-20 22:00:20.618 UTC [59] LOG: database system was shut down at 2024-03-20 22:00:20 UTC postgres-1 | 2024-03-20 22:00:20.637 UTC [1] LOG: database system is ready to accept connections planka-1 exited with code 0 planka-1 | debug: It looks like your `sails.config.sockets.onlyAllowOrigins` array only includes planka-1 | debug: references to the `localhost` origin. This is completely valid, but be sure planka-1 | debug: to add any other origins to this list that you'd like to accept socket planka-1 | debug: connections from! planka-1 | debug: ```
Author
Owner

@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:

postgres-1  |
postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres-1  |
postgres-1  | 2024-03-20 22:05:51.563 UTC [1] LOG:  starting PostgreSQL 14.11 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
postgres-1  | 2024-03-20 22:05:51.564 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres-1  | 2024-03-20 22:05:51.564 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres-1  | 2024-03-20 22:05:51.580 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1  | 2024-03-20 22:05:51.613 UTC [22] LOG:  database system was shut down at 2024-03-20 22:01:46 UTC
postgres-1  | 2024-03-20 22:05:51.636 UTC [1] LOG:  database system is ready to accept connections
postgres-1  | 2024-03-20 22:06:03.026 UTC [42] ERROR:  conflicting key value violates exclusion constraint "user_email_unique"
postgres-1  | 2024-03-20 22:06:03.026 UTC [42] DETAIL:  Key (email)=(demo@demo.demo) conflicts with existing key (email)=(demo@demo.demo).
postgres-1  | 2024-03-20 22:06:03.026 UTC [42] STATEMENT:  insert into "user_account" ("created_at", "email", "is_admin", "is_sso", "name", "password", "subscribe_to_own_cards", "username") values ($1, $2, $3, $4, $5, $6, $7, $8)
planka-1    | debug: It looks like your `sails.config.sockets.onlyAllowOrigins` array only includes
planka-1    | debug: references to the `localhost` origin.  This is completely valid, but be sure
planka-1    | debug: to add any other origins to this list that you'd like to accept socket
planka-1    | debug: connections from!
planka-1    | debug:

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:

Loading failed for the <script> with source “http://localhost:3000/static/js/main.813ae932.js”. <my server's lan ip>:3000:1:533
@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: ``` postgres-1 | postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization postgres-1 | postgres-1 | 2024-03-20 22:05:51.563 UTC [1] LOG: starting PostgreSQL 14.11 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit postgres-1 | 2024-03-20 22:05:51.564 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres-1 | 2024-03-20 22:05:51.564 UTC [1] LOG: listening on IPv6 address "::", port 5432 postgres-1 | 2024-03-20 22:05:51.580 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres-1 | 2024-03-20 22:05:51.613 UTC [22] LOG: database system was shut down at 2024-03-20 22:01:46 UTC postgres-1 | 2024-03-20 22:05:51.636 UTC [1] LOG: database system is ready to accept connections postgres-1 | 2024-03-20 22:06:03.026 UTC [42] ERROR: conflicting key value violates exclusion constraint "user_email_unique" postgres-1 | 2024-03-20 22:06:03.026 UTC [42] DETAIL: Key (email)=(demo@demo.demo) conflicts with existing key (email)=(demo@demo.demo). postgres-1 | 2024-03-20 22:06:03.026 UTC [42] STATEMENT: insert into "user_account" ("created_at", "email", "is_admin", "is_sso", "name", "password", "subscribe_to_own_cards", "username") values ($1, $2, $3, $4, $5, $6, $7, $8) planka-1 | debug: It looks like your `sails.config.sockets.onlyAllowOrigins` array only includes planka-1 | debug: references to the `localhost` origin. This is completely valid, but be sure planka-1 | debug: to add any other origins to this list that you'd like to accept socket planka-1 | debug: connections from! planka-1 | debug: ``` 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: ``` Loading failed for the <script> with source “http://localhost:3000/static/js/main.813ae932.js”. <my server's lan ip>:3000:1:533 ```
Author
Owner

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

well now I truly don't know what the real issue I'm seeing is. Not really sure what I can provide to help narrow this down, but here's a screenshot of the network tab in the browser inspector: image

I'm trying to figure out...

@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. > well now I truly don't know what the real issue I'm seeing is. Not really sure what I can provide to help narrow this down, but here's a screenshot of the network tab in the browser inspector: ![image](https://private-user-images.githubusercontent.com/153677733/314693614-e13c396e-a49d-4424-8827-6dcfb708744d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTA5NzMxMDQsIm5iZiI6MTcxMDk3MjgwNCwicGF0aCI6Ii8xNTM2Nzc3MzMvMzE0NjkzNjE0LWUxM2MzOTZlLWE0OWQtNDQyNC04ODI3LTZkY2ZiNzA4NzQ0ZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMzIwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDMyMFQyMjEzMjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zZjU5ZTUzZWJlNzdjNTZhM2U1ZTIzNDI2ZmFhNmQ2NWEzZGI0MjY0ZGFjNDkyZTU2MDgxY2E5ZGM5ZTk3NDk2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.NEJDNrYMlzvbplWsDAWEL4Oixyr0PzLGa868Q7vuuME) I'm trying to figure out...
Author
Owner

@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_URL in docker-compose.yml is http://192.168.5.69:3000?

@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_URL` in `docker-compose.yml` is http://192.168.5.69:3000?
Author
Owner

@ky-bean commented on GitHub (Mar 21, 2024):

I have goofed somewhere along the line. The BASE_URL got reset to localhost so 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 have goofed somewhere along the line. The `BASE_URL` got reset to `localhost` so 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
Author
Owner

@ky-bean commented on GitHub (Mar 21, 2024):

I didn't make it clear above, but fixing BASE_URL let me connect to the server login page.

@ky-bean commented on GitHub (Mar 21, 2024): I didn't make it clear above, but fixing `BASE_URL` let me connect to the server login page.
Author
Owner

@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 triggerUncaughtException message on ECONNREFUSED followed by planka-1 exited with code 0 and naively assumed that the container had failed to start becuase that it couldn't connect to the database, so I messed with the DATABASE_URL which triggered the KnexTimeoutError. At some point in messing with the docker-compose file I reset the BASE_URL to the default localhost address 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 ECONNREFUSED errors on the first container startup can be safely ignored.

@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 `triggerUncaughtException` message on `ECONNREFUSED` followed by `planka-1 exited with code 0` and naively assumed that the container had failed to start becuase that it couldn't connect to the database, so I messed with the `DATABASE_URL` which triggered the `KnexTimeoutError`. At some point in messing with the docker-compose file I reset the `BASE_URL` to the default `localhost` address 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 `ECONNREFUSED` errors on the first container startup can be safely ignored.
Author
Owner

@meltyshev commented on GitHub (Mar 21, 2024):

Sorry for wasting your time, thank you for lending your help even though it was for nothing.

No worries at all :)

Maybe it'd be worth adding a note to the install docs for docker that the ECONNREFUSED errors on the first container startup can be safely ignored.

That's a nice suggestion, thanks!

@meltyshev commented on GitHub (Mar 21, 2024): > Sorry for wasting your time, thank you for lending your help even though it was for nothing. No worries at all :) > Maybe it'd be worth adding a note to the install docs for docker that the ECONNREFUSED errors on the first container startup can be safely ignored. That's a nice suggestion, thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#441