From fa17fe3374f02ac5866cb52e062a7f9325d68c82 Mon Sep 17 00:00:00 2001 From: Mark Burggraf Date: Thu, 6 Oct 2022 06:44:41 -0700 Subject: [PATCH 1/4] new install script for proxy --- packages/websockproxy/README.md | 10 ++++++++++ packages/websockproxy/install.sh | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 packages/websockproxy/install.sh diff --git a/packages/websockproxy/README.md b/packages/websockproxy/README.md index eb36483..f069759 100644 --- a/packages/websockproxy/README.md +++ b/packages/websockproxy/README.md @@ -1,3 +1,13 @@ +# 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 the DNS for your domain points to this new server. (Use an `A` record.) +3. Copy the `install.sh` file to the server. +4. Modify the first two lines of `install.sh` to set your `PROXY_DOMAIN` and `PROXY_DOMAIN_SUPPORT_EMAIL`. +5. 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 100644 index 0000000..a10f8a7 --- /dev/null +++ b/packages/websockproxy/install.sh @@ -0,0 +1,18 @@ +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 certbot +apt install 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 + +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 - From 8daca53383a9a9510107eb5da17e51152301e067 Mon Sep 17 00:00:00 2001 From: Mark Burggraf Date: Thu, 6 Oct 2022 06:58:20 -0700 Subject: [PATCH 2/4] added install_docker script --- packages/websockproxy/README.md | 9 +++++---- packages/websockproxy/install.sh | 0 packages/websockproxy/install_docker.sh | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) mode change 100644 => 100755 packages/websockproxy/install.sh create mode 100755 packages/websockproxy/install_docker.sh diff --git a/packages/websockproxy/README.md b/packages/websockproxy/README.md index f069759..ca0bcad 100644 --- a/packages/websockproxy/README.md +++ b/packages/websockproxy/README.md @@ -2,10 +2,11 @@ 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 the DNS for your domain points to this new server. (Use an `A` record.) -3. Copy the `install.sh` file to the server. -4. Modify the first two lines of `install.sh` to set your `PROXY_DOMAIN` and `PROXY_DOMAIN_SUPPORT_EMAIL`. -5. Execute the `install.sh` script on the server. +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 diff --git a/packages/websockproxy/install.sh b/packages/websockproxy/install.sh old mode 100644 new mode 100755 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 From 47f7559ad861d93a62c15d5035325ef2fdce3b74 Mon Sep 17 00:00:00 2001 From: Mark Burggraf Date: Thu, 6 Oct 2022 07:09:20 -0700 Subject: [PATCH 3/4] added -y to install scripts --- packages/websockproxy/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/websockproxy/install.sh b/packages/websockproxy/install.sh index a10f8a7..42d5da0 100755 --- a/packages/websockproxy/install.sh +++ b/packages/websockproxy/install.sh @@ -7,8 +7,8 @@ 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 certbot -apt install cron +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 From f7a537df3ff088a70ed2405db90a993aecf9652a Mon Sep 17 00:00:00 2001 From: Mark Burggraf Date: Thu, 6 Oct 2022 07:13:36 -0700 Subject: [PATCH 4/4] add line to start nginx on docker --- packages/websockproxy/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/websockproxy/install.sh b/packages/websockproxy/install.sh index 42d5da0..cfe6ea9 100755 --- a/packages/websockproxy/install.sh +++ b/packages/websockproxy/install.sh @@ -12,6 +12,7 @@ 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 -