Add hocuspocus.

This commit is contained in:
ba1ash
2025-10-12 22:04:00 +02:00
parent 6831d93c1b
commit 0944595b5a
4 changed files with 29 additions and 8 deletions

View File

@@ -17,3 +17,5 @@ RAILS_MIN_THREADS=4
RAILS_MAX_THREADS=16
PGDATA="/var/lib/postgresql/data"
OPDATA="/var/openproject/assets"
OPENPROJECT_COLLABORATIVE__EDITING__HOCUSPOCUS__URL=ws://localhost:8080/hocuspocus
OPENPROJECT_COLLABORATIVE__EDITING__HOCUSPOCUS__SECRET=secret12345

View File

@@ -19,6 +19,8 @@ x-op-app: &app
RAILS_CACHE_STORE: "memcache"
OPENPROJECT_CACHE__MEMCACHE__SERVER: "cache:11211"
OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}"
OPENPROJECT_COLLABORATIVE__EDITING__HOCUSPOCUS__URL: "${OPENPROJECT_COLLABORATIVE__EDITING__HOCUSPOCUS__URL}"
OPENPROJECT_COLLABORATIVE__EDITING__HOCUSPOCUS__SECRET: "${OPENPROJECT_COLLABORATIVE__EDITING__HOCUSPOCUS__SECRET}"
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}
@@ -51,6 +53,7 @@ services:
context: ./proxy
args:
APP_HOST: web
HOCUSPOCUS_HOST: hocuspocus
image: openproject/proxy
<<: *restart_policy
ports:
@@ -114,3 +117,10 @@ services:
restart: on-failure
networks:
- backend
hocuspocus:
image: openproject/hocuspocus:main-88913ad0
networks:
- frontend
environment:
SECRET: "${OPENPROJECT_COLLABORATIVE__EDITING__HOCUSPOCUS__SECRET}"

View File

@@ -1,12 +1,18 @@
:80 {
reverse_proxy * http://${APP_HOST}:8080 {
# The following directives are needed to make the proxy forward explicitly the X-Forwarded-* headers. If unset,
# Caddy will reset them. See: https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#defaults
# This is needed, if you are using a reverse proxy in front of the compose stack and Caddy is NOT your first
# point of contact.
# When using Caddy is reachable as a first point of contact, it is highly recommended to configure the server's
# global `trusted_proxies` directive. See: https://caddyserver.com/docs/caddyfile/options#trusted-proxies
# Reverse proxy for WebSocket connections
@hocuspocus {
path /hocuspocus*
}
reverse_proxy @hocuspocus ${HOCUSPOCUS_HOST}:1234 {
header_up X-Forwarded-Proto {header.X-Forwarded-Proto}
header_up X-Forwarded-For {header.X-Forwarded-For}
}
# Reverse proxy for all other HTTP requests
@app {
not path /hocuspocus*
}
reverse_proxy @app ${APP_HOST}:8080 {
header_up X-Forwarded-Proto {header.X-Forwarded-Proto}
header_up X-Forwarded-For {header.X-Forwarded-For}
}

View File

@@ -3,6 +3,9 @@ FROM caddy:2
COPY ./Caddyfile.template /etc/caddy/Caddyfile.template
ARG APP_HOST
RUN sed 's|${APP_HOST}|'"$APP_HOST"'|g' /etc/caddy/Caddyfile.template > /etc/caddy/Caddyfile
ARG HOCUSPOCUS_HOST
RUN sed -e 's|${APP_HOST}|'"$APP_HOST"'|g' \
-e 's|${HOCUSPOCUS_HOST}|'"$HOCUSPOCUS_HOST"'|g' \
/etc/caddy/Caddyfile.template > /etc/caddy/Caddyfile
ENTRYPOINT ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]