Cannot get the connection to work #300

Closed
opened 2026-02-04 18:27:03 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @StefanArts on GitHub (Mar 27, 2023).

Hi there,
since Watchtower updated planka to the newest version automatically, I am not able to get a connection to the database, I just get a connection refused error. I checked if the problem could be with docker, but I am pretty sure everything works on that part, as it was working before the update.

version: '3'

services:
  app:
    image: ghcr.io/plankanban/planka:latest
    container_name: planka-app
    restart: unless-stopped
    depends_on:
      - postgres
    networks:
      - proxy
      - net
    volumes:
      - user-avatars:/app/public/user-avatars
      - project-background-images:/app/public/project-background-images
      - attachments:/app/private/attachments
    environment:
      - BASE_URL=https://planka.example.com
      - TRUST_PROXY=1
      - DATABASE_URL="postgresql://postgres@postgres/planka"
      - SECRET_KEY=redacted
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.planka-app.entrypoints=http"
      - "traefik.http.routers.planka-app.rule=Host(`planka.example.com`)"
      - "traefik.http.middlewares.planka-app-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.planka-app.middlewares=planka-app-https-redirect"
      - "traefik.http.routers.planka-app-secure.entrypoints=https"
      - "traefik.http.routers.planka-app-secure.rule=Host(`planka.example.com`)"
      - "traefik.http.routers.planka-app-secure.tls=true"
      - "traefik.http.routers.planka-app-secure.tls.certresolver=http"
      - "traefik.http.routers.planka-app-secure.service=planka-app"
      - "traefik.http.services.planka-app.loadbalancer.server.port=1337"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.planka-app-secure.middlewares=secHeaders@file"
    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)"

  postgres:
    image: postgres:14-alpine
    container_name: planka-postgres
    restart: unless-stopped
    networks:
      - net
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=planka
      - POSTGRES_HOST_AUTH_METHOD=trust

networks:
  proxy:
    external: true
  net:
    driver: bridge

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

My error log:

planka-postgres | 
planka-postgres | PostgreSQL Database directory appears to contain a database; Skipping initialization
planka-postgres | 
planka-postgres | 2023-03-27 07:53:08.657 UTC [1] LOG:  starting PostgreSQL 14.7 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924, 64-bit
planka-postgres | 2023-03-27 07:53:08.657 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
planka-postgres | 2023-03-27 07:53:08.657 UTC [1] LOG:  listening on IPv6 address "::", port 5432
planka-postgres | 2023-03-27 07:53:08.658 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
planka-postgres | 2023-03-27 07:53:08.660 UTC [22] LOG:  database system was shut down at 2023-03-27 07:46:28 UTC
planka-postgres | 2023-03-27 07:53:08.663 UTC [1] LOG:  database system is ready to accept connections
planka-app  | node:internal/process/promises:288
planka-app  |             triggerUncaughtException(err, true /* fromPromise */);
planka-app  |             ^
planka-app  | 
planka-app  | Error: connect ECONNREFUSED 127.0.0.1:5432
planka-app  |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16) {
planka-app  |   errno: -111,
planka-app  |   code: 'ECONNREFUSED',
planka-app  |   syscall: 'connect',
planka-app  |   address: '127.0.0.1',
planka-app  |   port: 5432
planka-app  | }
planka-app  | 
planka-app  | Node.js v18.12.1
planka-app  | Tried 1 times. Waiting 5 seconds...
Originally created by @StefanArts on GitHub (Mar 27, 2023). Hi there, since Watchtower updated planka to the newest version automatically, I am not able to get a connection to the database, I just get a connection refused error. I checked if the problem could be with docker, but I am pretty sure everything works on that part, as it was working before the update. ```yaml version: '3' services: app: image: ghcr.io/plankanban/planka:latest container_name: planka-app restart: unless-stopped depends_on: - postgres networks: - proxy - net volumes: - user-avatars:/app/public/user-avatars - project-background-images:/app/public/project-background-images - attachments:/app/private/attachments environment: - BASE_URL=https://planka.example.com - TRUST_PROXY=1 - DATABASE_URL="postgresql://postgres@postgres/planka" - SECRET_KEY=redacted labels: - "traefik.enable=true" - "traefik.http.routers.planka-app.entrypoints=http" - "traefik.http.routers.planka-app.rule=Host(`planka.example.com`)" - "traefik.http.middlewares.planka-app-https-redirect.redirectscheme.scheme=https" - "traefik.http.routers.planka-app.middlewares=planka-app-https-redirect" - "traefik.http.routers.planka-app-secure.entrypoints=https" - "traefik.http.routers.planka-app-secure.rule=Host(`planka.example.com`)" - "traefik.http.routers.planka-app-secure.tls=true" - "traefik.http.routers.planka-app-secure.tls.certresolver=http" - "traefik.http.routers.planka-app-secure.service=planka-app" - "traefik.http.services.planka-app.loadbalancer.server.port=1337" - "traefik.docker.network=proxy" - "traefik.http.routers.planka-app-secure.middlewares=secHeaders@file" 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)" postgres: image: postgres:14-alpine container_name: planka-postgres restart: unless-stopped networks: - net volumes: - db-data:/var/lib/postgresql/data environment: - POSTGRES_DB=planka - POSTGRES_HOST_AUTH_METHOD=trust networks: proxy: external: true net: driver: bridge volumes: user-avatars: project-background-images: attachments: db-data: ``` My error log: ``` planka-postgres | planka-postgres | PostgreSQL Database directory appears to contain a database; Skipping initialization planka-postgres | planka-postgres | 2023-03-27 07:53:08.657 UTC [1] LOG: starting PostgreSQL 14.7 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924, 64-bit planka-postgres | 2023-03-27 07:53:08.657 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 planka-postgres | 2023-03-27 07:53:08.657 UTC [1] LOG: listening on IPv6 address "::", port 5432 planka-postgres | 2023-03-27 07:53:08.658 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" planka-postgres | 2023-03-27 07:53:08.660 UTC [22] LOG: database system was shut down at 2023-03-27 07:46:28 UTC planka-postgres | 2023-03-27 07:53:08.663 UTC [1] LOG: database system is ready to accept connections planka-app | node:internal/process/promises:288 planka-app | triggerUncaughtException(err, true /* fromPromise */); planka-app | ^ planka-app | planka-app | Error: connect ECONNREFUSED 127.0.0.1:5432 planka-app | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16) { planka-app | errno: -111, planka-app | code: 'ECONNREFUSED', planka-app | syscall: 'connect', planka-app | address: '127.0.0.1', planka-app | port: 5432 planka-app | } planka-app | planka-app | Node.js v18.12.1 planka-app | Tried 1 times. Waiting 5 seconds... ```
Author
Owner

@meltyshev commented on GitHub (Apr 3, 2023):

Hi! Sorry for the late reply. It's very difficult to say why this error occurs. From what version was the update and what is the current version?

@meltyshev commented on GitHub (Apr 3, 2023): Hi! Sorry for the late reply. It's very difficult to say why this error occurs. From what version was the update and what is the current version?
Author
Owner

@StefanArts commented on GitHub (Apr 10, 2023):

Hi, I am actually not sure, but I've set the docker tag to latest. For some reason planka wants to connect to 127.0.0.1 and ignores my connection String.

@StefanArts commented on GitHub (Apr 10, 2023): Hi, I am actually not sure, but I've set the docker tag to latest. For some reason planka wants to connect to 127.0.0.1 and ignores my connection String.
Author
Owner

@GauthierCrp commented on GitHub (Apr 12, 2023):

Hello,

Same Issue here,

Somoene can help ?

Thanks a lot,
Best Regards

@GauthierCrp commented on GitHub (Apr 12, 2023): Hello, Same Issue here, Somoene can help ? Thanks a lot, Best Regards
Author
Owner

@meltyshev commented on GitHub (May 1, 2023):

I think I figured it out, checked and got the same error. It seems to be because of the double quotes in DATABASE_URL="postgresql://postgres@postgres/planka". Just remove them DATABASE_URL=postgresql://postgres@postgres/planka and should work.

@meltyshev commented on GitHub (May 1, 2023): I think I figured it out, checked and got the same error. It seems to be because of the double quotes in `DATABASE_URL="postgresql://postgres@postgres/planka"`. Just remove them `DATABASE_URL=postgresql://postgres@postgres/planka` and should work.
Author
Owner

@StefanArts commented on GitHub (May 1, 2023):

Yeah, seems to be working again.
Thanks!

@StefanArts commented on GitHub (May 1, 2023): Yeah, seems to be working again. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#300