From 12c8e49bf4d5d0d5f36b657d24cd1bbc13c9c464 Mon Sep 17 00:00:00 2001 From: Limezy Date: Thu, 31 Mar 2022 20:10:45 +0700 Subject: [PATCH 01/18] Update check_process --- check_process | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/check_process b/check_process index 8c37c43..2a2373c 100644 --- a/check_process +++ b/check_process @@ -1,14 +1,16 @@ ;; Test complet + ; pre-install + sudo yunohost domain add dex.domain.tld + sudo yunohost domain add minio.domain.tld ; Manifest domain="domain.tld" - path="/" - language="fr" is_public=1 - password="1Strong-Password" - port="666" - slack_key="slack" - slack_secret="secret" - minio_domain="sub.domain.tld" + language="fr" + dex_domain="dex.domain.tld" + dex_path="/example" + minio_domain="minio.domain.tld" + minio_admin="package_checker" + minio_password="1Strong-Password" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -16,7 +18,7 @@ setup_nourl=0 setup_private=1 setup_public=1 - upgrade=0 + upgrade=1 #upgrade=1 from_commit=CommitHash backup_restore=1 multi_instance=0 From b87431def229cd7388e64b6085a127e8e1838484 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 09:57:51 +0700 Subject: [PATCH 02/18] Linter for CI --- conf/nginx.conf | 6 ------ manifest.json | 9 ++------- scripts/change_url | 16 ++++++++-------- scripts/install | 16 +++++++--------- scripts/remove | 20 ++++++++++---------- scripts/restore | 30 +++++++++++++++--------------- scripts/upgrade | 40 ++++++++++++++++++++-------------------- 7 files changed, 62 insertions(+), 75 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 2967bbf..f9373a8 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,10 +1,4 @@ location / { - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - proxy_pass http://127.0.0.1:__PORT__; proxy_redirect off; proxy_set_header Host $host; diff --git a/manifest.json b/manifest.json index 876e6f1..18cd75d 100644 --- a/manifest.json +++ b/manifest.json @@ -32,8 +32,6 @@ { "name": "domain", "type": "domain", - "example": "wiki.domain.tld", - "ask": "Domain for Outline app. This will be the main domain to access the wiki. Outline has to be installed at the root" }, { "name": "is_public", @@ -53,19 +51,17 @@ { "name": "dex_domain", "type": "domain", - "example": "auth.domain.tld", "ask": "Domain for authentification. It can't be the same domain as above. Dex app will be installed and used for the authentification mechanism" }, { "name": "dex_path", "type": "path", - "example": "/example", - "default": "/example" + "default": "/", + "ask": "Path for authentification url. Please don't use 'auth' as it will break Nginx configuration" }, { "name": "minio_domain", "type": "domain", - "example": "docs.domain.tld", "ask": "Domain for MinIO app, used for images and attachements storage. If not yet installed, it will automatically be. Minio has to be installed at the root" }, { @@ -76,7 +72,6 @@ { "name": "minio_password", "type": "password", - "example": "docs.domain.tld", "ask": "Domain for MinIO app, used for images and attachements storage. Please note that if MinIO is already installed, that setting won't be used" } ] diff --git a/scripts/change_url b/scripts/change_url index fe9c16a..029298a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -49,7 +49,7 @@ oidc_callback=$(ynh_app_setting_get --app="minio" --key=oidc_callback) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -84,14 +84,14 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -112,7 +112,7 @@ fi domain=$new_domain ynh_secure_remove --file="$final_path/.env" -ynh_script_progression --message="Updating the configuration file..." --time --weight=1 +ynh_script_progression --message="Updating the configuration file..." --weight=1 ynh_add_config --template="../conf/.env" --destination="$final_path/.env" @@ -134,14 +134,14 @@ popd #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -155,4 +155,4 @@ ynh_print_info --message="Don't forget to add a new redirction url in your Slack # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index a43884f..b4c4623 100755 --- a/scripts/install +++ b/scripts/install @@ -38,8 +38,8 @@ else echo "English" fi -secret_key=$(ynh_hex_32_random) -utils_secret=$(ynh_hex_32_random) +secret_key=$(ynh_string_random --length=32) +utils_secret=$(ynh_string_random --length=32) app=$YNH_APP_INSTANCE_NAME @@ -70,7 +70,7 @@ ynh_script_progression --message="Installing Dex..." --weight=18 dex_domain=$YNH_APP_ARG_DEX_DOMAIN dex_path=$YNH_APP_ARG_DEX_PATH -oidc_secret=$(ynh_hex_32_random) +oidc_secret=$(ynh_string_random --length=32) oidc_name="Outline" oidc_callback="$domain/auth/oidc.callback" @@ -85,7 +85,7 @@ yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "do #=================================================== ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/opt/yunohost/$app +final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path @@ -125,12 +125,12 @@ ynh_app_setting_set --app=$app --key=port --value=$port ynh_script_progression --message="Installing dependencies..." --weight=1 # Install nodejs -ynh_install_nodejs --nodejs_version=$NODEJS_VERSION +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1 -ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies 2>&1 # Install Yarn -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" 2>&1 #================================================= # CREATE DEDICATED USER @@ -228,8 +228,6 @@ popd #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" - # Create a dedicated systemd config ynh_add_systemd_config diff --git a/scripts/remove b/scripts/remove index ce55a8f..0dc8d21 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -43,14 +43,14 @@ oidc_callback=$(ynh_app_setting_get --app="minio" --key=oidc_callback) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --time --weight=1 + ynh_script_progression --message="Removing $app service integration..." --weight=1 yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -58,7 +58,7 @@ ynh_remove_systemd_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 # Remove the app-specific logrotate config ynh_remove_logrotate @@ -74,7 +74,7 @@ ynh_psql_remove_db --db_user=$db_name --db_name=$db_name #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --time --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -83,7 +83,7 @@ ynh_remove_nodejs #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -91,7 +91,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE MINIO BUCKET #================================================= -ynh_script_progression --message="Removing Outline MinIO bucket..." --time --weight=1 +ynh_script_progression --message="Removing Outline MinIO bucket..." --weight=1 pushd "$mc_path" ynh_exec_warn_less sudo -u minio ./mc rb minio/outlinestorage --force @@ -100,7 +100,7 @@ popd #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config @@ -110,7 +110,7 @@ ynh_remove_nginx_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -121,4 +121,4 @@ ynh_system_user_delete --username=$app ynh_script_progression --message="If you don't need it anymore, don't forget to remove the MinIO app !" ynh_script_progression --message="If you don't need it anymore, don't forget to remove the Dex app !" -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 5b4f4c1..1b35f7a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # CHECK IF MINIO IS INSTALLED, IF NOT WARN USER #================================================= -ynh_script_progression --message="Checking if MinIO is installed..." --time --weight=1 +ynh_script_progression --message="Checking if MinIO is installed..." --weight=1 if ! yunohost app list | grep -q "id: minio"; then ynh_die --message="We can't restore because MinIO is not installed ! Please install MinIO first" @@ -33,7 +33,7 @@ fi #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -59,7 +59,7 @@ oidc_callback=$(ynh_app_setting_get --app="minio" --key=oidc_callback) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=1 test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path" @@ -69,14 +69,14 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" @@ -84,7 +84,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_restore_file --origin_path="$final_path" @@ -110,7 +110,7 @@ ynh_secure_remove --file="$mc_path/outlinestorage" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Install nodejs ynh_install_nodejs --nodejs_version=$NODEJS_VERSION @@ -134,7 +134,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= ynh_secure_remove --file="$final_path/.env" -ynh_script_progression --message="Updating the configuration file..." --time --weight=1 +ynh_script_progression --message="Updating the configuration file..." --weight=1 ynh_add_config --template="../conf/.env" --destination="$final_path/.env" @@ -144,7 +144,7 @@ chown $app:$app "$final_path/.env" #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet @@ -152,28 +152,28 @@ systemctl enable $app.service --quiet #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # RESTORE THE LOGS #================================================= -ynh_script_progression --message="Restoring the logs..." --time --weight=1 +ynh_script_progression --message="Restoring the logs..." --weight=1 ynh_restore_file --origin_path="/var/log/$app/$app.log" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" @@ -182,7 +182,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -190,4 +190,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index b943d2e..38e2c9f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -44,7 +44,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -60,14 +60,14 @@ ynh_abort_if_errors #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" @@ -78,7 +78,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 + ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" @@ -91,7 +91,7 @@ chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -99,7 +99,7 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 +ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies @@ -112,26 +112,26 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st #================================================= # UPGRADE YARN DEPENDENCIES #================================================= -ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --time --weight=10 +ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=10 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_script_progression --message="Fetching Yarn dev dependencies... This can be very long, be patient !" --weight=5 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --no-optional --frozen-lockfile 2>&1 - ynh_script_progression --message="Cleaning cache... " --time --weight=1 + ynh_script_progression --message="Cleaning cache... " --weight=1 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1 - ynh_script_progression --message="Building Yarn dev dependencies... This can be very long, be patient !" --time --weight=5 + ynh_script_progression --message="Building Yarn dev dependencies... This can be very long, be patient !" --weight=5 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build 2>&1 - ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --time --weight=5 + ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --weight=5 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production=true --frozen-lockfile 2>&1 - ynh_script_progression --message="Cleaning cache... " --time --weight=1 + ynh_script_progression --message="Cleaning cache... " --weight=1 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1 popd #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Adding a configuration file..." --time --weight=1 +ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/.env" --destination="$final_path/.env" @@ -151,7 +151,7 @@ popd #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config @@ -161,7 +161,7 @@ ynh_add_systemd_config #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -169,21 +169,21 @@ ynh_use_logrotate --non-append #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -191,4 +191,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of $app completed" --last From 7fd9110f7c935054d9fc8804836279c011e1bf71 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 10:05:06 +0700 Subject: [PATCH 03/18] To remove after checks --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b4c4623..b3d097c 100755 --- a/scripts/install +++ b/scripts/install @@ -54,7 +54,8 @@ if ! yunohost app list | grep -q "id: minio"; then 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/YunoHost-Apps/minio_ynh --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&admin=$YNH_APP_ARG_MINIO_ADMIN&password=$YNH_APP_ARG_MINIO_PASSWORD" + ### FIXME AFTER CI VERIFICATION + yunohost app install https://github.com/Limezy/minio_ynh/tree/ci-compatible --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&admin=$YNH_APP_ARG_MINIO_ADMIN&password=$YNH_APP_ARG_MINIO_PASSWORD" fi minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) From 19fe1e2e8f49e40914cb40cea15685c1290cbc54 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 10:08:34 +0700 Subject: [PATCH 04/18] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 18cd75d..27e5c55 100644 --- a/manifest.json +++ b/manifest.json @@ -31,7 +31,7 @@ "install" : [ { "name": "domain", - "type": "domain", + "type": "domain" }, { "name": "is_public", From f52a9912f3435c69576531efb765d72cfc9e85f1 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 10:29:04 +0700 Subject: [PATCH 05/18] Update install --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index b3d097c..81c8d7a 100755 --- a/scripts/install +++ b/scripts/install @@ -38,8 +38,8 @@ else echo "English" fi -secret_key=$(ynh_string_random --length=32) -utils_secret=$(ynh_string_random --length=32) +secret_key=$(ynh_string_random --length=64) +utils_secret=$(ynh_string_random --length=64) app=$YNH_APP_INSTANCE_NAME @@ -71,7 +71,7 @@ ynh_script_progression --message="Installing Dex..." --weight=18 dex_domain=$YNH_APP_ARG_DEX_DOMAIN dex_path=$YNH_APP_ARG_DEX_PATH -oidc_secret=$(ynh_string_random --length=32) +oidc_secret=$(ynh_string_random --length=64) oidc_name="Outline" oidc_callback="$domain/auth/oidc.callback" From a25a2c85ac3ed88282e12ae007a4f61afda87493 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 11:07:56 +0700 Subject: [PATCH 06/18] Update install --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 81c8d7a..cacc0a8 100755 --- a/scripts/install +++ b/scripts/install @@ -38,8 +38,8 @@ else echo "English" fi -secret_key=$(ynh_string_random --length=64) -utils_secret=$(ynh_string_random --length=64) +secret_key=$(ynh_hex_32_random) +utils_secret=$(ynh_hex_32_random) app=$YNH_APP_INSTANCE_NAME @@ -71,7 +71,7 @@ ynh_script_progression --message="Installing Dex..." --weight=18 dex_domain=$YNH_APP_ARG_DEX_DOMAIN dex_path=$YNH_APP_ARG_DEX_PATH -oidc_secret=$(ynh_string_random --length=64) +oidc_secret=$(ynh_hex_32_random) oidc_name="Outline" oidc_callback="$domain/auth/oidc.callback" From 8ca1412d7d27f465254d2a4a413867d0910e6924 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 21:00:48 +0700 Subject: [PATCH 07/18] Removal of dex --- scripts/backup | 11 ++++++----- scripts/change_url | 11 ++++++----- scripts/install | 8 +++++--- scripts/remove | 18 +++++++++++++----- scripts/restore | 11 ++++++----- scripts/upgrade | 11 ++++++----- 6 files changed, 42 insertions(+), 28 deletions(-) diff --git a/scripts/backup b/scripts/backup index 742da2f..55eeaa1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -41,11 +41,12 @@ minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) minio_password=$(ynh_app_setting_get --app="minio" --key=password) minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) -dex_domain=$(ynh_app_setting_get --app="minio" --key=dex_domain) -dex_path=$(ynh_app_setting_get --app="minio" --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app="minio" --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app="minio" --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app="minio" --key=oidc_callback) +dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) +dex_domain=$(ynh_app_setting_get --app=$dex_app --key=dex_domain) +dex_path=$(ynh_app_setting_get --app=$dex_app --key=dex_path) +oidc_secret=$(ynh_app_setting_get --app=$dex_app --key=oidc_secret) +oidc_name=$(ynh_app_setting_get --app=$dex_app --key=oidc_name) +oidc_callback=$(ynh_app_setting_get --app=$dex_app --key=oidc_callback) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/change_url b/scripts/change_url index 029298a..3d2364a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -40,11 +40,12 @@ minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) minio_password=$(ynh_app_setting_get --app="minio" --key=password) minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) -dex_domain=$(ynh_app_setting_get --app="minio" --key=dex_domain) -dex_path=$(ynh_app_setting_get --app="minio" --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app="minio" --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app="minio" --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app="minio" --key=oidc_callback) +dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) +dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) +dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) +oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) +oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) +oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP diff --git a/scripts/install b/scripts/install index cacc0a8..a2ee1ee 100755 --- a/scripts/install +++ b/scripts/install @@ -54,8 +54,7 @@ if ! yunohost app list | grep -q "id: minio"; then 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 - ### FIXME AFTER CI VERIFICATION - yunohost app install https://github.com/Limezy/minio_ynh/tree/ci-compatible --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&admin=$YNH_APP_ARG_MINIO_ADMIN&password=$YNH_APP_ARG_MINIO_PASSWORD" + yunohost app install https://github.com/YunoHost-Apps/minio_ynh --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&admin=$YNH_APP_ARG_MINIO_ADMIN&password=$YNH_APP_ARG_MINIO_PASSWORD" fi minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) @@ -79,7 +78,9 @@ if yunohost app list | grep -q "$YNH_APP_ARG_DEX_DOMAIN"; then ynh_die "The domain provided for Dex is already used by another app. Please chose another one !" fi -yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "domain=$dex_domain&path=$dex_path&OIDC_name=$oidc_name&OIDC_secret=$oidc_secret&OIDC_callback=$oidc_callback" +yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "domain=$dex_domain&path=$dex_path&OIDC_name=$oidc_name&OIDC_secret=$oidc_secret&OIDC_callback=$oidc_callback" 2>&1 | tee dexlog.txt +dex_app=$(gawk 'match($0, /Installation of (.+) completed/, app) {print app[1]}' dexlog.txt) +rm dexlog.txt #=================================================== # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -103,6 +104,7 @@ 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 ynh_app_setting_set --app=$app --key=language_key --value=$language_key +ynh_app_setting_set --app=$app --key=dex_app --value=$dex_app ynh_app_setting_set --app=$app --key=dex_domain --value=$dex_domain ynh_app_setting_set --app=$app --key=dex_path --value=$dex_path ynh_app_setting_set --app=$app --key=oidc_name --value=$oidc_name diff --git a/scripts/remove b/scripts/remove index 0dc8d21..2631d87 100755 --- a/scripts/remove +++ b/scripts/remove @@ -28,11 +28,12 @@ minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) minio_password=$(ynh_app_setting_get --app="minio" --key=password) minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) -dex_domain=$(ynh_app_setting_get --app="minio" --key=dex_domain) -dex_path=$(ynh_app_setting_get --app="minio" --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app="minio" --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app="minio" --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app="minio" --key=oidc_callback) +dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) +dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) +dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) +oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) +oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) +oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) #================================================= # STANDARD REMOVE @@ -88,6 +89,13 @@ ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" +#================================================= +# REMOVE DEX APP +#================================================= +ynh_script_progression --message="Removing Dex app used for Outline auth..." --weight=1 + +yunohost app remove $dex_app + #================================================= # REMOVE MINIO BUCKET #================================================= diff --git a/scripts/restore b/scripts/restore index 1b35f7a..48d68c3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -50,11 +50,12 @@ minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) minio_password=$(ynh_app_setting_get --app="minio" --key=password) minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) -dex_domain=$(ynh_app_setting_get --app="minio" --key=dex_domain) -dex_path=$(ynh_app_setting_get --app="minio" --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app="minio" --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app="minio" --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app="minio" --key=oidc_callback) +dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) +dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) +dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) +oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) +oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) +oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) #================================================= # CHECK IF THE APP CAN BE RESTORED diff --git a/scripts/upgrade b/scripts/upgrade index 38e2c9f..391affb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,11 +29,12 @@ minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) minio_password=$(ynh_app_setting_get --app="minio" --key=password) minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) -dex_domain=$(ynh_app_setting_get --app="minio" --key=dex_domain) -dex_path=$(ynh_app_setting_get --app="minio" --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app="minio" --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app="minio" --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app="minio" --key=oidc_callback) +dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) +dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) +dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) +oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) +oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) +oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) #================================================= # CHECK VERSION From ba767b11f02eed4724e43d646126875241b4157e Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 21:07:39 +0700 Subject: [PATCH 08/18] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index a2ee1ee..dd65fe8 100755 --- a/scripts/install +++ b/scripts/install @@ -74,7 +74,7 @@ oidc_secret=$(ynh_hex_32_random) oidc_name="Outline" oidc_callback="$domain/auth/oidc.callback" -if yunohost app list | grep -q "$YNH_APP_ARG_DEX_DOMAIN"; then +if yunohost app list | grep -q "$YNH_APP_ARG_DEX_DOMAIN$YNH_APP_ARG_DEX_PATH"; then ynh_die "The domain provided for Dex is already used by another app. Please chose another one !" fi From 5b804e2017f541b40e54b935542c15953d17a702 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 21:29:04 +0700 Subject: [PATCH 09/18] Update remove --- scripts/remove | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 2631d87..8cbddba 100755 --- a/scripts/remove +++ b/scripts/remove @@ -128,5 +128,4 @@ ynh_system_user_delete --username=$app #================================================= ynh_script_progression --message="If you don't need it anymore, don't forget to remove the MinIO app !" -ynh_script_progression --message="If you don't need it anymore, don't forget to remove the Dex app !" ynh_script_progression --message="Removal of $app completed" --last From e69f37f6fc5ad1dea2f639bc43276d1992d70d67 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 21:42:10 +0700 Subject: [PATCH 10/18] Cover the dex path /example case --- conf/.env | 6 +++--- scripts/backup | 3 +++ scripts/change_url | 3 +++ scripts/install | 15 +++++++++++++++ scripts/remove | 3 +++ scripts/restore | 3 +++ scripts/upgrade | 3 +++ 7 files changed, 33 insertions(+), 3 deletions(-) diff --git a/conf/.env b/conf/.env index c67d706..61cbf9e 100644 --- a/conf/.env +++ b/conf/.env @@ -77,9 +77,9 @@ AZURE_RESOURCE_APP_ID= # Redirect URI is https:///auth/oidc.callback OIDC_CLIENT_ID=__OIDC_NAME__ OIDC_CLIENT_SECRET=__OIDC_SECRET__ -OIDC_AUTH_URI=https://__DEX_DOMAIN____DEX_PATH__auth -OIDC_TOKEN_URI=https://__DEX_DOMAIN____DEX_PATH__token -OIDC_USERINFO_URI=https://__DEX_DOMAIN____DEX_PATH__userinfo +OIDC_AUTH_URI=__DEX_AUTH_URI__ +OIDC_TOKEN_URI=__DEX_TOKEN_URI__ +OIDC_USERINFO_URI=__DEX_USER_URI__ # Specify which claims to derive user information from # Supports any valid JSON path with the JWT payload diff --git a/scripts/backup b/scripts/backup index 55eeaa1..1ba5831 100755 --- a/scripts/backup +++ b/scripts/backup @@ -47,6 +47,9 @@ dex_path=$(ynh_app_setting_get --app=$dex_app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$dex_app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$dex_app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$dex_app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/change_url b/scripts/change_url index 3d2364a..800b336 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -46,6 +46,9 @@ dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP diff --git a/scripts/install b/scripts/install index dd65fe8..30f7def 100755 --- a/scripts/install +++ b/scripts/install @@ -82,6 +82,18 @@ yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "do dex_app=$(gawk 'match($0, /Installation of (.+) completed/, app) {print app[1]}' dexlog.txt) rm dexlog.txt +# Create Dex URIs +if [ $i$dex_path -eq "/" ] +then + dex_auth_uri="https://$dex_domain/auth" + dex_token_uri="https://$dex_domain/token" + dex_user_uri="https://$dex_domain/userinfo" +else + dex_auth_uri="https://$dex_domain$dex_path/auth" + dex_token_uri="https://$dex_domain$dex_path/token" + dex_user_uri="https://$dex_domain$dex_path/userinfo" +fi + #=================================================== # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #=================================================== @@ -110,6 +122,9 @@ ynh_app_setting_set --app=$app --key=dex_path --value=$dex_path ynh_app_setting_set --app=$app --key=oidc_name --value=$oidc_name ynh_app_setting_set --app=$app --key=oidc_secret --value=$oidc_secret ynh_app_setting_set --app=$app --key=oidc_callback --value=$oidc_callback +ynh_app_setting_set --app=$app --key=dex_auth_uri --value=$dex_auth_uri +ynh_app_setting_set --app=$app --key=dex_token_uri --value=$dex_token_uri +ynh_app_setting_set --app=$app --key=dex_user_uri --value=$dex_user_uri #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/remove b/scripts/remove index 8cbddba..6943734 100755 --- a/scripts/remove +++ b/scripts/remove @@ -34,6 +34,9 @@ dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # STANDARD REMOVE diff --git a/scripts/restore b/scripts/restore index 48d68c3..5e5ace2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -56,6 +56,9 @@ dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # CHECK IF THE APP CAN BE RESTORED diff --git a/scripts/upgrade b/scripts/upgrade index 391affb..5829e70 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,6 +35,9 @@ dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # CHECK VERSION From 802355e505065d6bdd167145c05f211ce6b9ddb2 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 21:47:56 +0700 Subject: [PATCH 11/18] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 30f7def..d840a1a 100755 --- a/scripts/install +++ b/scripts/install @@ -83,7 +83,7 @@ dex_app=$(gawk 'match($0, /Installation of (.+) completed/, app) {print app[1]}' rm dexlog.txt # Create Dex URIs -if [ $i$dex_path -eq "/" ] +if [ $dex_path -eq "/" ] then dex_auth_uri="https://$dex_domain/auth" dex_token_uri="https://$dex_domain/token" From a2a679cf9cc2164a416ca15aa5ecd035491b36dd Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 21:53:01 +0700 Subject: [PATCH 12/18] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index d840a1a..81dc91a 100755 --- a/scripts/install +++ b/scripts/install @@ -83,7 +83,7 @@ dex_app=$(gawk 'match($0, /Installation of (.+) completed/, app) {print app[1]}' rm dexlog.txt # Create Dex URIs -if [ $dex_path -eq "/" ] +if [ $dex_path = "/" ] then dex_auth_uri="https://$dex_domain/auth" dex_token_uri="https://$dex_domain/token" From 65950f27223688d17f3aa98e57b635016b71329b Mon Sep 17 00:00:00 2001 From: Limezy Date: Sat, 2 Apr 2022 02:43:59 +0700 Subject: [PATCH 13/18] Update restore --- scripts/restore | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/scripts/restore b/scripts/restore index 5e5ace2..13f2813 100755 --- a/scripts/restore +++ b/scripts/restore @@ -21,15 +21,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK IF MINIO IS INSTALLED, IF NOT WARN USER -#================================================= -ynh_script_progression --message="Checking if MinIO is installed..." --weight=1 - -if ! yunohost app list | grep -q "id: minio"; then - ynh_die --message="We can't restore because MinIO is not installed ! Please install MinIO first" -fi - #================================================= # LOAD SETTINGS #================================================= @@ -68,6 +59,35 @@ ynh_script_progression --message="Validating restoration parameters..." --weight test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path" +#================================================= +# CHECK IF DEX IS INSTALLED, IF NOT INSTALL IT +#================================================= +ynh_script_progression --message="Installing Dex if needed..." --weight=18 + +if ! yunohost app list | grep -q "id: $dex_app"; then + echo "Dex is not installed. Installing... " + yunohost tools update + if yunohost app list | grep -q "$dex_domain$dex_path"; then + ynh_die "The domain provided for Dex is already used by another app. Please chose another one !" + fi + yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "domain=$dex_domain&path=$dex_path&OIDC_name=$oidc_name&OIDC_secret=$oidc_secret&OIDC_callback=$oidc_callback" + +fi + +#================================================= +# CHECK IF MINIO IS INSTALLED, IF NOT INSTALL IT +#================================================= +ynh_script_progression --message="Installing MinIO if needed..." --weight=18 + +if ! yunohost app list | grep -q "id: minio"; then + echo "MinIO is not installed. Installing... " + yunohost tools update + if yunohost app list | grep -q "$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/YunoHost-Apps/minio_ynh --force --args "domain=$minio_domain&is_public=true&admin=$minio_admin&password=$minio_password" +fi + #================================================= # STANDARD RESTORATION STEPS #================================================= From 8bbd8135f405526e6ddb60af841a3421695f7e20 Mon Sep 17 00:00:00 2001 From: Limezy Date: Sat, 2 Apr 2022 07:17:17 +0700 Subject: [PATCH 14/18] MinIO keys... --- scripts/backup | 20 ++++++++++---------- scripts/change_url | 10 +++++----- scripts/install | 4 ++++ scripts/remove | 11 ++++++----- scripts/restore | 10 +++++----- scripts/upgrade | 10 +++++----- 6 files changed, 35 insertions(+), 30 deletions(-) diff --git a/scripts/backup b/scripts/backup index 1ba5831..7d284a7 100755 --- a/scripts/backup +++ b/scripts/backup @@ -36,17 +36,17 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) -minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) -minio_password=$(ynh_app_setting_get --app="minio" --key=password) -minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) -mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) +minio_domain=$(ynh_app_setting_get --app=$app --key=domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=admin) +minio_password=$(ynh_app_setting_get --app=$app --key=password) +minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) -dex_domain=$(ynh_app_setting_get --app=$dex_app --key=dex_domain) -dex_path=$(ynh_app_setting_get --app=$dex_app --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app=$dex_app --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app=$dex_app --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app=$dex_app --key=oidc_callback) +dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) +dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) +oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) +oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) +oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) diff --git a/scripts/change_url b/scripts/change_url index 800b336..df258f7 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -35,11 +35,11 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) -minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) -minio_password=$(ynh_app_setting_get --app="minio" --key=password) -minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) -mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) +minio_domain=$(ynh_app_setting_get --app=$app --key=domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=admin) +minio_password=$(ynh_app_setting_get --app=$app --key=password) +minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) diff --git a/scripts/install b/scripts/install index 81dc91a..b753d0b 100755 --- a/scripts/install +++ b/scripts/install @@ -116,6 +116,10 @@ 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 ynh_app_setting_set --app=$app --key=language_key --value=$language_key +ynh_app_setting_set --app=$app --key=minio_domain --value=$minio_domain +ynh_app_setting_set --app=$app --key=minio_admin --value=$minio_admin +ynh_app_setting_set --app=$app --key=minio_password --value=$minio_password +ynh_app_setting_set --app=$app --key=minio_key --value=$minio_key ynh_app_setting_set --app=$app --key=dex_app --value=$dex_app ynh_app_setting_set --app=$app --key=dex_domain --value=$dex_domain ynh_app_setting_set --app=$app --key=dex_path --value=$dex_path diff --git a/scripts/remove b/scripts/remove index 6943734..859665b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -19,15 +19,16 @@ 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) path_url=$(ynh_app_setting_get --app=$app --key=path_url) +port=$(ynh_app_setting_get --app=$app --key=port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) -minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) -minio_password=$(ynh_app_setting_get --app="minio" --key=password) -minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) -mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) +minio_domain=$(ynh_app_setting_get --app=$app --key=domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=admin) +minio_password=$(ynh_app_setting_get --app=$app --key=password) +minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) diff --git a/scripts/restore b/scripts/restore index 13f2813..561fd4d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -36,11 +36,11 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) -minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) -minio_password=$(ynh_app_setting_get --app="minio" --key=password) -minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) -mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) +minio_domain=$(ynh_app_setting_get --app=$app --key=domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=admin) +minio_password=$(ynh_app_setting_get --app=$app --key=password) +minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) diff --git a/scripts/upgrade b/scripts/upgrade index 5829e70..67261b0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,11 +24,11 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) -minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) -minio_password=$(ynh_app_setting_get --app="minio" --key=password) -minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) -mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) +minio_domain=$(ynh_app_setting_get --app=$app --key=domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=admin) +minio_password=$(ynh_app_setting_get --app=$app --key=password) +minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) From 68c5205c7c1735d336c5e8da0b0a27a332d95f0b Mon Sep 17 00:00:00 2001 From: Limezy Date: Sat, 2 Apr 2022 13:04:05 +0700 Subject: [PATCH 15/18] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index b753d0b..23b31f4 100755 --- a/scripts/install +++ b/scripts/install @@ -120,6 +120,7 @@ ynh_app_setting_set --app=$app --key=minio_domain --value=$minio_domain ynh_app_setting_set --app=$app --key=minio_admin --value=$minio_admin ynh_app_setting_set --app=$app --key=minio_password --value=$minio_password ynh_app_setting_set --app=$app --key=minio_key --value=$minio_key +ynh_app_setting_set --app=$app --key=mc_path --value=$mc_path ynh_app_setting_set --app=$app --key=dex_app --value=$dex_app ynh_app_setting_set --app=$app --key=dex_domain --value=$dex_domain ynh_app_setting_set --app=$app --key=dex_path --value=$dex_path From 4b9fa68aaad90fe0d38c1fecd6c699911e452591 Mon Sep 17 00:00:00 2001 From: Limezy Date: Sat, 2 Apr 2022 16:24:41 +0700 Subject: [PATCH 16/18] Should work ! --- scripts/backup | 7 +++---- scripts/change_url | 7 +++---- scripts/install | 2 -- scripts/remove | 7 +++---- scripts/restore | 8 +++----- scripts/upgrade | 7 +++---- 6 files changed, 15 insertions(+), 23 deletions(-) diff --git a/scripts/backup b/scripts/backup index 7d284a7..14103b6 100755 --- a/scripts/backup +++ b/scripts/backup @@ -36,10 +36,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app=$app --key=domain) -minio_admin=$(ynh_app_setting_get --app=$app --key=admin) -minio_password=$(ynh_app_setting_get --app=$app --key=password) -minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +minio_domain=$(ynh_app_setting_get --app=$app --key=minio_domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=minio_admin) +minio_password=$(ynh_app_setting_get --app=$app --key=minio_password) mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) diff --git a/scripts/change_url b/scripts/change_url index df258f7..3be27d0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -35,10 +35,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app=$app --key=domain) -minio_admin=$(ynh_app_setting_get --app=$app --key=admin) -minio_password=$(ynh_app_setting_get --app=$app --key=password) -minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +minio_domain=$(ynh_app_setting_get --app=$app --key=minio_domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=minio_admin) +minio_password=$(ynh_app_setting_get --app=$app --key=minio_password) mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) diff --git a/scripts/install b/scripts/install index 23b31f4..bffc5d6 100755 --- a/scripts/install +++ b/scripts/install @@ -60,7 +60,6 @@ fi minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) minio_admin=$(ynh_app_setting_get --app="minio" --key=admin) minio_password=$(ynh_app_setting_get --app="minio" --key=password) -minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) #================================================= @@ -119,7 +118,6 @@ ynh_app_setting_set --app=$app --key=language_key --value=$language_key ynh_app_setting_set --app=$app --key=minio_domain --value=$minio_domain ynh_app_setting_set --app=$app --key=minio_admin --value=$minio_admin ynh_app_setting_set --app=$app --key=minio_password --value=$minio_password -ynh_app_setting_set --app=$app --key=minio_key --value=$minio_key ynh_app_setting_set --app=$app --key=mc_path --value=$mc_path ynh_app_setting_set --app=$app --key=dex_app --value=$dex_app ynh_app_setting_set --app=$app --key=dex_domain --value=$dex_domain diff --git a/scripts/remove b/scripts/remove index 859665b..1e4bd85 100755 --- a/scripts/remove +++ b/scripts/remove @@ -24,10 +24,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app=$app --key=domain) -minio_admin=$(ynh_app_setting_get --app=$app --key=admin) -minio_password=$(ynh_app_setting_get --app=$app --key=password) -minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +minio_domain=$(ynh_app_setting_get --app=$app --key=minio_domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=minio_admin) +minio_password=$(ynh_app_setting_get --app=$app --key=minio_password) mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) diff --git a/scripts/restore b/scripts/restore index 561fd4d..b4e3fe3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -36,10 +36,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app=$app --key=domain) -minio_admin=$(ynh_app_setting_get --app=$app --key=admin) -minio_password=$(ynh_app_setting_get --app=$app --key=password) -minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +minio_domain=$(ynh_app_setting_get --app=$app --key=minio_domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=minio_admin) +minio_password=$(ynh_app_setting_get --app=$app --key=minio_password) mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) @@ -71,7 +70,6 @@ if ! yunohost app list | grep -q "id: $dex_app"; then ynh_die "The domain provided for Dex is already used by another app. Please chose another one !" fi yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "domain=$dex_domain&path=$dex_path&OIDC_name=$oidc_name&OIDC_secret=$oidc_secret&OIDC_callback=$oidc_callback" - fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 67261b0..40b5dd5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,10 +24,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) language_key=$(ynh_app_setting_get --app=$app --key=language_key) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -minio_domain=$(ynh_app_setting_get --app=$app --key=domain) -minio_admin=$(ynh_app_setting_get --app=$app --key=admin) -minio_password=$(ynh_app_setting_get --app=$app --key=password) -minio_key=$(ynh_app_setting_get --app=$app --key=minio_key) +minio_domain=$(ynh_app_setting_get --app=$app --key=minio_domain) +minio_admin=$(ynh_app_setting_get --app=$app --key=minio_admin) +minio_password=$(ynh_app_setting_get --app=$app --key=minio_password) mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) From e3455848f1c566ce9d967213c09376b332c513ef Mon Sep 17 00:00:00 2001 From: Limezy Date: Sat, 2 Apr 2022 21:36:30 +0700 Subject: [PATCH 17/18] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 27e5c55..d390b3a 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "An open, extensible, wiki for your team built using React and Node.js.", "fr": "Un wiki open source et évolutif pour votre équipe, conçu avec React et Node.js" }, - "version": "0.62.0~ynh2", + "version": "0.62.0~ynh3", "url": "www.getoutline.com", "upstream": { "license": "BUSL-1.1", From 7c329901d82d0b0aa248e4eff8708e9074d9c87e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 2 Apr 2022 14:37:18 +0000 Subject: [PATCH 18/18] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 26fba72..254cb37 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The fastest wiki and knowledge base for growing teams. Beautiful, feature rich, - Using Yunohost's built-in SMTP server for notifications -**Shipped version:** 0.62.0~ynh2 +**Shipped version:** 0.62.0~ynh3 **Demo:** https://app.getoutline.com/create diff --git a/README_fr.md b/README_fr.md index de06339..fe1d599 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ The fastest wiki and knowledge base for growing teams. Beautiful, feature rich, - Using Yunohost's built-in SMTP server for notifications -**Version incluse :** 0.62.0~ynh2 +**Version incluse :** 0.62.0~ynh3 **Démo :** https://app.getoutline.com/create