diff --git a/packages/websockproxy/README.md b/packages/websockproxy/README.md index eb36483..ca0bcad 100644 --- a/packages/websockproxy/README.md +++ b/packages/websockproxy/README.md @@ -1,3 +1,14 @@ +# INSTALLING +If you want to install the proxy server on your own server, here's the easiest way to get started: + +1. Start with an Ubuntu 20.04 server instance. This is the only configuration that's currently tested. Ubuntu 22.04 will not work, as it uses `OpenSSL 3.0` which is not compatible with the docker image's versons of `OpenSSL` and `nginx`. +2. Make sure Docker is installed. (see install_docker.sh for installing Docker on Ubuntu 20.04 amd64) +3. Make sure the DNS for your domain points to this new server. (Use an `A` record.) +4. Copy the `install.sh` file to the server. +5. Modify the first two lines of `install.sh` to set your `PROXY_DOMAIN` and `PROXY_DOMAIN_SUPPORT_EMAIL`. +6. Execute the `install.sh` script on the server. + + # WebSockets Proxy A websocket ethernet switch built using Tornado in Python diff --git a/packages/websockproxy/install.sh b/packages/websockproxy/install.sh new file mode 100755 index 0000000..cfe6ea9 --- /dev/null +++ b/packages/websockproxy/install.sh @@ -0,0 +1,19 @@ +export PROXY_DOMAIN="my_proxy.domain.com" +export PROXY_DOMAIN_SUPPORT_EMAIL="support@my_proxy.domain.com" + +docker rm -f relay && docker run --privileged --network host --name relay burggraf/pg_browser_websockproxy:1.0.5 & + +sleep 120 # give time for initial start + +crontab -l | { cat; echo "@reboot sleep 5 && docker rm -f relay && docker run --privileged --network host --name relay burggraf/pg_browser_websockproxy:1.0.5"; } | crontab - + +apt install -y certbot +apt install -y cron +certbot certonly -d $PROXY_DOMAIN --standalone -n --agree-tos --email $PROXY_DOMAIN_SUPPORT_EMAIL +docker cp -L /etc/letsencrypt/live/$PROXY_DOMAIN/fullchain.pem relay:/root/fullchain.pem +docker cp -L /etc/letsencrypt/live/$PROXY_DOMAIN/privkey.pem relay:/root/privkey.pem +docker exec -it relay nginx # start nginx + +crontab -l | { cat; echo "0 1 * * * certbot renew --standalone"; } | crontab - +crontab -l | { cat; echo "0 2 * * * docker cp -L /etc/letsencrypt/live/$PROXY_DOMAIN/fullchain.pem relay:/root/fullchain.pem"; } | crontab - +crontab -l | { cat; echo "0 2 * * * docker cp -L /etc/letsencrypt/live/$PROXY_DOMAIN/privkey.pem relay:/root/privkey.pem"; } | crontab - diff --git a/packages/websockproxy/install_docker.sh b/packages/websockproxy/install_docker.sh new file mode 100755 index 0000000..854eb8c --- /dev/null +++ b/packages/websockproxy/install_docker.sh @@ -0,0 +1,7 @@ +# install docker on Ubuntu Server 20.04 amd64 +sudo apt install apt-transport-https ca-certificates curl software-properties-common +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" +apt-cache policy docker-ce +sudo apt install -y docker-ce +sudo systemctl status docker