From 5b4b7b5ba324a26f81aae100be1cef587d84bdbf Mon Sep 17 00:00:00 2001 From: Atheesh Thirumalairajan <47198395+candiedoperation@users.noreply.github.com> Date: Wed, 29 Jun 2022 09:17:23 +0530 Subject: [PATCH 01/11] Compatibility with Portainer (Widely used Docker Control Panel) While deploying stacks (`docker-compose`) using Portainer, the web interface does not allow the `.yml` file to have two `<<` tags in the same level. Therefore replacing two of them as one in brackets solves the issue. This configuration works both with the Portainer web interface and the docker-compose cli without any problems. Know more about Portainer at https://www.portainer.io/ --- compose/docker-compose.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index 476db07..1dacb73 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -13,8 +13,7 @@ x-op-restart-policy: &restart_policy x-op-image: &image image: openproject/community:${TAG:-12} x-op-app: &app - <<: *image - <<: *restart_policy + <<: [*image, *restart_policy] environment: RAILS_CACHE_STORE: "memcache" OPENPROJECT_CACHE__MEMCACHE__SERVER: "cache:11211" @@ -47,8 +46,7 @@ services: - backend proxy: - <<: *image - <<: *restart_policy + <<: [*image, *restart_policy] command: "./docker/prod/proxy" ports: - "${PORT:-8080}:80" From d7c08b070bf26a00a532336e07a521467146ef12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 5 Jul 2022 21:18:29 +0200 Subject: [PATCH 02/11] Update README.md --- compose/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compose/README.md b/compose/README.md index 5989931..3da1eef 100644 --- a/compose/README.md +++ b/compose/README.md @@ -65,3 +65,7 @@ You can look at the logs with: docker-compose logs -n 1000 For the complete documentation, please refer to https://docs.openproject.org/installation-and-operations/. + +### Network issues + +If you're running into weird network issues and timeouts such as the one described in [OP#42802](https://community.openproject.org/work_packages/42802), you might have success in remove the two separate frontend and backend networks. This might be connected to using podman for orchestration, although we haven't been able to confirm this. From c793b35a613e96c01e5ef931c396ed6a35e87f14 Mon Sep 17 00:00:00 2001 From: Markus Kahl Date: Thu, 29 Sep 2022 10:21:49 +0200 Subject: [PATCH 03/11] make HTTPS option discoverable and overridable --- compose/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index 1dacb73..6c86cdf 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -15,6 +15,7 @@ x-op-image: &image x-op-app: &app <<: [*image, *restart_policy] environment: + OPENPROJECT_HTTPS: "${OPENPROJECT_HTTPS:-true}" RAILS_CACHE_STORE: "memcache" OPENPROJECT_CACHE__MEMCACHE__SERVER: "cache:11211" OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}" From 547e527b726ecb1ce466003f624f29865d0bcc4d Mon Sep 17 00:00:00 2001 From: Markus Kahl Date: Thu, 29 Sep 2022 10:51:50 +0200 Subject: [PATCH 04/11] amend local docs for https and port binding --- compose/README.md | 56 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/compose/README.md b/compose/README.md index 3da1eef..01a734a 100644 --- a/compose/README.md +++ b/compose/README.md @@ -20,19 +20,63 @@ Launch the containers: After a while, OpenProject should be up and running on . +**HTTPS/SSL** + +By default OpenProject starts with the HTTPS option **enabled**, but it **does not** handle SSL termination itself. +This is usually done separately via a [reverse proxy setup](https://www.openproject.org/docs/installation-and-operations/installation/docker/#apache-reverse-proxy-setup). +Without this you will run into an `ERR_SSL_PROTOCOL_ERROR` when accessing OpenProject. + +See below how to disable HTTPS. + +**PORT** + +By default the port is bound to `0.0.0.0` means access to OpenProject will be public. +See below how to change that. + ## Configuration +Environment variables can be added to `docker-compose.yml` under `x-op-app -> environment` to change +OpenProject's configuration. Some are already defined and can be changed via the environment. + +You can pass those variables directly when starting the stack as follows. + +``` +VARIABLE=value docker-compose up -d +``` + +You can also put those variables into an `.env` file in your current working +directory, and Docker Compose will pick it up automatically. See `.env.example` +for details. + +## HTTPS + +You can disable OpenProject's HTTPS option via: + +``` +OPENPROJECT_HTTPS=false +``` + +## PORT + If you want to specify a different port, you can do so with: - PORT=4000 docker-compose up -d +``` +PORT=4000 +``` + +If you don't want OpenProject to bind to `0.0.0.0` you can bind it to localhost only like this: + +``` +PORT=127.0.0.1:8080 +``` + +## TAG If you want to specify a custom tag for the OpenProject docker image, you can do so with: - TAG=my-docker-tag docker-compose up -d - -You can also set those variables into an `.env` file in your current working -directory, and Docker Compose will pick it up automatically. See `.env.example` -for details. +``` +TAG=my-docker-tag +``` ## Upgrade From 961926294a1c3121807db74514fd66921da0eff0 Mon Sep 17 00:00:00 2001 From: Markus Kahl Date: Thu, 29 Sep 2022 11:25:51 +0200 Subject: [PATCH 05/11] allow setting common options and show in example --- compose/.env.example | 17 ++++++++++++++++- compose/docker-compose.yml | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/compose/.env.example b/compose/.env.example index 25241b7..6942e7b 100644 --- a/compose/.env.example +++ b/compose/.env.example @@ -1 +1,16 @@ -PORT=8080 +## +# All environment variables defined here will only apply if you pass them +# to the OpenProject container in docker-compose.yml under x-op-app -> environment. +# For the examples here this is already the case. +# +# Please refer to our documentation to see all possible variables: +# https://www.openproject.org/docs/installation-and-operations/configuration/environment/ +# +HTTPS=false +OPENPROJECT_HOST__NAME=localhost +PORT=127.0.0.1:8080 +OPENPROJECT_RAILS__RELATIVE__URL__ROOT= +IMAP_ENABLED=false +DATABASE_URL=postgres://postgres:p4ssw0rd@db/openproject?pool=20&encoding=unicode&reconnect=true +RAILS_MIN_THREADS=4 +RAILS_MAX_THREADS=16 diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index 6c86cdf..307c7af 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -20,8 +20,8 @@ x-op-app: &app 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: 4 - RAILS_MAX_THREADS: 16 + 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}" volumes: From 50f5ed0b1c7a980aeb716a5d04ea0a63d56a7540 Mon Sep 17 00:00:00 2001 From: Shirshak Date: Wed, 30 Mar 2022 14:51:00 +0545 Subject: [PATCH 06/11] Add environment variable Instead of forcing the user to search available environment variables inside the docker config, it is appropriate to add a commented version of the key-value pairs. --- compose/.env.example | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compose/.env.example b/compose/.env.example index 6942e7b..7574d10 100644 --- a/compose/.env.example +++ b/compose/.env.example @@ -6,6 +6,7 @@ # Please refer to our documentation to see all possible variables: # https://www.openproject.org/docs/installation-and-operations/configuration/environment/ # +TAG=12 HTTPS=false OPENPROJECT_HOST__NAME=localhost PORT=127.0.0.1:8080 @@ -14,3 +15,5 @@ IMAP_ENABLED=false DATABASE_URL=postgres://postgres:p4ssw0rd@db/openproject?pool=20&encoding=unicode&reconnect=true RAILS_MIN_THREADS=4 RAILS_MAX_THREADS=16 +PGDATA="/var/lib/postgresql/data" +OPDATA="/var/openproject/assets" From ba8caec69df845c9bdd2ffda366e920dbf996728 Mon Sep 17 00:00:00 2001 From: dev-clavis Date: Wed, 28 Sep 2022 21:26:18 +0200 Subject: [PATCH 07/11] Allow non ssl connections Adding these env vars to the docker-compose.yml OPENPROJECT_HTTPS, OPENPROJECT_HOST__NAME, OPENPROJECT_HSTS --- compose/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index 307c7af..fb806c8 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -16,6 +16,8 @@ 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:-}" From 1c0351604a0cf1d06280dbad6819f0b800d0b0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 18 Oct 2022 20:19:27 +0200 Subject: [PATCH 08/11] Update README.md --- compose/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compose/README.md b/compose/README.md index 01a734a..399842b 100644 --- a/compose/README.md +++ b/compose/README.md @@ -113,3 +113,14 @@ For the complete documentation, please refer to https://docs.openproject.org/ins ### Network issues If you're running into weird network issues and timeouts such as the one described in [OP#42802](https://community.openproject.org/work_packages/42802), you might have success in remove the two separate frontend and backend networks. This might be connected to using podman for orchestration, although we haven't been able to confirm this. + + +### SMTP setup fails: Network is unreachable. + +Make sure your container has DNS resolution to access external SMTP server when set up as described in [OP#44515](https://community.openproject.org/work_packages/44515). + +```yml +worker: + dns: + - "Your DNS IP" # OR add a public DNS resolver like 8.8.8.8 + ``` From dd17ff1bb8c9076160fcf88ea01795f2d6e2c9f1 Mon Sep 17 00:00:00 2001 From: Markus Kahl Date: Wed, 5 Apr 2023 14:19:46 +0200 Subject: [PATCH 09/11] amend missing prefix in https env var --- compose/.env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/.env.example b/compose/.env.example index 7574d10..b43748f 100644 --- a/compose/.env.example +++ b/compose/.env.example @@ -7,7 +7,7 @@ # https://www.openproject.org/docs/installation-and-operations/configuration/environment/ # TAG=12 -HTTPS=false +OPENPROJECT_HTTPS=false OPENPROJECT_HOST__NAME=localhost PORT=127.0.0.1:8080 OPENPROJECT_RAILS__RELATIVE__URL__ROOT= From 78435e0b29bbd8d05b72558212ebd94d460e2471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 11 May 2023 11:38:58 +0200 Subject: [PATCH 10/11] Engage autoheal after 10mins and reduce interval to 30s (#52) Fixes restarting seeder containers when the runtime exceeds 30s. Fixes #50 --- compose/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index fb806c8..4453833 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -86,6 +86,8 @@ services: - "/var/run/docker.sock:/var/run/docker.sock" environment: AUTOHEAL_CONTAINER_LABEL: autoheal + AUTOHEAL_START_PERIOD: 600 + AUTOHEAL_INTERVAL: 30 worker: <<: *app From 3103a2ccbfd68a83dc1a4e664c4410b2fb3f04a6 Mon Sep 17 00:00:00 2001 From: Yule Date: Thu, 11 May 2023 13:03:16 +0000 Subject: [PATCH 11/11] Highlight usage of .env file for compose stack (#53) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Bädorf --- compose/.gitignore | 1 + compose/README.md | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 compose/.gitignore diff --git a/compose/.gitignore b/compose/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/compose/.gitignore @@ -0,0 +1 @@ +.env diff --git a/compose/README.md b/compose/README.md index 399842b..8425430 100644 --- a/compose/README.md +++ b/compose/README.md @@ -14,6 +14,11 @@ Make sure you are using the latest version of the Docker images: docker-compose pull +Copy the example `.env` file and edit any values you want to change: + + cp .env.example .env + vim .env + Launch the containers: docker-compose up -d