Content
Openproject 12 with traefik
Hi,
does anybody have a sample yml script to run openproject 12 with traefik as reverse proxy in a docker environment?
This would be helpful for me to get started with my project.
Hi, we suggest running apache2 or nginx as a docker container for proxiing OpenProject in docker.
Could you please share traefik repository and version which you are using?
Hello, I'm also interested to plug-in a Traefik as a reverse proxy for an OpenProject application
I tried to set Traefik's labels on both the proxy service and the web service of openproject 12 docker-compose definitions, but I'm only getting 499 errors in Traefik logs (tried ports 80, 8080, custom ... I don't get what I miss)
Using Traefik v2.9, no https for basic use case
Nevermind, I had a typo in my domain name ....
It's working perfectly fine to set the labels on the proxy container :)
traefik.yml
global:
checkNewVersion: true
sendAnonymousUsage: true
api:
dashboard: true
providers:
docker:
exposedByDefault: false
swarmMode: false
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
http:
tls:
certResolver: letsencrypt
certificatesResolvers:
letsencrypt:
acme:
email: your@email.tld
storage: acme.json
httpChallenge:
entryPoint: web
log:
level: DEBUG
accessLog: {}
Traefik docker-compose.yml
version: '3.7'
configs:
traefik.yml:
file: ./traefik.yml
services:
traefik:
restart: unless-stopped
image: traefik:2.9
ports:
- "80:80"
- "443:443"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefikApi.rule=Host(`traefik.domain.tld`)"
- "traefik.http.routers.traefikApi.entryPoints=websecure"
- "traefik.http.routers.traefikApi.service=api@internal"
- "traefik.http.routers.traefikApi.middlewares=traefikApiBasicAuth"
- "traefik.http.routers.traefikApi.tls=true"
# "$" characters must be doubled in labels
- "traefik.http.middlewares.traefikApiBasicAuth.basicauth.users=yourname:$$2y$$aaabbbcccddd"
networks:
- your_traefik_network
configs:
- source: traefik.yml
target: /etc/traefik/traefik.yml
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./volumes/acme.json:/acme.json
networks:
your_traefik_network:
external: true
Openproject v12 docker-compose.yml
services:
# ....
proxy:
<<: [*image, *restart_policy]
command: "./docker/prod/proxy"
# You can comment/remove ports exposure, it's now handled by traefik
# ports:
# - "${PORT:-8080}:80"
environment:
APP_HOST: web
OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}"
depends_on:
- web
labels:
- "traefik.enable=true"
- "traefik.http.services.openproject.loadbalancer.server.port=80"
- "traefik.http.routers.openproject.rule=Host(`yourdomain.tld`)"
- "traefik.http.routers.openproject.entryPoints=websecure"
- "traefik.http.routers.openproject.tls=true"
- "traefik.http.routers.openproject.service=openproject"
networks:
- frontend
# add it here
- your_traefik_network
networks:
frontend:
backend:
# you must connect an external network (also present in the docker-compose/conf of Traefik)
your_traefik_network:
external: true
Happy openprojecting :)
Edit: forgot the "traefik.http.routers.openproject.service" line yesterday, added it this morning.
I also found out sometimes Traefik (or just docker ?) seems lost in the networking when the "web" service from OpenProject crashes at the first initialization - this is acutally in such case where I get 499 responses in Traefik. Just restart the proxy service: docker-compose restart proxy , and it should work.