home · contact · privacy
Set up sending mail server for URL catcher.
[config] / buster / setup_scripts / setup_dumpsite.sh
index 25ebb94111761fccbafd6efa9863a41d7e503125..739f145dbff69af4fec8e4359ec10726bdd03c52 100755 (executable)
@@ -2,14 +2,17 @@
 set -e
 set -x
 
-if [ "$#" -ne 2 ]; then
-    echo 'Need domain name and mail.'
+if [ "$#" -ne 3 ]; then
+    echo 'Need domain name and mail and old server.'
     false
 fi
 domain="$1"
 mail="$2"
+old_server="$3"
 
 # Install configs, set up firewall.
+echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
+echo "postfix postfix/mailname string $(hostname -f)" | debconf-set-selections
 config_tree_prefix="${HOME}/config/buster"
 ./install_for_target.sh web dumpsite
 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web dumpsite
@@ -32,6 +35,46 @@ password_geheim=$(pwgen -1)
 echo "foo:{PLAIN}${password_geheim}" > /var/www-dump/password_geheim
 echo "geheim password is: ${password_geheim}"
 
+# 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
+su -lc "git clone ~/zettel.git && cd zettel && redo" plom
+su -lc "ln -s /home/plom/zettel /var/www-dump/zettel" plom
+# NOTE: Locally, to update content, clone zettel.git, not zettel.
+
+# Set up redo blog.
+su -lc "git clone --mirror ${old_server}:blog.git" plom
+cp "${config_tree_prefix}/other_files/blog_hook_post-receive" /home/plom/blog.git/hooks/post-receive
+su -lc "git clone ~/blog.git" plom
+# FIXME: we should not depend on a GitHub repo;
+# instead, set up like plomlombot repo (with post-recieve hook)
+su -lc "git clone https://github.com/plomlompom/redo-blog.git" plom
+su -lc "cd redo-blog && ./add_dir.sh ~/blog" plom
+su -lc "cd blog && redo" plom
+su -lc "ln -s /home/plom/blog/public /var/www-dump/blog" plom
+# NOTE: Locally, to update content, clone blog.git, not blog.
+
+# Set up url catcher.
+su -lc "git clone https://github.com/plomlompom/url-catcher.git" plom
+# FIXME: we should not depend on a GitHub repo;
+# instead, set up like plomlombot repo (with post-recieve hook)
+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
+# NOTE: fix metadata/article_tmpl referencing dump.plomlompom.com explicitely
+
 # Prepare NGINX.
 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/dumpsite.nginx
 ln -s /etc/nginx/sites-available/dumpsite.nginx /etc/nginx/sites-enabled/dumpsite.nginx