How do I setup the WebSocket server for Whiteboard real-time collaboration?

Found my notes on the topic. I’m running Nextcloud on an Ubuntu server, a classic LAMP installation without Docker.

Install Docker:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh ./get-docker.sh

Open a root shell:

sudo -i

Create a directory:

mkdir /opt/docker-compose

Create .env file:

echo "WBSECRET=$(openssl rand -hex 32)" >> /opt/docker-compose/.env

Create compose.yaml:

nano /opt/docker-compose/compose.yaml
services:
    whiteboard:
        container_name: whiteboard
        image: ghcr.io/nextcloud-releases/whiteboard:release
        restart: unless-stopped
        environment:
            - STORAGE_STRATEGY=lru
            - NEXTCLOUD_URL=https://cloud.domain.tld
            - JWT_SECRET_KEY=${WBSECRET}
        ports:
            - 127.0.0.1:3002:3002

Pull the Image and start the container:

cd /opt/docker-compose && docker compose up -d

Add the following to the Apache VirtualHost that serves Nextcloud:
(Click here for Apache < 2.4.47 or NGINX)

ProxyPass /whiteboard http://127.0.0.1:3002 upgrade=websocket

Enable modules:

a2enmod proxy
a2enmod proxy_http
a2enmod proxy_wstunnel

Restart Apache

systemctl restart apache2

Install the Whiteboard app either via WebUI or via occ command:

sudo -u www-data php /var/www/nextcloud/occ app:install whiteboard

Configure the Whiteboard app either via occ commands…

sudo -u www-data php /var/www/nextcloud/occ config:app:set whiteboard collabBackendUrl --value="https://cloud.domain.tld/whiteboard"
sudo -u www-data php /var/www/nextcloud/occ config:app:set whiteboard jwt_secret_key --value="$(grep '^WBSECRET=' /opt/docker-compose/.env | cut -d '=' -f2-)"

…or via WebUI:

Whiteboard server URL:

https://cloud.domain.tld/whiteboard

Shared Secret:

The WBSECRET from the .env file:

grep '^WBSECRET=' /opt/docker-compose/.env | cut -d '=' -f2-
1 Like