From d67e09f33412ebcbcb9abcd399ceef93c4e70e12 Mon Sep 17 00:00:00 2001 From: Sumit Date: Sat, 11 Apr 2020 20:17:46 +0200 Subject: [PATCH 1/2] Allowing adding nginx aliases in www/custom.yaml (#1742) with this nginx will keep on proxying requests and serve static content instead of passing this responsibility to proxied server Without this the one needs to run an additional server to server static content on the proxied url --- management/web_update.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/management/web_update.py b/management/web_update.py index 72295c21..e2498e77 100644 --- a/management/web_update.py +++ b/management/web_update.py @@ -159,6 +159,10 @@ def make_domain_config(domain, templates, ssl_certificates, env): nginx_conf_extra += "\n\t\tproxy_pass %s;" % url nginx_conf_extra += "\n\t\tproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;" nginx_conf_extra += "\n\t}\n" + for path, alias in yaml.get("aliases", {}).items(): + nginx_conf_extra += "\tlocation %s {" % path + nginx_conf_extra += "\n\t\talias %s;" % alias + nginx_conf_extra += "\n\t}\n" for path, url in yaml.get("redirects", {}).items(): nginx_conf_extra += "\trewrite %s %s permanent;\n" % (path, url) From f52749b403ec51936dafbf4ef56eca72acb95519 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sat, 11 Apr 2020 20:18:44 +0200 Subject: [PATCH 2/2] Better return codes after errors in the setup scripts (#1741) --- setup/bootstrap.sh | 6 +++--- setup/preflight.sh | 4 ++-- tools/owncloud-restore.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index 238109dc..db596798 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -35,14 +35,14 @@ if [ -z "$TAG" ]; then else echo "This script must be run on a system running Ubuntu 18.04 or Ubuntu 14.04." - exit + exit 1 fi fi # Are we running as root? if [[ $EUID -ne 0 ]]; then echo "This script must be run as root. Did you leave out sudo?" - exit + exit 1 fi # Clone the Mail-in-a-Box repository if it doesn't exist. @@ -73,7 +73,7 @@ if [ "$TAG" != `git describe` ]; then git fetch --depth 1 --force --prune origin tag $TAG if ! git checkout -q $TAG; then echo "Update failed. Did you modify something in `pwd`?" - exit + exit 1 fi echo fi diff --git a/setup/preflight.sh b/setup/preflight.sh index 2547c410..acaf80c9 100644 --- a/setup/preflight.sh +++ b/setup/preflight.sh @@ -4,7 +4,7 @@ if [[ $EUID -ne 0 ]]; then echo echo "sudo $0" echo - exit + exit 1 fi # Check that we are running on Ubuntu 18.04 LTS (or 18.04.xx). @@ -14,7 +14,7 @@ if [ "`lsb_release -d | sed 's/.*:\s*//' | sed 's/18\.04\.[0-9]/18.04/' `" != "U lsb_release -d | sed 's/.*:\s*//' echo echo "We can't write scripts that run on every possible setup, sorry." - exit + exit 1 fi # Check that we have enough memory. diff --git a/tools/owncloud-restore.sh b/tools/owncloud-restore.sh index c93a322c..4b0ba4de 100755 --- a/tools/owncloud-restore.sh +++ b/tools/owncloud-restore.sh @@ -22,7 +22,7 @@ fi if [ ! -f $1/config.php ]; then echo "This isn't a valid backup location" - exit + exit 1 fi echo "Restoring backup from $1"