openproject-deploy icon indicating copy to clipboard operation
openproject-deploy copied to clipboard

At the first start up it fails at connecting with the db

Open JTzLinux opened this issue 8 months ago • 0 comments

Hello everyone,

I recently tried to use openproject community I followed to guide but it keeps saying it is unable to connect to the DB and I didnt change much this is my docker-compose.yml:

networks:
  frontend:
  backend:
  proxy:
    external: true

volumes:
  pgdata:
  opdata:
  assets:

x-op-restart-policy: &restart_policy
  restart: unless-stopped
x-op-image: &image
  image: openproject/openproject:14
x-op-app: &app
  <<: [*image, *restart_policy]
  environment:
    OPENPROJECT_HTTPS: "${OPENPROJECT_HTTPS:-true}"
    OPENPROJECT_HOST__NAME: "${OPENPROJECT_HOST__NAME:-localhost:8080}"
    OPENPROJECT_HSTS: "${OPENPROJECT_HSTS:-true}"
    RAILS_CACHE_STORE: "memcache"
    OPENPROJECT_CACHE__MEMCACHE__SERVER: "cache:11211"
    OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}"
    DATABASE_URL: "${DATABASE_URL:-postgres://postgres:p4ssw0rd@db/openproject?pool=20&encoding=unicode&reconnect=true}"
    RAILS_MIN_THREADS: ${RAILS_MIN_THREADS:-4}
    RAILS_MAX_THREADS: ${RAILS_MAX_THREADS:-16}
    # set to true to enable the email receiving feature. See ./docker/cron for more options
    IMAP_ENABLED: "${IMAP_ENABLED:-false}"

services:
  db:
    image: postgres:13
    <<: *restart_policy
    stop_grace_period: "3s"
    volumes:
      - "${PGDATA:-pgdata}:/var/lib/postgresql/data"
    environment:
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-p4ssw0rd}
      POSTGRES_DB: openproject
    networks:
      - backend

  cache:
    image: memcached
    <<: *restart_policy
    networks:
      - backend

  proxy:
    image: caddy:2
    <<: *restart_policy
    command: "/usr/local/bin/proxy-entrypoint.sh"
    #ports:
    #  - "${PORT:-8080}:80"
    environment:
      APP_HOST: web
    depends_on:
      - web
    networks:
      - frontend
      - proxy
    volumes:
      - ./Caddyfile.template:/etc/caddy/Caddyfile.template:ro
      - ./proxy-entrypoint.sh:/usr/local/bin/proxy-entrypoint.sh:ro
      - assets:/public:ro
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.project.entrypoints=https"
      - "traefik.http.routers.project.rule=(Host(`project.MYDOMAINHERE`))"
      - "traefik.http.routers.project.tls=true"
      - "traefik.http.routers.project.tls.certresolver=http"
      - "traefik.http.routers.project.service=project"
      - "traefik.http.services.project.loadbalancer.server.port=8080"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.project.middlewares=default@file"

  web:
    <<: *app
    command: "./docker/prod/web"
    networks:
      - frontend
      - backend
    depends_on:
      - db
      - cache
      - seeder
    labels:
      - autoheal=true
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}/health_checks/default"]
      interval: 10s
      timeout: 3s
      retries: 3
      start_period: 30s
    volumes:
      - "${OPDATA:-opdata}:/var/openproject/assets"
      - assets:/app/public

  autoheal:
    image: willfarrell/autoheal:1.2.0
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    environment:
      AUTOHEAL_CONTAINER_LABEL: autoheal
      AUTOHEAL_START_PERIOD: 600
      AUTOHEAL_INTERVAL: 30

  worker:
    <<: *app
    command: "./docker/prod/worker"
    networks:
      - backend
    depends_on:
      - db
      - cache
      - seeder
    volumes:
      - "${OPDATA:-opdata}:/var/openproject/assets"

  cron:
    <<: *app
    command: "./docker/prod/cron"
    networks:
      - backend
    depends_on:
      - db
      - cache
      - seeder
    volumes:
      - "${OPDATA:-opdata}:/var/openproject/assets"

  seeder:
    <<: *app
    command: "./docker/prod/seeder"
    restart: on-failure
    networks:
      - backend
    volumes:
      - "${OPDATA:-opdata}:/var/openproject/assets"

The ERROR I keep on getting:

/app/vendor/bundle/ruby/3.3.0/gems/pg-1.5.6/lib/pg/connection.rb:701:in `async_connect_or_reset': connection to server at "192.168.160.2", port 5432 failed: FATAL:  password authentication failed for user "postgres" (PG::ConnectionBad)

Thanks for all the help in advance!

JTzLinux avatar Jun 29 '24 18:06 JTzLinux