Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JTzLinux opened this issue Jun 29, 2024 · 4 comments
Open

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

JTzLinux opened this issue Jun 29, 2024 · 4 comments

Comments

@JTzLinux
Copy link

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!

@miuuu1
Copy link

miuuu1 commented Nov 4, 2024

facing similar issue here. Any clue?

@JTzLinux
Copy link
Author

JTzLinux commented Nov 8, 2024

facing similar issue here. Any clue?

No sadly not still waiting for any help x)

@miuuu1
Copy link

miuuu1 commented Nov 9, 2024

Thanks for your response.

I actually managed to get it to work after experimenting and following the guidance in the currently still open Pull Request:

#99

After getting the error I ran:

sudo mkdir -p /var/openproject/assets
sudo chown 1000:1000 -R /var/openproject/assets

Then I did
docker compose down
docker compose up -d

and let it run for a while. Initially the error popped up again, but I think that was whilst the seeder was still setting things up.

Once the seeder automatically exited, web process was finally running OK and I could access openproject on the subdomain I set up via traefik.

Maybe this helps...

@JTzLinux
Copy link
Author

JTzLinux commented Nov 9, 2024

Thanks for your response.

I actually managed to get it to work after experimenting and following the guidance in the currently still open Pull Request:

#99

After getting the error I ran:

sudo mkdir -p /var/openproject/assets sudo chown 1000:1000 -R /var/openproject/assets

Then I did docker compose down docker compose up -d

and let it run for a while. Initially the error popped up again, but I think that was whilst the seeder was still setting things up.

Once the seeder automatically exited, web process was finally running OK and I could access openproject on the subdomain I set up via traefik.

Maybe this helps...

huh ok thanks need to try it out... Thanks! I will try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants