Simple self-hosted WebWormhole.io using docker-compose
Note: This config is currently missing a TURN server, so it won’t work if the clients can’t reach each other! I am working on this. WebWormhole.io is a new service similar to and inspired by magic-wormhole that allows easily sharing files between browsers without the need to install a software. Internally, it uses WebRTC, allowing direct transfer of files between computers even through firewalls.
While there is no official Docker image published on Docker Hub, the WebWormhole GitHub project provides an official Dockerfile. Based on this, I have published ulikoehler/webwormhole which has been built using
git clone https://github.com/saljam/webwormhole.git
cd webwormhole
docker build -t ulikoehler/webwormhole:latest .
docker push ulikoehler/webwormhole:latest
This is the docker-compose.yml
that you can use to run WebWormhole behind a reverse proxy:
services:
webwormhole:
image: 'ulikoehler/webwormhole:latest'
entrypoint: ["/bin/ww", "server", "-http=localhost:52618", "-https="]
network_mode: host
and this is my nginx config:
server {
server_name webwormhole.mydomain.com;
access_log off;
error_log /var/log/nginx/webwormhole.mydomain.com.error.log;
location / {
proxy_pass http://localhost:52618/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_redirect default;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/webwormhole.mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/webwormhole.mydomain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = webwormhole.mydomain.com) {
return 301 https://$host$request_uri;
}
server_name webwormhole.mydomain.com;
listen 80;
return 404; # managed by Certbot
}
I storeĀ docker-compose.yml
inĀ /var/lib/webwormhole.mydomain.com
and I used the script from our previous post Create a systemd service for your docker-compose project in 10 seconds in order to create this systemd config file in /etc/systemd/system/webwormhole.mydomain.com.service
:
[Unit]
Description=webwormhole.mydomain.com
Requires=docker.service
After=docker.service
[Service]
Restart=always
User=root
Group=docker
WorkingDirectory=/var/lib/webwormhole.mydomain.com
# Shutdown container (if running) when unit is started
ExecStartPre=/usr/local/bin/docker-compose -f docker-compose.yml down
# Start container when unit is started
ExecStart=/usr/local/bin/docker-compose -f docker-compose.yml up
# Stop container when unit is stopped
ExecStop=/usr/local/bin/docker-compose -f docker-compose.yml down
[Install]
WantedBy=multi-user.target
which you can start and enable using
sudo systemctl enable webwormhole.mydomain.com
sudo systemctl start webwormhole.mydomain.com