Skip to content

Instantly share code, notes, and snippets.

@mqu
Created May 16, 2022 14:19
Show Gist options
  • Save mqu/d4a4facefa6e81646b29808a2dc14634 to your computer and use it in GitHub Desktop.
Save mqu/d4a4facefa6e81646b29808a2dc14634 to your computer and use it in GitHub Desktop.
excalidraw / multi-user mode

This is Excalidraw + Excalidraw-room (web-socket server) behind an apache reverse-proxy using docker-compose.

usage :

  • clone this projet
  • clone Excalidraw source code in build/src :
mkdir -p build/src ; git clone https://github.com/excalidraw/excalidraw.git build/src/excalidraw
  • build docker-compose stack
docker-compose build

nearly done

docker-compose up -d
version: '3.6'
x-defaults-std:
&default-settings-std
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "20k"
max-file: "5"
tmpfs:
- /tmp
- /run
networks:
- internal
# declare 2 services :
# - xdraw (Excalidraw)
# - room (Excalidraw websocket service)
services:
xdraw:
<<: *default-settings-ressources
image: excalidraw:custom-0.11.0-build-01
# read_only: true
build:
context: ./build/src/excalidraw
restart: unless-stopped
ports:
- 127.0.0.1:9014:80
environment:
- NODE_ENV=production
- REACT_APP_SOCKET_SERVER_URL=https://xdraw.kalif.asap.dsna.fr/
# this one has no effect
- REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com/
volumes:
- ./var/nobackup/cache/:/var/cache/nginx/client_temp
room:
image: excalidraw/excalidraw-room:latest
build:
context: ./build/src/excalidraw-room
restart: unless-stopped
ports:
- 127.0.0.1:9015:3002
environment:
- NODE_ENV=production
- PORT=3002
networks:
internal:
# this is Apache Reverse-proxy configuration (/etc/apache2/site-available/apache/excalidraw.conf)
<VirtualHost *:80>
ServerName xdraw.example.local
ServerAdmin admin@example.local
ErrorLog ${APACHE_LOG_DIR}/xdraw-error.log
CustomLog ${APACHE_LOG_DIR}/xdraw.log combined
# Enforce HTTPS:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>
<VirtualHost *:443>
ServerName xdraw.example.local
ServerAdmin admin@example.local
ErrorLog ${APACHE_LOG_DIR}/xdraw-error.log
CustomLog ${APACHE_LOG_DIR}/xdraw.log combined
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/xdraw.example.local/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/xdraw.example.local/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/xdraw.example.local/fullchain.pem
RewriteEngine On
# excalidraw-room (websocket)
# declare this one first !
ProxyPass /socket.io/ http://localhost:9015/socket.io/
ProxyPassReverse /socket.io/ http://localhost:9015/socket.io/
# main excalidraw application reverse-proxy
ProxyPass / http://localhost:9014/
ProxyPassReverse / http://localhost:9014/
ProxyPreserveHost On
Header set Access-Control-Allow-Origin "*"
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment