From 4d2ab6a3f21d94f5d31cb9b72e17c906307b4c1b Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 17:24:53 +0700 Subject: [PATCH 01/27] SMTP checks + better secret keys handling --- conf/.env | 16 ++++++++-------- scripts/install | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/conf/.env b/conf/.env index 768da68..8429ab6 100644 --- a/conf/.env +++ b/conf/.env @@ -10,11 +10,11 @@ # Generate a hex-encoded 32-byte random key. You should use `openssl rand -hex 32` # in your terminal to generate a random value. -SECRET_KEY=53b654d84c820573dc19e86d09c4c47d44c17b32055154a0cbc75efc5aee00fb +SECRET_KEY=__SECRET_KEY__ # Generate a unique random key. The format is not important but you could still use # `openssl rand -hex 32` in your terminal to produce this. -UTILS_SECRET=7cbd5fbf647a8f85f06560c6dad74d2eee21fd4e1889f91dabb7dd873c7428be +UTILS_SECRET=__UTILS_SECRET__ # For production point these at your databases, in development the default # should work out of the box. @@ -139,14 +139,14 @@ SENTRY_DSN= # To support sending outgoing transactional emails such as "document updated" or # "you've been invited" you'll need to provide authentication for an SMTP server -SMTP_HOST=127.0.0.1 -SMTP_PORT=465 +SMTP_HOST='localhost' +SMTP_PORT='25' SMTP_USERNAME='' SMTP_PASSWORD='' -SMTP_FROM_EMAIL=outline@__DOMAIN__ -SMTP_REPLY_EMAIL=outline@__DOMAIN__ -SMTP_TLS_CIPHERS= -SMTP_SECURE=false +SMTP_FROM_EMAIL='__APP__@__DOMAIN__' +SMTP_REPLY_EMAIL='webmaster@__DOMAIN__' +SMTP_TLS_CIPHERS='' +SMTP_SECURE='true' # Custom logo that displays on the authentication screen, scaled to height: 60px # TEAM_LOGO=https://example.com/images/logo.png diff --git a/scripts/install b/scripts/install index 3275a8b..0c4d965 100755 --- a/scripts/install +++ b/scripts/install @@ -37,6 +37,8 @@ else language_key="en_US" fi +secret_key=`openssl rand -hex 32` +utils_secret=`openssl rand -hex 32` slackkey=$YNH_APP_ARG_SLACKKEY slacksecret=$YNH_APP_ARG_SLACKSECRET @@ -67,6 +69,8 @@ ynh_script_progression --message="Storing installation settings..." --time --wei ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key +ynh_app_setting_set --app=$app --key=utils_secret --value=$utils_secret #================================================= # STANDARD MODIFICATIONS From eeaf6d068eac65d29dbe34efbd204c3488a6ec99 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 17:27:41 +0700 Subject: [PATCH 02/27] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 0c4d965..120e91d 100755 --- a/scripts/install +++ b/scripts/install @@ -47,8 +47,8 @@ slacksecret=$YNH_APP_ARG_SLACKSECRET app=$YNH_APP_INSTANCE_NAME minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) -minio_id=$(ynh_app_setting_get --app="minio" --key=id) -minio_key=$(ynh_app_setting_get --app="minio" --key=key) +minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id) +minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS From 9252495ce51cc289e59852a11e351ee22404a2f9 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 17:34:46 +0700 Subject: [PATCH 03/27] Better guidance for Slack Client ID and Secret --- conf/.env | 4 ++-- manifest.json | 10 ++++++---- scripts/install | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/conf/.env b/conf/.env index 8429ab6..3493027 100644 --- a/conf/.env +++ b/conf/.env @@ -57,8 +57,8 @@ AWS_S3_ACL=private # # When configuring the Client ID, add a redirect URL under "OAuth & Permissions": # https:///auth/slack.callback -SLACK_KEY=__SLACKKEY__ -SLACK_SECRET=__SLACKSECRET__ +SLACK_KEY=__SLACK_KEY__ +SLACK_SECRET=__SLACK_SECRET__ # To configure Google auth, you'll need to create an OAuth Client ID at # => https://console.cloud.google.com/apis/credentials diff --git a/manifest.json b/manifest.json index db51d29..62eaa3e 100644 --- a/manifest.json +++ b/manifest.json @@ -49,12 +49,14 @@ "default": "en" }, { - "name": "slackkey", - "type": "string" + "name": "slack_key", + "type": "string", + "ask": "Slack Client ID (from https://api.slack.com/apps)" }, { - "name": "slacksecret", - "type": "string" + "name": "slack_secret", + "type": "string", + "ask": "Slack Client Secret (from https://api.slack.com/apps)" } ] } diff --git a/scripts/install b/scripts/install index 120e91d..386dbf0 100755 --- a/scripts/install +++ b/scripts/install @@ -40,8 +40,8 @@ fi secret_key=`openssl rand -hex 32` utils_secret=`openssl rand -hex 32` -slackkey=$YNH_APP_ARG_SLACKKEY -slacksecret=$YNH_APP_ARG_SLACKSECRET +slack_key=$YNH_APP_ARG_SLACK_KEY +slack_secret=$YNH_APP_ARG_SLACK_SECRET app=$YNH_APP_INSTANCE_NAME From eaef4122dfdf0ae4e91af8e5a58fba40521b828b Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 17:47:03 +0700 Subject: [PATCH 04/27] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 386dbf0..3b67516 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -if [$language == "fr"] +if $language == "fr" then language_key="fr_FR" else @@ -148,7 +148,7 @@ ynh_add_nginx_config #================================================= # BUILD YARN DEPENDENCIES #================================================= -ynh_script_progression --message="Building Yarn dependencies..." +ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" pushd "$final_path" ynh_use_nodejs From 00e50a1ff78f1bbc188b021b7c753994beb3a50a Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 18:05:09 +0700 Subject: [PATCH 05/27] Correct language test --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 3b67516..11a0fb9 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -if $language == "fr" +if [["$language" == "fr"]] then language_key="fr_FR" else From 4b8591688ec8bf49763289b9dcf4ac55edaf9fc7 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 18:06:48 +0700 Subject: [PATCH 06/27] Correct test --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 11a0fb9..0f60c8a 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -if [["$language" == "fr"]] +if [["$language" = "fr"]] then language_key="fr_FR" else From 950a9a6c4a8f954c9346659bb7fb9d4e7b172b8c Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 18:08:50 +0700 Subject: [PATCH 07/27] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 0f60c8a..b675cec 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -if [["$language" = "fr"]] +if [["$language" == "fr"]]; then language_key="fr_FR" else From 38c9953d4a64f208d72d4da5eaaedb9ac3edd210 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 18:10:44 +0700 Subject: [PATCH 08/27] Update install --- scripts/install | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index b675cec..32e193e 100755 --- a/scripts/install +++ b/scripts/install @@ -30,11 +30,12 @@ is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -if [["$language" == "fr"]]; -then +if [["$language" == "fr"]]; then language_key="fr_FR" + echo "French" else language_key="en_US" + echo "English" fi secret_key=`openssl rand -hex 32` From d0f24ccb707c2a2c5ece4fc6a394b894bd5c8c8e Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 18:15:19 +0700 Subject: [PATCH 09/27] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 32e193e..5366c35 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -if [["$language" == "fr"]]; then +if [ $language == "fr" ]; then language_key="fr_FR" echo "French" else From 32aa379c780014c2def8fb13ba1ee44421c8359e Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 23:50:33 +0700 Subject: [PATCH 10/27] Update manifest.json --- manifest.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 62eaa3e..3815913 100644 --- a/manifest.json +++ b/manifest.json @@ -31,7 +31,8 @@ "install" : [ { "name": "domain", - "type": "domain" + "type": "domain", + "ask": "Domain used for Outline installation." }, { "name": "is_public", @@ -57,6 +58,16 @@ "name": "slack_secret", "type": "string", "ask": "Slack Client Secret (from https://api.slack.com/apps)" + }, + { + "name": "is_minio", + "type": "boolean", + "ask": "Is MinIO app already installed on your instance ?" + }, + { + "name": "minio_domain", + "type": "domain", + "ask": "If MinIO app is already installed, you don't need to fill-in that field.\nIf it isn't please give a domain that can be used for MinIO installation (MinIO has to be installed at the root of a domain)" } ] } From 3ca4c8389296680ccfe340c524c02ce062b65270 Mon Sep 17 00:00:00 2001 From: Limezy Date: Tue, 9 Nov 2021 23:54:30 +0700 Subject: [PATCH 11/27] Update manifest.json --- manifest.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 3815913..1199903 100644 --- a/manifest.json +++ b/manifest.json @@ -32,7 +32,6 @@ { "name": "domain", "type": "domain", - "ask": "Domain used for Outline installation." }, { "name": "is_public", @@ -67,7 +66,7 @@ { "name": "minio_domain", "type": "domain", - "ask": "If MinIO app is already installed, you don't need to fill-in that field.\nIf it isn't please give a domain that can be used for MinIO installation (MinIO has to be installed at the root of a domain)" + "ask": "If MinIO app is already installed, you don't need to fill-in that field.\nIf it isn't please give a domain that can be used for MinIO installation (MinIO has to be installed at the root of a domain)\nIf MinIO is alraedy installed, you can leave this field empty." } ] } From 76ec7b02b661bd0d54460df593be9ff20a03bd1f Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:17:02 +0700 Subject: [PATCH 12/27] Check if MinIO is installed or not --- manifest.json | 7 +------ scripts/install | 12 ++++++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/manifest.json b/manifest.json index 1199903..9c28f13 100644 --- a/manifest.json +++ b/manifest.json @@ -58,15 +58,10 @@ "type": "string", "ask": "Slack Client Secret (from https://api.slack.com/apps)" }, - { - "name": "is_minio", - "type": "boolean", - "ask": "Is MinIO app already installed on your instance ?" - }, { "name": "minio_domain", "type": "domain", - "ask": "If MinIO app is already installed, you don't need to fill-in that field.\nIf it isn't please give a domain that can be used for MinIO installation (MinIO has to be installed at the root of a domain)\nIf MinIO is alraedy installed, you can leave this field empty." + "ask": "Is MinIO app already installed ?\nIf yes, you can leave that field blank.\nIf not please give a domain that can be used for MinIO installation.\nPlease note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" } ] } diff --git a/scripts/install b/scripts/install index 5366c35..77985e5 100755 --- a/scripts/install +++ b/scripts/install @@ -44,9 +44,17 @@ utils_secret=`openssl rand -hex 32` slack_key=$YNH_APP_ARG_SLACK_KEY slack_secret=$YNH_APP_ARG_SLACK_SECRET - app=$YNH_APP_INSTANCE_NAME +#================================================= +# CHECK IF MINIO IS INSTALLED, IF NOT INSTALL IT +#================================================= +ynh_script_progression --message="Installing MinIO if needed..." --time --weight=1 + +if ! ynh_package_is_installed --package="minio"; then + yunohost tools update + yunohost app install minio --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&language=en" + minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id) minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) @@ -149,7 +157,7 @@ ynh_add_nginx_config #================================================= # BUILD YARN DEPENDENCIES #================================================= -ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" +ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --time --weight=10 pushd "$final_path" ynh_use_nodejs From 9d8bd24b1e9fc441af1d3b5f7d6f157578e76ff9 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:18:27 +0700 Subject: [PATCH 13/27] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 9c28f13..8e72016 100644 --- a/manifest.json +++ b/manifest.json @@ -31,7 +31,7 @@ "install" : [ { "name": "domain", - "type": "domain", + "type": "domain" }, { "name": "is_public", From 372469fef225f51ba7a5e4a21daa7030bc63cee7 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:21:32 +0700 Subject: [PATCH 14/27] Updates --- manifest.json | 2 +- scripts/install | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 8e72016..fed7459 100644 --- a/manifest.json +++ b/manifest.json @@ -61,7 +61,7 @@ { "name": "minio_domain", "type": "domain", - "ask": "Is MinIO app already installed ?\nIf yes, you can leave that field blank.\nIf not please give a domain that can be used for MinIO installation.\nPlease note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" + "ask": "Domain for MinIO app.\nIf MinIO is not yet installed, outline will automatically install it for you.\nPlease note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" } ] } diff --git a/scripts/install b/scripts/install index 77985e5..c144ccf 100755 --- a/scripts/install +++ b/scripts/install @@ -54,6 +54,7 @@ ynh_script_progression --message="Installing MinIO if needed..." --time --weight if ! ynh_package_is_installed --package="minio"; then yunohost tools update yunohost app install minio --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&language=en" +fi minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id) From 86a6556590735b97de57efd39e3af7cd78cd2eab Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:22:24 +0700 Subject: [PATCH 15/27] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index fed7459..180eccd 100644 --- a/manifest.json +++ b/manifest.json @@ -61,7 +61,7 @@ { "name": "minio_domain", "type": "domain", - "ask": "Domain for MinIO app.\nIf MinIO is not yet installed, outline will automatically install it for you.\nPlease note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" + "ask": "Domain for MinIO app.\n\nIf MinIO is not yet installed, outline will automatically install it for you.\n\nPlease note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" } ] } From 4adeeb6de49c7064594f8df83ff2d123ed5dbd66 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:23:17 +0700 Subject: [PATCH 16/27] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 180eccd..30426bb 100644 --- a/manifest.json +++ b/manifest.json @@ -61,7 +61,7 @@ { "name": "minio_domain", "type": "domain", - "ask": "Domain for MinIO app.\n\nIf MinIO is not yet installed, outline will automatically install it for you.\n\nPlease note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" + "ask": "Domain for MinIO app.
If MinIO is not yet installed, outline will automatically install it for you.
Please note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" } ] } From 91c4edb21663df0257d9e75f28dac297f15363bd Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:25:57 +0700 Subject: [PATCH 17/27] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 30426bb..4ff498d 100644 --- a/manifest.json +++ b/manifest.json @@ -61,7 +61,7 @@ { "name": "minio_domain", "type": "domain", - "ask": "Domain for MinIO app.
If MinIO is not yet installed, outline will automatically install it for you.
Please note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" + "ask": "Domain for MinIO app. If MinIO is not yet installed, outline will automatically install it for you. Please note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" } ] } From 4ec8627a5a15c27fec9a6aaa5056089a43f70635 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:27:40 +0700 Subject: [PATCH 18/27] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c144ccf..f8c5549 100755 --- a/scripts/install +++ b/scripts/install @@ -53,7 +53,7 @@ ynh_script_progression --message="Installing MinIO if needed..." --time --weight if ! ynh_package_is_installed --package="minio"; then yunohost tools update - yunohost app install minio --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&language=en" + yunohost app install https://github.com/limezy/minio_ynh --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&language=en" fi minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) From e7db80f1f921b1a6a1490ad4f23634ce641be09f Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:31:27 +0700 Subject: [PATCH 19/27] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index f8c5549..bdf4942 100755 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_script_progression --message="Installing MinIO if needed..." --time --weight=1 -if ! ynh_package_is_installed --package="minio"; then +if ! ynh_app_is_installed --package="minio"; then yunohost tools update yunohost app install https://github.com/limezy/minio_ynh --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&language=en" fi From 5596167e13973b19d3c5cc3e61963df330d907b7 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:37:33 +0700 Subject: [PATCH 20/27] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index bdf4942..7565744 100755 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_script_progression --message="Installing MinIO if needed..." --time --weight=1 -if ! ynh_app_is_installed --package="minio"; then +if ! yunohost app list | grep -q "id: minio"; then yunohost tools update yunohost app install https://github.com/limezy/minio_ynh --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&language=en" fi From 071f56b4331c0da11549fd546c83e87de43177dc Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:38:07 +0700 Subject: [PATCH 21/27] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 7565744..fa55fc5 100755 --- a/scripts/install +++ b/scripts/install @@ -52,6 +52,7 @@ app=$YNH_APP_INSTANCE_NAME ynh_script_progression --message="Installing MinIO if needed..." --time --weight=1 if ! yunohost app list | grep -q "id: minio"; then + echo "MinIO is not installed. Installing... " yunohost tools update yunohost app install https://github.com/limezy/minio_ynh --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&language=en" fi From e2d451b47a18b0abb139107799ae8cad209159dc Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:47:53 +0700 Subject: [PATCH 22/27] Add idiot-proof check --- scripts/install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install b/scripts/install index fa55fc5..2726b57 100755 --- a/scripts/install +++ b/scripts/install @@ -54,6 +54,9 @@ ynh_script_progression --message="Installing MinIO if needed..." --time --weight if ! yunohost app list | grep -q "id: minio"; then echo "MinIO is not installed. Installing... " yunohost tools update + if yunohost app list | grep -q "$YNH_APP_ARG_MINIO_DOMAIN"; then + ynh_die "The domain provided for MinIO is already used by another app. Please chose another one !" + fi yunohost app install https://github.com/limezy/minio_ynh --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&language=en" fi From 4c01ba44ce0663dfa06d35a0a1aad757b20b5fd4 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 00:58:57 +0700 Subject: [PATCH 23/27] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 4ff498d..160eed8 100644 --- a/manifest.json +++ b/manifest.json @@ -61,7 +61,7 @@ { "name": "minio_domain", "type": "domain", - "ask": "Domain for MinIO app. If MinIO is not yet installed, outline will automatically install it for you. Please note that MinIO has to be installed at the root of that domain : no other apps can be installed on that domain" + "ask": "Domain for MinIO app. If MinIO is not yet installed, outline will automatically install it for you. Please note that this domain has to be free from any app" } ] } From db4403f73ec797b0fc08ce6968d9120f13d6c07d Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 01:02:03 +0700 Subject: [PATCH 24/27] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 160eed8..082c47a 100644 --- a/manifest.json +++ b/manifest.json @@ -61,7 +61,7 @@ { "name": "minio_domain", "type": "domain", - "ask": "Domain for MinIO app. If MinIO is not yet installed, outline will automatically install it for you. Please note that this domain has to be free from any app" + "ask": "Domain for MinIO app (if you don't have MinIO yet, it will automatically be added while installing Outline). Please note that this domain has to be free from any app" } ] } From 63b38d660c58b36d6239c4cd2b875818abb3d9b9 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 01:02:56 +0700 Subject: [PATCH 25/27] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 082c47a..a4ab01b 100644 --- a/manifest.json +++ b/manifest.json @@ -61,7 +61,7 @@ { "name": "minio_domain", "type": "domain", - "ask": "Domain for MinIO app (if you don't have MinIO yet, it will automatically be added while installing Outline). Please note that this domain has to be free from any app" + "ask": "Domain for MinIO app (if not yet installed, it will automatically be). Please note that this domain has to be free from any app" } ] } From cf199541c8dd794959a0d3934406072d45310bc3 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 01:18:06 +0700 Subject: [PATCH 26/27] Updates MinIO --- conf/.env | 2 +- conf/mc.src | 7 +++++++ scripts/install | 29 +++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 conf/mc.src diff --git a/conf/.env b/conf/.env index 3493027..96efe5e 100644 --- a/conf/.env +++ b/conf/.env @@ -39,7 +39,7 @@ PORT=__PORT__ AWS_ACCESS_KEY_ID=__MINIO_ID__ AWS_SECRET_ACCESS_KEY=__MINIO_KEY__ AWS_REGION=fr-ynh-1 -AWS_S3_UPLOAD_BUCKET_URL=__MINIO_DOMAIN__ +AWS_S3_UPLOAD_BUCKET_URL=https://__MINIO_DOMAIN__ AWS_S3_UPLOAD_BUCKET_NAME=outlinestorage AWS_S3_UPLOAD_MAX_SIZE=26214400 AWS_S3_FORCE_PATH_STYLE=true diff --git a/conf/mc.src b/conf/mc.src new file mode 100644 index 0000000..8f12cdd --- /dev/null +++ b/conf/mc.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://dl.min.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2021-11-05T10-05-06Z +SOURCE_SUM=9f5ad72fd93678f9f756c6da34a8d4d1e61f7356a96ee327c652ad765975d2b2 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT= +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=mc +SOURCE_EXTRACT=false diff --git a/scripts/install b/scripts/install index 2726b57..e93491d 100755 --- a/scripts/install +++ b/scripts/install @@ -72,6 +72,8 @@ ynh_script_progression --message="Validating installation parameters..." --time final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +mc_path=$final_path/mc + # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -151,6 +153,32 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# DOWNLOAD, CHECK AND UNPACK MINIO CLIENT +#================================================= +ynh_script_progression --message="Setting up MinIO client..." --time --weight=1 + +ynh_setup_source --dest_dir="$mc_path" --source_id=mc + +# FIXME: this should be managed by the core in the future +# Here, as a packager, you may have to tweak the ownerhsip/permissions +# such that the appropriate users (e.g. maybe www-data) can access +# files in some cases. +# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - +# this will be treated as a security issue. +chmod -R 750 "$mc_path" +chmod -R o-rwx "$mc_path" +chown -R $app:www-data "$mc_path" + +#================================================= +# SETUP MINIO BUCKET +#================================================= +ynh_script_progression --message="Setting up MinIO bucket for Outline..." --time --weight=1 + +$mc_path/mc alias set minio "https://$minio_domain" $minio_id $minio_key +$mc_path/mc mb minio/outlinestorage --region "fr-ynh-1" +$mc_path/mc policy set public minio/outlinestorage + #================================================= # NGINX CONFIGURATION #================================================= @@ -159,6 +187,7 @@ ynh_script_progression --message="Configuring NGINX web server..." --time --weig # Create a dedicated NGINX config ynh_add_nginx_config + #================================================= # BUILD YARN DEPENDENCIES #================================================= From d9d60247eeceae003ad7b9915720dad7437ca2a9 Mon Sep 17 00:00:00 2001 From: Limezy Date: Wed, 10 Nov 2021 01:34:06 +0700 Subject: [PATCH 27/27] Update install --- scripts/install | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/install b/scripts/install index e93491d..edf00cb 100755 --- a/scripts/install +++ b/scripts/install @@ -195,10 +195,15 @@ ynh_script_progression --message="Building Yarn dependencies... This can be very pushd "$final_path" ynh_use_nodejs + ynh_script_progression --message="Fetching Yarn dev dependencies... This can be very long, be patient !" --time --weight=5 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --no-optional --frozen-lockfile + ynh_script_progression --message="Cleaning cache... " --time --weight=1 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean + ynh_script_progression --message="Building Yarn dev dependencies... This can be very long, be patient !" --time --weight=5 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build + ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --time --weight=5 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production=true --frozen-lockfile + ynh_script_progression --message="Cleaning cache... " --time --weight=1 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean popd