home · contact · privacy
Add PlomTube mirror setup.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 11 Sep 2023 01:07:41 +0000 (03:07 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 11 Sep 2023 01:07:41 +0000 (03:07 +0200)
bookworm/etc_files/static_websites/etc/nginx/sites-available/status.plomlompom.com.nginx [deleted file]
bookworm/etc_files/status.plomlompom.com/etc/nginx/sites-available/status.plomlompom.com.nginx [new file with mode: 0644]
bookworm/etc_files/tube.plomlompom.com/etc/nginx/sites-available/tube.plomlompom.com.nginx [new file with mode: 0644]
bookworm/setup_scripts/setup_status.plomlompom.com.sh
bookworm/setup_scripts/setup_tube.plomlompom.com.sh [new file with mode: 0755]

diff --git a/bookworm/etc_files/static_websites/etc/nginx/sites-available/status.plomlompom.com.nginx b/bookworm/etc_files/static_websites/etc/nginx/sites-available/status.plomlompom.com.nginx
deleted file mode 100644 (file)
index 99c19d2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-server {
-    listen 443 ssl;
-    server_name REPLACE_fqdn_ECALPER;
-    ssl_certificate /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/fullchain.pem;
-    ssl_certificate_key /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/privkey.pem;
-    root /var/www/status.plomlompom.com/;
-
-    location = / {
-        return 301 /users/plomlompom.html;
-    } 
-
-    # re-direct to .html endings
-    location ~ ^/(notice|users)/([^\.]*)/?$ {
-        rewrite ^/(notice|users)/([^\./]*)/?$ /$1/$2.html permanent;
-    }
-}
diff --git a/bookworm/etc_files/status.plomlompom.com/etc/nginx/sites-available/status.plomlompom.com.nginx b/bookworm/etc_files/status.plomlompom.com/etc/nginx/sites-available/status.plomlompom.com.nginx
new file mode 100644 (file)
index 0000000..99c19d2
--- /dev/null
@@ -0,0 +1,16 @@
+server {
+    listen 443 ssl;
+    server_name REPLACE_fqdn_ECALPER;
+    ssl_certificate /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/fullchain.pem;
+    ssl_certificate_key /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/privkey.pem;
+    root /var/www/status.plomlompom.com/;
+
+    location = / {
+        return 301 /users/plomlompom.html;
+    } 
+
+    # re-direct to .html endings
+    location ~ ^/(notice|users)/([^\.]*)/?$ {
+        rewrite ^/(notice|users)/([^\./]*)/?$ /$1/$2.html permanent;
+    }
+}
diff --git a/bookworm/etc_files/tube.plomlompom.com/etc/nginx/sites-available/tube.plomlompom.com.nginx b/bookworm/etc_files/tube.plomlompom.com/etc/nginx/sites-available/tube.plomlompom.com.nginx
new file mode 100644 (file)
index 0000000..57b084a
--- /dev/null
@@ -0,0 +1,12 @@
+server {
+    listen 443 ssl;
+    server_name REPLACE_fqdn_ECALPER;
+    ssl_certificate /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/fullchain.pem;
+    ssl_certificate_key /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/privkey.pem;
+    root /var/www/tube.plomlompom.com/;
+
+    # re-direct to .html endings
+    location ~ ^/videos/watch/([^\.]*)/?$ {
+        rewrite ^/videos/watch/([^\./]*)/?$ /videos/watch/$1.html permanent;
+    }
+}
index d5e6d180b0a30ec0b681e5a3cf257adea1807dc1..730df3eda815050ce631b1e080dc9dfc8c300ed4 100755 (executable)
@@ -10,8 +10,8 @@ else
     domain="$1"
 fi
 # Install configs, set up firewall.
-./install_for_target.sh static_websites
-./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" static_websites
+./install_for_target.sh status.plomlompom.com
+./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" status.plomlompom.com 
 nft -f /etc/nftables.conf
 
 # Set up letsencrypt certificate. TODO: Is it auto-renewed?
diff --git a/bookworm/setup_scripts/setup_tube.plomlompom.com.sh b/bookworm/setup_scripts/setup_tube.plomlompom.com.sh
new file mode 100755 (executable)
index 0000000..efb0c06
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -e
+. ./misc.sh
+
+expect_setup_finished_file setup_web_has_been_run setup_web.sh
+
+if [ -z "$1"]; then
+    domain="tube.plomlompom.com"
+else
+    domain="$1"
+fi
+# Install configs, set up firewall.
+./install_for_target.sh tube.plomlompom.com
+./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" tube.plomlompom.com
+nft -f /etc/nftables.conf
+
+# Set up letsencrypt certificate. TODO: Is it auto-renewed?
+ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
+certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
+rm /etc/nginx/sites-enabled/default
+
+# Prepare NGINX for tube.plomlompom.com.
+sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/tube.plomlompom.com.nginx
+ln -s /etc/nginx/sites-available/tube.plomlompom.com.nginx /etc/nginx/sites-enabled/tube.plomlompom.com.nginx
+
+service nginx restart
+