From 47211a6ea85630d6c1e1dcdbb72057af15eb7505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Zolt=C3=A1n?= Date: Thu, 7 Mar 2024 18:37:44 +0100 Subject: [PATCH] Minor improvements. --- .metadata | Bin 4636 -> 4636 bytes .templates/nginx/nginx.conf | 16 +++++++++------- tools/backup.d/configs_backup.sh | 6 ++++-- tools/customize_nginx.sh | 29 ++++++++++++++++++----------- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.metadata b/.metadata index 5024a265609293ddd0195a3573c4e99bf7542d8d..313f677171db911e972c03f5964fcc4d5ef97e4b 100644 GIT binary patch delta 159 zcmbQEGDl^@21Xv9KQB`mfZ$%XuJYtPj14>!UcLegG${D%PLAf1o2<((I=Px@0;)tK zkL+X+*|Eu4bCR^3SqA zW#U1RiT}7Kzh`HgY{D$gr2KYrBeU4%Wab|%EN#q2iJRj&1Q;iCa0^UsSorry something went wrong. Try again a bit later.
You may report this at $server_admin."; } - - # No static service. + # No static service, but we may provide the OPTIONS for a potential DAV client. # location / { -# default_type text/html; -# return 404 "Sorry try $scheme://$server_name/$PAR_LOCATION instead."; +# default_type text/html; +## dav_ext_methods OPTIONS; +# if ($request_method != OPTIONS) { +# return 404 "Sorry try $scheme://$server_name/$PAR_LOCATION instead."; +## return 302 $scheme://$server_name/$PAR_LOCATION; # } ################################################################################## diff --git a/tools/backup.d/configs_backup.sh b/tools/backup.d/configs_backup.sh index 96c3395..fa19fda 100755 --- a/tools/backup.d/configs_backup.sh +++ b/tools/backup.d/configs_backup.sh @@ -3,8 +3,10 @@ # Backups the configuration files of this docker-composed service. # This is a general purpose worker script, doesn't requires customization. # -# Author: Kovács Zoltán +# Author: Kovács Zoltán # License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html) +# 2024-03-07 v0.2 +# fix: tar now dereferences the symlinks (if any). # 2021-09-03 v0.1 Initial release # Accepted environment variables and their defaults. @@ -69,7 +71,7 @@ BACKUPDIR="${PAR_BACKUPDIR:-$BASE_DIR/$BACKUPDIR}" if [ -w "$BACKUPDIR" ]; then BACKUP_NAME="configs.$("$DATE" '+%Y%m%d_%H%M%S').$("$HOSTNAME")" ( cd "$BASE_DIR" - "$TAR" czf "$BACKUPDIR/$BACKUP_NAME.tgz" \ + "$TAR" czhf "$BACKUPDIR/$BACKUP_NAME.tgz" \ "$YMLFILE" configs docker \ 2>>"$BACKUPDIR/$BACKUP_NAME.log" ) diff --git a/tools/customize_nginx.sh b/tools/customize_nginx.sh index b2c746d..7efd503 100644 --- a/tools/customize_nginx.sh +++ b/tools/customize_nginx.sh @@ -1,20 +1,27 @@ #!/bin/bash -# -# Set the variables below then run this script to generate the config/nginx.conf -# (the webserver configuration file for this service). Take a revision then -# symlink it into the instances/.nginx folder and reload the webserver to activate. + +PAR_SERVICENAME= +PAR_PROXYHOST="localhost" +PAR_PROXYPORT="8201" +PAR_SERVERNAME="myservice.example.com" +PAR_LOCATION= +PAR_WEBMASTER="webmaster@example.com" # Valid support email address + +################################################################################ +# There is nothing to change below this line (I hope) +################################################################################ PAR_ACMEHOST="localhost" PAR_ACMEPORT="8100" -PAR_SERVICE="$HOME/services/servicename" -PAR_PROXYHOST="localhost" -PAR_PROXYPORT="8201" -PAR_SERVERNAME="www.example.com" -PAR_LOCATION="" +PAR_SERVICE="$HOME/services/$PAR_SERVICENAME" -# Do not change anything below. -PARAMETERS='$PAR_ACMEHOST:$PAR_ACMEPORT:$PAR_SERVICE:$PAR_PROXYHOST:$PAR_PROXYPORT:$PAR_SERVERNAME:$PAR_LOCATION' +PARAMETERS='$PAR_ACMEHOST:$PAR_ACMEPORT:$PAR_SERVICE:$PAR_PROXYHOST:$PAR_PROXYPORT:$PAR_SERVERNAME:$PAR_LOCATION:$PAR_WEBMASTER' for parameter in $(echo "$PARAMETERS" | tr ":" "\n") do export ${parameter:1}; done cat "$PAR_SERVICE/.templates/nginx/nginx.conf" | envsubst "$PARAMETERS" \ > "$PAR_SERVICE/configs/nginx.conf" + +touch $PAR_SERVICE/logs/web/access.log $PAR_SERVICE/logs/web/error.log +chmod 660 $PAR_SERVICE/logs/web/access.log $PAR_SERVICE/logs/web/error.log +[[ ! -a "$PAR_SERVICE/../.nginx/$PAR_SERVICENAME.conf" ]] \ +&& ln -s "../$PAR_SERVICENAME/configs/nginx.conf" "$PAR_SERVICE/../.nginx/$PAR_SERVICENAME.conf"