diff --git a/check_process b/check_process index 10611c5..7957dd1 100644 --- a/check_process +++ b/check_process @@ -4,7 +4,7 @@ is_public=1 language="fr" admin="john" - password="password" + password="1Strong-Password" name="My_Mobilizon" ; Checks pkg_linter=1 @@ -26,10 +26,12 @@ # upgrade=1 from_commit=e3c0b208c0b76a55e8df2a3947f57bb762b017d4 # 2.0.2~ynh1 upgrade=1 from_commit=0159fc6123536cdf2929b4617d89753283f6946d + # 2.1.0~ynh1 + upgrade=1 from_commit=f9c1792c86cffd17b72a48160a64ee2083d5ccf6 backup_restore=1 multi_instance=0 port_already_use=0 change_url=1 ;;; Options -Email=yalh@yahoo.com -Notification=all +Email= +Notification=none diff --git a/conf/systemd.service b/conf/systemd.service index 45a4014..7719bd3 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -3,13 +3,15 @@ Description=__APP__ Mobilizon Service After=network.target postgresql.service [Service] +Type=simple User=__APP__ +Group=__APP__ +Environment=MIX_ENV=prod WorkingDirectory=__FINALPATH__/live/ ExecStart=__FINALPATH__/live/bin/mobilizon start ExecStop=__FINALPATH__/live/bin/mobilizon stop KillMode=process Restart=on-failure -Environment=MIX_ENV=prod SyslogIdentifier=mobilizon diff --git a/manifest.json b/manifest.json index c7e09f2..9938404 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A decentralized and federated platform to organize events", "fr": "Une plateforme décentralisée et fédérée pour organiser des événements" }, - "version": "2.1.0~ynh1", + "version": "2.1.0~ynh2", "url": "https://joinmobilizon.org/", "upstream": { "license": "AGPL-3.0-or-later", diff --git a/scripts/change_url b/scripts/change_url index 2c59d1d..505aaf1 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Add settings here as needed by your application #db_name=$(ynh_app_setting_get --app=$app --key=db_name) #db_user=$db_name -#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP diff --git a/scripts/install b/scripts/install index 58ca943..dba9ce3 100644 --- a/scripts/install +++ b/scripts/install @@ -28,12 +28,13 @@ path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE admin=$YNH_APP_ARG_ADMIN -admin_email=$(ynh_user_get_info $admin 'mail') -ynh_user_password=$(ynh_string_random --length=30) -architecture=$YNH_ARCH app=$YNH_APP_INSTANCE_NAME +admin_email=$(ynh_user_get_info --username=$admin --key="mail") +ynh_user_password=$(ynh_string_random --length=30) +architecture=$YNH_ARCH + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -83,7 +84,7 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" yunohost user create ${app}_notifs --firstname "Mobilizon" --lastname "Notifications" --domain "$domain" --password "$ynh_user_password" -q 0 yunohost user update ${app}_notifs --add-mailalias $app@$domain --add-mailforward $admin_email @@ -95,17 +96,16 @@ ynh_script_progression --message="Creating a PostgreSQL database..." db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name -db_pwd=$(ynh_string_random --length=30) ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name" ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS postgis;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name" ynh_psql_execute_as_root --sql="ALTER USER $db_user PASSWORD '$db_pwd';" --database=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/remove b/scripts/remove index 31d7cd7..b7167f6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -21,6 +21,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # STANDARD REMOVE diff --git a/scripts/restore b/scripts/restore index c468ba6..d2f1f25 100644 --- a/scripts/restore +++ b/scripts/restore @@ -32,7 +32,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) port=$(ynh_app_setting_get --app=$app --key=port) ynh_user_password=$(ynh_app_setting_get --app=$app --key=ynh_user_password) admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) @@ -48,13 +47,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE 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 #================================================= @@ -101,12 +93,20 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE 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" + #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= ynh_script_progression --message="Restoring the PostgreSQL database..." ynh_psql_test_if_first_run +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name" ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS postgis;" --database=$db_name diff --git a/scripts/upgrade b/scripts/upgrade index ef896c6..6042070 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,7 +24,7 @@ admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) secret=$(ynh_app_setting_get --app=$app --key=secret) admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) @@ -181,7 +181,7 @@ fi 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 +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -202,6 +202,13 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + #================================================= # NGINX CONFIGURATION #================================================= @@ -210,13 +217,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC UPGRADE #================================================= @@ -227,12 +227,6 @@ ynh_script_progression --message="Create datadir folder..." mkdir -p $datadir mkdir -p "$datadir/uploads/" -config="$final_path/live/config/runtime.exs" - -ynh_backup_if_checksum_is_different --file="$config" - -ynh_store_file_checksum --file="$config" - chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir"