diff --git a/CHANGELOG.md b/CHANGELOG.md index cf4f1a0c1..fdceb6411 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,10 @@ ## Next release - Prevent showing error message when testing for old versions during upgrade - In the email notification, sent to admins on account creation, show the group of the user +- More explanations in the setup script +- Send pre-compressed assets to the browsers instead of the regular ones - Fix a bug: subscriptions tab is selected by default in statistics, even if the module is disabled +- [TODO DEPLOY] `\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/nginx-packs-directive.sh | bash` ## v4.7.5 2021 March 08 - Fix a bug: unable to compile the assets during the upgrade, if the env file has some whitespaces around the equal sign diff --git a/scripts/nginx-packs-directive.sh b/scripts/nginx-packs-directive.sh new file mode 100644 index 000000000..163e2cd4e --- /dev/null +++ b/scripts/nginx-packs-directive.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +yq() { + docker run --rm -i -v "${NGINX_PATH}:/workdir" mikefarah/yq:4 "$@" +} + +config() +{ + if [ "$(whoami)" = "root" ] + then + echo "It is not recommended to run this script as root. As a normal user, elevation will be prompted if needed." + [[ "$YES_ALL" = "true" ]] && confirm="y" || read -rp "Continue anyway? (Y/n) " confirm " nginxpath /dev/null +} + + +docker_restart() +{ + docker-compose -f "$NGINX_PATH/docker-compose.yml" restart "$SERVICE" +} + +function trap_ctrlc() +{ + echo "Ctrl^C, exiting..." + exit 2 +} + +upgrade_directive() +{ + trap "trap_ctrlc" 2 # SIGINT + config + proceed_upgrade + docker_restart + printf "upgrade complete\n" +} + +upgrade_directive "$@" diff --git a/setup/env.example b/setup/env.example index 5b1ea8cb3..ce1bd79ba 100644 --- a/setup/env.example +++ b/setup/env.example @@ -9,7 +9,7 @@ SLOT_DURATION=60 FEATURE_TOUR_DISPLAY=once DEFAULT_HOST=demo.fab-manager.com -DEFAULT_PROTOCOL=http +DEFAULT_PROTOCOL=https DELIVERY_METHOD=smtp SMTP_ADDRESS=smtp.sendgrid.net diff --git a/setup/nginx.conf.example b/setup/nginx.conf.example index 7bb368ebb..22ad49cb6 100644 --- a/setup/nginx.conf.example +++ b/setup/nginx.conf.example @@ -7,7 +7,7 @@ server { server_name MAIN_DOMAIN; root /usr/src/app/public; - location ^~ /assets/ { + location ^~ /packs/ { gzip_static on; expires max; add_header Cache-Control public; @@ -43,7 +43,7 @@ server { root /usr/src/app/public/; rewrite ^(.*)$ /maintenance.html break; } - + location /.well-known/acme-challenge { root /etc/letsencrypt/webrootauth; default_type "text/plain"; diff --git a/setup/nginx_with_ssl.conf.example b/setup/nginx_with_ssl.conf.example index 59d9f6be4..305bc84b5 100644 --- a/setup/nginx_with_ssl.conf.example +++ b/setup/nginx_with_ssl.conf.example @@ -28,7 +28,7 @@ server { ssl_stapling_verify on; - location ^~ /assets/ { + location ^~ /packs/ { gzip_static on; expires max; add_header Cache-Control public; diff --git a/setup/setup.sh b/setup/setup.sh index 142d2e6ae..17aad2a7c 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -68,16 +68,18 @@ config() { SERVICE="fabmanager" echo 'We recommend nginx to serve the application over the network (internet). You can use your own solution or let this script install and configure nginx for Fab-manager.' + printf 'If you want to setup install Fab-manager behind a reverse proxy, you may not need to install the integrated nginx.\n' read -rp 'Do you want install nginx? (Y/n) ' NGINX