home · contact · privacy
Add more migration to dumpsite setup.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 12 Apr 2020 20:47:38 +0000 (22:47 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 12 Apr 2020 20:47:38 +0000 (22:47 +0200)
buster/setup_scripts/setup_dumpsite.sh

index ec144554adb7389277533cb1b2004ad4d49a246a..860a3a05e9a52cf947ef51d3399dc5533522c8a7 100755 (executable)
@@ -23,29 +23,35 @@ 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
 
+# Set up connection to old dump server.
+cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/
+chown plom:plom /home/plom/prepare_to_meet_server.sh
+su -lc "./prepare_to_meet_server.sh ${old_server}" plom
+read -p'Hit Enter when you are done.' ignore
+rm /home/plom/prepare_to_meet_server.sh
+
 # Set up dump dirs.
 mkdir /var/www-dump
 chown plom:plom /var/www-dump
 dump_dir=dump
 geheim_dir=geheim
-su -lc "mkdir ${dump_dir} ${geheim_dir}" plom
 su -lc "ln -s /home/plom/${dump_dir} /var/www-dump/${dump_dir}" plom
 su -lc "ln -s /home/plom/${geheim_dir} /var/www-dump/${geheim_dir}" plom
-password_geheim=$(pwgen -1)
-echo "foo:{PLAIN}${password_geheim}" > /var/www-dump/password_geheim
-echo "geheim password is: ${password_geheim}"
+# Use upper outcommented instead of lower code if setting up new empty server.
+#su -lc "mkdir ${dump_dir} ${geheim_dir}" plom
+#password_geheim=$(pwgen -1)
+#echo "foo:{PLAIN}${password_geheim}" > /var/www-dump/password_geheim
+#echo "geheim password is: ${password_geheim}"
+cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/
+su -lc "./mirror_dir.sh ${old_server} /home/plom/{dump_dir}" plom
+su -lc "./mirror_dir.sh ${old_server} /home/plom/{geheim_dir}" plom
+scp plom@${old_server}:/var/www-dump/password_geheim /var/www-dump/password_geheim
+rm /home/plom/{prepare_to_meet_server,mirror_dir}.sh
 
 # Set up redo.
 wget http://news.dieweltistgarnichtso.net/bin/archives/redo-sh.tar.gz
 tar -moxzf redo-sh.tar.gz -C /usr/local
 
-# Set up connection to old dump server.
-cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/
-chown plom:plom /home/plom/prepare_to_meet_server.sh
-su -lc "./prepare_to_meet_server.sh ${old_server}" plom
-read -p'Hit Enter when you are done.' ignore
-rm /home/plom/prepare_to_meet_server.sh
-
 # Set up zettel.
 su -lc "git clone --mirror ${old_server}:zettel.git" plom
 cp "${config_tree_prefix}/other_files/zettel_hook_post-receive" /home/plom/zettel.git/hooks/post-receive
@@ -71,6 +77,10 @@ su -lc "cd url-catcher && ln -s ../blog/captchas/linkable/ captchas" plom
 cp "${config_tree_prefix}/other_files/url-catcher_customizations.json" /home/plom/url-catcher/customizations.json
 systemctl enable url_catcher.service
 service url_catcher start
+cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/
+su -lc "./mirror_dir.sh ${old_server} /home/plom/url-catcher/ips" plom
+su -lc "./mirror_dir.sh ${old_server} /home/plom/url-catcher/lists" plom
+rm /home/plom/{prepare_to_meet_server,mirror_dir}.sh
 
 # Set up index.html
 cp "${config_tree_prefix}/other_files/dumpsite_index.html" /var/www-dump/index.html