diff --git a/README.md b/README.md index 5336221..a4bd460 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,8 @@ LDAP authentication is activated. All YunoHost users can authenticate. #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mastodon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mastodon/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mastodon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mastodon/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mastodon.svg)](https://ci-apps.yunohost.org/ci/apps/mastodon/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mastodon.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mastodon/) ## Links diff --git a/README_fr.md b/README_fr.md index 6553753..1f1fc84 100644 --- a/README_fr.md +++ b/README_fr.md @@ -59,8 +59,8 @@ L'authentification LDAP est activée. Tous les utilisateurs YunoHost peuvent s'a #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mastodon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mastodon/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mastodon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mastodon/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mastodon.svg)](https://ci-apps.yunohost.org/ci/apps/mastodon/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mastodon.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mastodon/) ## Liens diff --git a/check_process b/check_process index 72f8049..e187789 100644 --- a/check_process +++ b/check_process @@ -26,10 +26,12 @@ upgrade=1 from_commit=74908bf3e70c134bc838c7db3ae8b5aa0938cd75 # 3.2.2~ynh1 upgrade=1 from_commit=a233ccc644d97aa89756fac9f0ce68c98d81d27c + # 3.3.0~ynh1 + upgrade=1 from_commit=1b7de8c3acc9607c619c02aae49a2485e40eef4d backup_restore=1 multi_instance=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Options Email=yalh@yahoo.com Notification=all @@ -48,3 +50,5 @@ Notification=all name=3.2.1~ynh2 ; commit=a233ccc644d97aa89756fac9f0ce68c98d81d27c name=3.2.2~ynh1 + ; commit=1b7de8c3acc9607c619c02aae49a2485e40eef4d + name=3.3.0~ynh1 diff --git a/manifest.json b/manifest.json index 2d38584..d6aa9f1 100644 --- a/manifest.json +++ b/manifest.json @@ -6,10 +6,13 @@ "en": "A libre and federated social network.", "fr": "Un réseau social libre et fédéré." }, - "version": "3.3.0~ynh1", + "version": "3.3.0~ynh2", "url": "https://github.com/tootsuite/mastodon", "license": "AGPL-3.0-or-later", - "maintainer": [ + "maintainer": { + "name": "yalh76" + }, + "previous_maintainer": [ { "name": "cyp", "email": "cyp@rouquin.me" @@ -17,9 +20,6 @@ { "name": "nemsia", "email": "nemsia@nemsia.org" - }, - { - "name": "yalh76" } ], "requirements": { @@ -34,28 +34,16 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for Mastodon", - "fr": "Choisissez un domaine pour Mastodon" - }, "example": "example.com" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l'administrateur" - }, "example": "johndoe" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true }, { diff --git a/scripts/backup b/scripts/backup index c1d4f6f..590ce0f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers diff --git a/scripts/install b/scripts/install index 7d21d45..da81c3b 100644 --- a/scripts/install +++ b/scripts/install @@ -76,9 +76,17 @@ ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream ynh_script_progression --message="Installing dependencies..." ynh_install_nodejs --nodejs_version=$NODEJS_VERSION -ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # CREATE A POSTGRESQL DATABASE #================================================= @@ -103,22 +111,18 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path/live" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config 'port_web port_stream' -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # SPECIFIC SETUP #================================================= @@ -231,22 +235,14 @@ ynh_store_file_checksum --file="$config" #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions to app files -chown -R "$app": "$final_path" - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add "$app-web" --description "$app web service" -yunohost service add "$app-sidekiq" --description "$app sidekiq service" -yunohost service add "$app-streaming" --description "$app streaming service" +yunohost service add "$app-web" --description="$app web service" +yunohost service add "$app-sidekiq" --description="$app sidekiq service" +yunohost service add "$app-streaming" --description="$app streaming service" #================================================= # START SYSTEMD SERVICE @@ -275,7 +271,7 @@ ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --aut #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index 6b16380..44c3bde 100644 --- a/scripts/remove +++ b/scripts/remove @@ -29,7 +29,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +# 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-web" >/dev/null then ynh_script_progression --message="Removing $app-web service integration..." @@ -88,9 +88,9 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= diff --git a/scripts/restore b/scripts/restore index 6744ddb..f51537a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source ../settings/scripts/ynh_install_ruby__2 source ../settings/scripts/ynh_add_swap @@ -25,7 +25,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -51,10 +51,18 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the nginx configuration..." +ynh_script_progression --message="Restoring the NGINX web server configuration..." 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..." + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -62,21 +70,9 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." - -# Restore permissions on app files -chown -R $app: $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" #================================================= # SPECIFIC RESTORATION @@ -102,7 +98,7 @@ ynh_add_swap --size=$swap_needed ynh_script_progression --message="Reinstalling dependencies..." ynh_install_nodejs --nodejs_version=$NODEJS_VERSION -ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= @@ -141,9 +137,9 @@ systemctl enable "$app-web" "$app-sidekiq" "$app-streaming" --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add "$app-web" --description "$app web service" -yunohost service add "$app-sidekiq" --description "$app sidekiq service" -yunohost service add "$app-streaming" --description "$app streaming service" +yunohost service add "$app-web" --description="$app web service" +yunohost service add "$app-sidekiq" --description="$app sidekiq service" +yunohost service add "$app-streaming" --description="$app streaming service" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index bbbe50b..c2c0819 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,7 +49,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." - # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -124,7 +123,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take ynh_backup_before_upgrade ynh_clean_setup () { ynh_clean_check_starting - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -141,6 +140,14 @@ ynh_systemd_action --service_name=${app}-web --action="stop" --log_path=systemd ynh_systemd_action --service_name=${app}-sidekiq --action="stop" --log_path=systemd --line_match="Stopped" ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=systemd --line_match="Stopped" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -171,10 +178,14 @@ then ynh_secure_remove --file="$final_path/live/config/initializers/timeout.rb" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated NGINX config ynh_add_nginx_config 'port_web port_stream' @@ -189,14 +200,6 @@ ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_app_dependencies $pkg_dependencies ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # SPECIFIC UPGRADE #================================================= @@ -273,22 +276,14 @@ ynh_add_systemd_config --service="$app-streaming" --template="mastodon-streaming #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions on app files -chown -R $app: $final_path - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add "$app-web" --description "$app web service" -yunohost service add "$app-sidekiq" --description "$app sidekiq service" -yunohost service add "$app-streaming" --description "$app streaming service" +yunohost service add "$app-web" --description="$app web service" +yunohost service add "$app-sidekiq" --description="$app sidekiq service" +yunohost service add "$app-streaming" --description="$app streaming service" #================================================= # START SYSTEMD SERVICE @@ -302,7 +297,7 @@ ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=s #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload