From: Christian Heller Date: Fri, 3 Apr 2020 21:23:10 +0000 (+0200) Subject: Add zettels to dump site. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/error?a=commitdiff_plain;h=8651fd95fff3154ac21638056e6c4388312667e3;p=config Add zettels to dump site. --- diff --git a/buster/apt-mark/dumpsite b/buster/apt-mark/dumpsite index 6cab441..cd1cd37 100644 --- a/buster/apt-mark/dumpsite +++ b/buster/apt-mark/dumpsite @@ -1 +1,3 @@ pwgen +wget +pandoc diff --git a/buster/etc_files/dumpsite/etc/nginx/sites-available/dumpsite.nginx b/buster/etc_files/dumpsite/etc/nginx/sites-available/dumpsite.nginx index bb723d2..edd79fb 100644 --- a/buster/etc_files/dumpsite/etc/nginx/sites-available/dumpsite.nginx +++ b/buster/etc_files/dumpsite/etc/nginx/sites-available/dumpsite.nginx @@ -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 index 0000000..3bea5b2 --- /dev/null +++ b/buster/other_files/zettel_hook_post-receive @@ -0,0 +1,5 @@ +#!/bin/sh +ZETTELDIR=/home/plom/zettel +GIT_WORK_TREE=$ZETTELDIR git checkout -f +cd $ZETTELDIR +redo diff --git a/buster/setup_scripts/setup_dumpsite.sh b/buster/setup_scripts/setup_dumpsite.sh index 25ebb94..be04d79 100755 --- a/buster/setup_scripts/setup_dumpsite.sh +++ b/buster/setup_scripts/setup_dumpsite.sh @@ -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