[#53464] replaced containered proxy with caddy (#70)

* [#53464] replaced containered proxy with caddy

- running compose stack work with slim container now
- using caddy as a light weight proxy
- tested with and without OPENPROJECT_RAILS__RELATIVE__URL__ROOT

* rename doc root to avoid confusion, use slim as default container

---------

Co-authored-by: Markus Kahl <machisuji@gmail.com>
This commit is contained in:
Eric Schubert
2024-05-17 14:43:16 +02:00
committed by GitHub
parent adce411f26
commit dbccaae404
5 changed files with 31 additions and 5 deletions

3
.gitignore vendored
View File

@@ -1,2 +1,5 @@
# Jetbrains IDE
.idea/
*.swp
*.tar.gz

View File

@@ -6,7 +6,7 @@
# Please refer to our documentation to see all possible variables:
# https://www.openproject.org/docs/installation-and-operations/configuration/environment/
#
TAG=14
TAG=14-slim
OPENPROJECT_HTTPS=false
OPENPROJECT_HOST__NAME=localhost
PORT=127.0.0.1:8080

View File

@@ -0,0 +1,9 @@
:80 {
root * /public
reverse_proxy * http://${APP_HOST}:8080
file_server
log
}

View File

@@ -5,11 +5,12 @@ networks:
volumes:
pgdata:
opdata:
assets:
x-op-restart-policy: &restart_policy
restart: unless-stopped
x-op-image: &image
image: openproject/openproject:${TAG:-14}
image: openproject/openproject:${TAG:-14-slim}
x-op-app: &app
<<: [*image, *restart_policy]
environment:
@@ -47,17 +48,21 @@ services:
- backend
proxy:
<<: [*image, *restart_policy]
command: "./docker/prod/proxy"
image: caddy:2
<<: *restart_policy
command: "/usr/local/bin/proxy-entrypoint.sh"
ports:
- "${PORT:-8080}:80"
environment:
APP_HOST: web
OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}"
depends_on:
- web
networks:
- frontend
volumes:
- ./Caddyfile.template:/etc/caddy/Caddyfile.template:ro
- ./proxy-entrypoint.sh:/usr/local/bin/proxy-entrypoint.sh:ro
- assets:/public:ro
web:
<<: *app
@@ -77,6 +82,8 @@ services:
timeout: 3s
retries: 3
start_period: 30s
volumes:
- assets:/app/public
autoheal:
image: willfarrell/autoheal:1.2.0

7
compose/proxy-entrypoint.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
set -e
sed 's|${APP_HOST}|'"$APP_HOST"'|g' /etc/caddy/Caddyfile.template > /etc/caddy/Caddyfile
caddy run --config /etc/caddy/Caddyfile