Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Support Installation & Updates
  1. OpenProject
  2. Forums
  3. Support Installation & Updates
  4. Docker-Compose behind NGINX Reverse Proxy (Docker Version)

Docker-Compose behind NGINX Reverse Proxy (Docker Version)

Added by Office netMedia about 2 years ago

Hi Folks,

it is kind of funny there is another Thread with the same name https://community.openproject.org/topics/16586 but still the problem is different i guess.

I have a NGINX Reverse Proxy running via Docker and already have many services on this reverse proxy (nextcloud, gitea, etc).

Now i want to add openproject as well. I adjusted the docker-compose.yml file

networks:
  ...
  nginx_proxy:
    external: true
    
...

services:
...
[removed proxy service]
...

  web:
    <<: *app
    command: "./docker/prod/web"
    networks:
      - frontend
      - backend
      - nginx_proxy #new
    # new
    environment:
      - TZ=${TIMEZONE}
      - VIRTUAL_HOST=${DOMAIN}
      - VIRTUAL_PORT=8080
      - LETSENCRYPT_HOST=${DOMAIN}
      - LETSENCRYPT_EMAIL=${MY_LETSENCRYPT_EMAIL}
    depends_on:
      - db
      - cache
      - seeder
    labels:
      - autoheal=true

The problem is the web service cannot connect to the database:

compose-web-1       | => Booting Puma
compose-web-1       | => Rails 7.0.4.2 application starting in production 
compose-web-1       | => Run `bin/rails server --help` for more startup options
compose-web-1       | Exiting
compose-web-1       | /app/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:87:in `rescue in new_client': connection to server at "127.0.0.1", port 5432 failed: Connection refused (ActiveRecord::ConnectionNotEstablished)
compose-web-1       | 	Is the server running on that host and accepting TCP/IP connections?

2 things i dont get:

  • why the web service need access to the db anyway? this should be handeld by the app service right?
  • and the other thing: the db is available at db and not 127.0.0.1 right? how do i change it?

here is my .env file:

TAG=12
HTTPS=true
OPENPROJECT_HOST__NAME=project.example.com
DOMAIN=project.example.com
TIMEZONE=Europe/Vienna
MY_LETSENCRYPT_EMAIL=office@example.com
#PORT=127.0.0.1:8080
PORT=8080
OPENPROJECT_RAILS__RELATIVE__URL__ROOT=
IMAP_ENABLED=false
DATABASE_URL="postgres://postgres:myPassword@db/openproject?pool=20&encoding=unicode&reconnect=true"
POSTGRES_PASSWORD=myPassword
RAILS_MIN_THREADS=4
RAILS_MAX_THREADS=16
#PGDATA="/var/lib/postgresql/data"
#OPDATA="/var/openproject/assets"

(offtopic: i need to use the markdown source editor because the WYSIWYG Editor does not respond to backspace and blocks randomly..)


Replies (1)

RE: Docker-Compose behind NGINX Reverse Proxy (Docker Version) - Added by Office netMedia about 2 years ago

it works now.

if you set any environment variables for web service you need to also pass the database_url environment variable!

service:
  ...
  web:
  ...
    environment:
    #  - TZ=${TIMEZONE}
      - DATABASE_URL=${DATABASE_URL}
      - VIRTUAL_HOST=${DOMAIN}
      - VIRTUAL_PORT=8080
      - LETSENCRYPT_HOST=${DOMAIN}
      - LETSENCRYPT_EMAIL=${MY_LETSENCRYPT_EMAIL}
  ...
  • (1 - 1/1)
Loading...