From a527d2a60bbd8eb4f08cd253fe4ba94c62961222 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 25 Mar 2022 23:09:04 +0700 Subject: [PATCH] Moving to two domains... --- conf/.env | 2 +- conf/nginx.conf | 24 +----------------------- conf/nginx_console.conf | 21 +++++++++++++++++++++ manifest.json | 14 +++++++++----- scripts/_common.sh | 18 ------------------ scripts/backup | 1 + scripts/install | 4 +++- scripts/remove | 1 + scripts/restore | 1 + scripts/upgrade | 1 + 10 files changed, 39 insertions(+), 48 deletions(-) create mode 100644 conf/nginx_console.conf diff --git a/conf/.env b/conf/.env index 313b1a9..127ab4e 100644 --- a/conf/.env +++ b/conf/.env @@ -1,5 +1,5 @@ MINIO_ROOT_USER=__APP__ MINIO_ROOT_PASSWORD=__MINIO_KEY__ MINIO_VOLUMES="__DATADIR__/" -MINIO_BROWSER_REDIRECT_URL=https://__DOMAIN__ +MINIO_BROWSER_REDIRECT_URL=https://__CONSOLE_DOMAIN__ MINIO_OPTS="-C __FINAL_PATH__/ --address 127.0.0.1:__PORT__ --console-address :__CONSOLE_PORT__" diff --git a/conf/nginx.conf b/conf/nginx.conf index 1e22b95..44fd264 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,4 @@ -location /server/ { +location / { # Force usage of https if ($scheme = http) { @@ -19,25 +19,3 @@ location /server/ { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } - -location / { - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - - proxy_pass http://127.0.0.1:__CONSOLE_PORT__/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_cache_bypass $http_upgrade; - proxy_ignore_client_abort on; - client_max_body_size 200M; - - # forward headers - proxy_buffering off; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; -} diff --git a/conf/nginx_console.conf b/conf/nginx_console.conf new file mode 100644 index 0000000..3be2394 --- /dev/null +++ b/conf/nginx_console.conf @@ -0,0 +1,21 @@ +location / { + + # Force usage of https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + + proxy_pass http://127.0.0.1:__CONSOLE_PORT__/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_cache_bypass $http_upgrade; + proxy_ignore_client_abort on; + client_max_body_size 200M; + + # forward headers + proxy_buffering off; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 5998506..308bcfb 100644 --- a/manifest.json +++ b/manifest.json @@ -29,13 +29,17 @@ "install" : [ { "name": "domain", - "type": "domain" + "type": "domain", + "example": "minio.domain.tld", + "ask": "Enter a domain for MinIO server. This has to be a fully dedicated domain" }, { - "name": "is_public", - "type": "boolean", - "default": true - } + "name": "console_domain", + "type": "domain", + "example": "console.minio.domain.tld", + "ask": "Enter a domain for MinIO console. This has to be a fully dedicated domain", + "optional": true + }, ] } } diff --git a/scripts/_common.sh b/scripts/_common.sh index 94c90e8..a9bf588 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,19 +1 @@ #!/bin/bash - -#================================================= -# COMMON VARIABLES -#================================================= - -# dependencies used by the app - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index f4db696..723667e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) +console_domain=$(ynh_app_setting_get --app=$app --key=console_domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) datadir=$(ynh_app_setting_get --app=$app --key=datadir) mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) diff --git a/scripts/install b/scripts/install index 62fd48b..46c3caf 100755 --- a/scripts/install +++ b/scripts/install @@ -25,8 +25,9 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN +console_domain=$YNH_APP_ARG_CONSOLE_DOMAIN path_url="/" -is_public=$YNH_APP_ARG_IS_PUBLIC +is_public=1 minio_key=$(ynh_string_random) architecture=$YNH_ARCH @@ -51,6 +52,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=console_domain --value=$console_domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=minio_key --value=$minio_key ynh_app_setting_set --app=$app --key=mc_path --value=$mc_path diff --git a/scripts/remove b/scripts/remove index 8d04375..18b61b8 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,6 +17,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) +console_domain=$(ynh_app_setting_get --app=$app --key=console_domain) port=$(ynh_app_setting_get --app=$app --key=port) console_port=$(ynh_app_setting_get --app=$app --key=console_port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) diff --git a/scripts/restore b/scripts/restore index cce485a..3c185ed 100755 --- a/scripts/restore +++ b/scripts/restore @@ -29,6 +29,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) +console_domain=$(ynh_app_setting_get --app=$app --key=console_domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) datadir=$(ynh_app_setting_get --app=$app --key=datadir) diff --git a/scripts/upgrade b/scripts/upgrade index aba24b8..8e17d4c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,6 +17,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) +console_domain=$(ynh_app_setting_get --app=$app --key=console_domain) port=$(ynh_app_setting_get --app=$app --key=port) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)