home · contact · privacy
Fix bugs, add tube.plomlompom.com mirroring.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 26 Sep 2023 18:40:13 +0000 (20:40 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 26 Sep 2023 18:40:13 +0000 (20:40 +0200)
bookworm/setup_scripts/setup_status.plomlompom.com.sh
bookworm/setup_scripts/setup_tube.plomlompom.com.sh
bookworm/setup_scripts/setup_web.sh

index afa1fd997bbffc4b6a1b3bf5a16b27bba424d335..726cffc6b4f1d9a2a9a7efc0d4760ea0a887ee1c 100755 (executable)
@@ -41,11 +41,10 @@ if [ ! -z "${mirror_ip}" ]; then
     cp "${setup_scripts_dir}/prepare_to_meet_server.sh" /home/plom/
     chown plom:plom /home/plom/prepare_to_meet_server.sh
     su -lc "./prepare_to_meet_server.sh ${mirror_ip}" plom
-    read -p'Hit Enter when you are done.' ignore
+    read -p 'Hit Enter when you are done.' ignore
     rm /home/plom/prepare_to_meet_server.sh
 
     # Mirror dirs.
-    su -lc "ln -s /home/plom/status.plomlompom.com /var/www/status.plomlompom.com" plom
     cp "${setup_scripts_dir}/mirror_dir.sh" /home/plom/
     su -lc "./mirror_dir.sh ${mirror_ip} /var/www/status.plomlompom.com" plom
     rm /home/plom/mirror_dir.sh
index 566a6b544f7c4fa43b49349b4111d5941172989c..a68ee393a838a36740b3c5073680e0a0e5519413 100755 (executable)
@@ -4,17 +4,21 @@ set -e
 
 expect_setup_finished_file setup_web_has_been_run setup_web.sh
 
-if [ -z "$1" ]; then
-    domain="tube.plomlompom.com"
-    mail="plom+tube@plomlompom.com"
-elif [ "$#" -lt 2 ]; then
+mirror_ip=""
+mirror_state="not mirroring automatically"
+domain="tube.plomlompom.com"
+mail="plom+tube@plomlompom.com"
+if [ "$#" -gt 0 ]; then
     domain="$1"
-    mail="plom+testing@plomlompom.com"
-else
-    domain="$1"
-    mail="$2"
+    if [ "$#" -gt 1 ]; then
+        mail="plom+testing@plomlompom.com"
+       if [ "$#" -gt 2 ]; then
+           mirror_ip="$3"
+            mirror_state="mirroring automatically from ${mirror_ip}"
+        fi
+    fi
 fi
-echo "Assuming domain ${domain} and letsencrypt support mail address ${mail}, abort and provide as arguments in this order if other desired! (Otherwise just hit Return.)"
+echo "Assuming domain ${domain} and letsencrypt support mail address ${mail} and ${mirror_state}, abort and provide as arguments in this order if other desired! (Otherwise just hit Return.)"
 read _
 
 # Install configs, set up firewall.
@@ -31,5 +35,21 @@ rm /etc/nginx/sites-enabled/default
 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
 
+if [ ! -z "${mirror_ip}" ]; then
+    # Set up connection to old server.
+    cp "${setup_scripts_dir}/misc.sh" /home/plom/
+    cp "${setup_scripts_dir}/prepare_to_meet_server.sh" /home/plom/
+    chown plom:plom /home/plom/prepare_to_meet_server.sh
+    su -lc "./prepare_to_meet_server.sh ${mirror_ip}" plom
+    read -p 'Hit Enter when you are done.' ignore
+    rm /home/plom/prepare_to_meet_server.sh
+
+    # Mirror dirs.
+    cp "${setup_scripts_dir}/mirror_dir.sh" /home/plom/
+    su -lc "./mirror_dir.sh ${mirror_ip} /var/www/status.plomlompom.com" plom
+    rm /home/plom/mirror_dir.sh
+    rm /home/plom/misc.sh
+fi
+
 service nginx restart
 
index a2e672f684899ce51620f7ba1090cb91192a900c..c9cc0ac0c11cf6daa9556009d40a0eb5634c349d 100755 (executable)
@@ -12,6 +12,8 @@ domain="$1"
 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web
 nft -f /etc/nftables.conf
 
+chown plom /var/www
+
 # # 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}"