home · contact · privacy
Add zettels to dump site.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 3 Apr 2020 21:23:10 +0000 (23:23 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 3 Apr 2020 21:23:10 +0000 (23:23 +0200)
buster/apt-mark/dumpsite
buster/etc_files/dumpsite/etc/nginx/sites-available/dumpsite.nginx
buster/other_files/zettel_hook_post-receive [new file with mode: 0755]
buster/setup_scripts/setup_dumpsite.sh

index 6cab4416a17f7f1715154ddbbf902642c1ae9373..cd1cd375561d0e4b0919cb4d704745cf95da6245 100644 (file)
@@ -1 +1,3 @@
 pwgen
+wget
+pandoc
index bb723d250e0525d49074f8f2d19f038252a6ddc7..edd79fb108ec011bbe9e86d1c7b2b952431356fa 100644 (file)
@@ -4,7 +4,6 @@ server {
     ssl_certificate /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/privkey.pem;
     root /var/www-dump/;
-    index index.html index.htm index.nginx-debian.html;
 
     location /dump/ {
         autoindex on;
@@ -15,4 +14,10 @@ server {
         auth_basic_user_file /var/www-dump/password_geheim;
         autoindex on;
     }
+
+    location /zettel/ {
+            # rewrite non-suffixed filenames to .html ones
+            rewrite ^(/zettel/(.*/)*[^./]+)$ $1.html;
+            autoindex on;
+    }
 }
diff --git a/buster/other_files/zettel_hook_post-receive b/buster/other_files/zettel_hook_post-receive
new file mode 100755 (executable)
index 0000000..3bea5b2
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+ZETTELDIR=/home/plom/zettel
+GIT_WORK_TREE=$ZETTELDIR git checkout -f
+cd $ZETTELDIR
+redo
index 25ebb94111761fccbafd6efa9863a41d7e503125..be04d79f9650549aa71b961dae6abbdad3db117f 100755 (executable)
@@ -2,12 +2,13 @@
 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.
 config_tree_prefix="${HOME}/config/buster"
@@ -32,6 +33,17 @@ password_geheim=$(pwgen -1)
 echo "foo:{PLAIN}${password_geheim}" > /var/www-dump/password_geheim
 echo "geheim password is: ${password_geheim}"
 
+# Set up zettel and redo.
+wget http://news.dieweltistgarnichtso.net/bin/archives/redo-sh.tar.gz
+tar -moxzf redo-sh.tar.gz -C /usr/local
+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
+su -lc "cd /var/repos && git clone --mirror ${old_server}:zettel.git" plom
+cp "${config_tree_prefix}/other_files/zettel_hook_post-receive" /home/plom/zettel.git/hooks/
+su -lc "git clone ~/zettel.git" plom
+rm /home/plom/prepare_to_meet_server.sh
+
 # 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