commit 12eecb0147cdc40012eba2fc8260d479ff98a56f
parent e62c1d1d4baef14440575f2fd3aec06751d0f7d8
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date: Thu, 13 Aug 2020 13:36:12 +0200
No more downtime on website rebuild
It was only about half a second, but now if site gets bigger and Hugo
takes longer, this won't be an issue.
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/website-deployment/deploy-website.sh b/website-deployment/deploy-website.sh
@@ -18,7 +18,8 @@
# Script to deploy a website built with Hugo.
-HUGO_PATH="/srv/oscarbenedito.com"
+HUGO_PATH="/root/oscarbenedito.com"
+WEB_PATH="/srv/oscarbenedito.com"
GOTIFY_DOMAIN="gotify.oscarbenedito.com"
FILE_DIR="$(dirname "$(realpath "$0")")"
@@ -28,7 +29,8 @@ git -C $HUGO_PATH verify-commit master || exit 1
rm -rf $HUGO_PATH/public
rm -rf $HUGO_PATH/resources
hugo -s $HUGO_PATH --gc
-$FILE_DIR/post-hugo-script.py $FILE_DIR/post_hugo_script.json
+$FILE_DIR/post-hugo-script.py "$FILE_DIR/post_hugo_script.json"
+rsync --perms --recursive --checksum --delete "$HUGO_PATH/public/" "$WEB_PATH"
API_TOKEN="$(cat "$FILE_DIR/website_api_token.txt")"
TITLE="Web update triggered"
diff --git a/website-deployment/post-hugo-script.py b/website-deployment/post-hugo-script.py
@@ -22,7 +22,7 @@ import re
import json
import shutil
-HUGO_OUT_DIR = '/srv/oscarbenedito.com/public'
+HUGO_OUT_DIR = '/root/oscarbenedito.com/public'
if len(sys.argv) != 2:
print("Usage:\n", sys.argv[0], "file.json")