home · contact · privacy
Add website repo setup.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 22 Mar 2020 22:58:12 +0000 (23:58 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 22 Mar 2020 22:58:12 +0000 (23:58 +0100)
buster/other_files/website_hook_post-receive [new file with mode: 0644]
buster/setup_scripts/setup_website.sh

diff --git a/buster/other_files/website_hook_post-receive b/buster/other_files/website_hook_post-receive
new file mode 100644 (file)
index 0000000..26d1cce
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+GIT_WORK_TREE=/var/www git checkout -f
index f060f0da3a6b2d2c4ba9482860f7cdb3a2d6de09..2910eee52c8e377724d1bdffe282b9220fcf9a64 100755 (executable)
@@ -3,12 +3,13 @@ set -e
 set -x
 # Heavily inspired by <https://docs-develop.pleroma.social/backend/installation/debian_based_en/>
 
-if [ "$#" -ne 2 ]; then
-    echo 'Need domain name and mail as argument.'
+if [ "$#" -ne 3 ]; then
+    echo 'Need domain name and mail and old server IP as argument.'
     false
 fi
 domain="$1"
 mail="$2"
+old_server="$3"
 
 # Install configs, set up firewall.
 config_tree_prefix="${HOME}/config/buster"
@@ -33,4 +34,20 @@ sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/gitweb.conf
 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/website.nginx
 ln -s /etc/nginx/sites-available/website.nginx /etc/nginx/sites-enabled/website.nginx
 
+# Set up website.
+rm -rf /var/www
+mkdir /var/www
+chown plom:plom /var/www
+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 plom "./prepare_to_meet_server.sh ${old_server}"
+read -p'Hit Enter when you are done.' ignore
+su -lc plom "cd /var/repos && git clone --mirror ${old_server}/repos/website"
+cp "${config_tree_prefix}/other_files/website_hook_post-receive /var/repos/website.git/hooks/post-receive"
+su -lc plom 'cd /var/www && git clone /var/repos/website.git .'
+
+# TODO:
+# - commit git-daemon-export-ok directly into the public repos; rename
+#   /home/plom/public_repos to /home/plom/repos
+
 service nginx restart