I'm setting up an Excalidraw room using Docker, and while the Excalidraw interface itself works perfectly, I'm having trouble with the Live Session button—it just doesn't seem to do anything. My compose file is included below, and I've run into some confusion about why this is happening. When I checked with an AI, it suggested that the frontend might be broken and I might need to build it from scratch. That doesn't quite feel right to me. Anyone have ideas on what's going wrong?
2 Answers
It looks like the issue could be related to the environment variables not being applied correctly in your Excalidraw container. Instead of using the ones you're trying to set in your compose file, it’s using the default ones. You might want to consider forking the Excalidraw repo and modify the `.env.production` file to update the WebSocket URL directly. After that, you'll need to rebuild the container to reflect these changes.
There's actually a simpler fix! You can define a custom entrypoint for the Excalidraw container and replace the existing WebSocket URL with the one from your environment variable. This way, when you start the container, it’ll use your custom URL. Here's a snippet you can adapt for your `docker-compose.yml`:
```yaml
excalidraw:
entrypoint: /bin/sh
command:
- -c
- |
echo "Replacing WebSocket URL with: $$VITE_APP_WS_SERVER_URL"
find /usr/share/nginx/html/assets -type f -name "*.js" -exec sed -i 's|https://oss-collab.excalidraw.com|$$VITE_APP_WS_SERVER_URL|g' {} +
echo "Starting nginx..."
nginx -g 'daemon off;'
```
After integrating that, your collaborations should work fine!

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically