diff --git a/README.md b/README.md index a01b85c..d76dcc2 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,47 @@ + + # Mobilizon for YunoHost [![Integration level](https://dash.yunohost.org/integration/mobilizon.svg)](https://dash.yunohost.org/appci/app/mobilizon) ![](https://ci-apps.yunohost.org/ci/badges/mobilizon.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mobilizon.maintain.svg) [![Install Mobilizon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mobilizon) -> *This package allows you to install Mobilizon quickly and simply on a YunoHost server. +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allows you to install Mobilizon quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -Mobilizon is your federated organization and mobilization platform. Supported by [Framasoft](https://framasoft.org/en/) -Mobilizon aims to solve existing platform's problems to organize events in a decentralised, libre and privacy friendly way. +A decentralized and federated platform to organize events -Mobilizon is a tool that helps you find, create and organise events. You can also create a page for your group where the members will be able to organise together. +**Shipped version:** 1.2.2~ynh1 -**Shipped version:** 1.1.4 - -## Important points to read before installing - -1. **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld -2. To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install -3. By default registrations are closed -4. All YunoHost users are allowed to connect +**Demo:** https://demo.mobilizon.org ## Screenshots -![Capture](https://joinmobilizon.org/img/fr/event-tree-participation-rose-utopia.jpg) +![](./doc/screenshots/screenshot1.jpg) -## Demo +## Disclaimers / important information -* [Official demo](https://demo.mobilizon.org/) +* Any known limitations, constrains or stuff not working, such as (but not limited to): + * **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld + * To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install + * By default registrations are closed + * All YunoHost users are allowed to connect -## Configuration +* Other infos that people should be aware of, such as: + * Configuration can be made in the Mobilizon administration panel. +## Documentation and resources -Configuration can be made in the Mobilizon administration panel. - -## Documentation - - * Official documentation: https://docs.joinmobilizon.org - -## YunoHost specific features - -#### Multi-user support - -LDAP is supported but HTTP auth is not supported? - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mobilizon.svg)](https://ci-apps.yunohost.org/ci/apps/mobilizon/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mobilizon.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mobilizon/) - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/mobilizon_ynh/issues - * App website: https://joinmobilizon.org/ - * Upstream app repository: https://framagit.org/framasoft/mobilizon/ - * YunoHost website: https://yunohost.org/ - ---- +* Official app website: https://joinmobilizon.org/ +* Official user documentation: https://docs.joinmobilizon.org +* Upstream app code repository: https://framagit.org/framasoft/mobilizon/ +* YunoHost documentation for this app: https://yunohost.org/app_mobilizon +* Report a bug: https://github.com/YunoHost-Apps/mobilizon_ynh/issues ## Developer info @@ -68,3 +53,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/mobilizon_ynh/tree/te or sudo yunohost app upgrade mobilizon -u https://github.com/YunoHost-Apps/mobilizon_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..2dc558d --- /dev/null +++ b/README_fr.md @@ -0,0 +1,53 @@ +# Mobilizon pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/mobilizon.svg)](https://dash.yunohost.org/appci/app/mobilizon) ![](https://ci-apps.yunohost.org/ci/badges/mobilizon.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mobilizon.maintain.svg) +[![Installer Mobilizon avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mobilizon) + +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* + +> *Ce package vous permet d'installer Mobilizon rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* + +## Vue d'ensemble + +Une plateforme décentralisée et fédérée pour organiser des événements + +**Version incluse :** 1.2.2~ynh1 + +**Démo :** https://demo.mobilizon.org + +## Captures d'écran + +![](./doc/screenshots/screenshot1.jpg) + +## Avertissements / informations importantes + +* Any known limitations, constrains or stuff not working, such as (but not limited to): + * **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld + * To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install + * By default registrations are closed + * All YunoHost users are allowed to connect + +* Other infos that people should be aware of, such as: + * Configuration can be made in the Mobilizon administration panel. +## Documentations et ressources + +* Site officiel de l'app : https://joinmobilizon.org/ +* Documentation officielle utilisateur : https://docs.joinmobilizon.org +* Dépôt de code officiel de l'app : https://framagit.org/framasoft/mobilizon/ +* Documentation YunoHost pour cette app : https://yunohost.org/app_mobilizon +* Signaler un bug : https://github.com/YunoHost-Apps/mobilizon_ynh/issues + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/mobilizon_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/mobilizon_ynh/tree/testing --debug +ou +sudo yunohost app upgrade mobilizon -u https://github.com/YunoHost-Apps/mobilizon_ynh/tree/testing --debug +``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/check_process b/check_process index 2cc8994..54cb10e 100644 --- a/check_process +++ b/check_process @@ -1,9 +1,9 @@ ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - admin="john" (USER) + domain="domain.tld" + admin="john" language="fr" - is_public=1 (PUBLIC|public=1|private=0) + is_public=1 password="password" name="My_Mobilizon" ; Checks @@ -15,7 +15,9 @@ setup_public=1 upgrade=1 # 1.1.3~ynh1 - #upgrade=1 from_commit=87d34001dd0b77aed4fa7be2911bc04f58b069ee + # upgrade=1 from_commit=87d34001dd0b77aed4fa7be2911bc04f58b069ee + # 1.1.4~ynh1 + upgrade=1 from_commit=215b20b0d35178a2c3405a7e3239eba81e22c060 backup_restore=1 multi_instance=1 port_already_use=0 @@ -26,3 +28,5 @@ Notification=all ;;; Upgrade options ; commit=87d34001dd0b77aed4fa7be2911bc04f58b069ee name=1.1.3~ynh1 + ; commit=215b20b0d35178a2c3405a7e3239eba81e22c060 + name=1.1.4~ynh1 diff --git a/conf/app.src b/conf/app.src index 14cd636..fde5e5b 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.1.4/mobilizon-1.1.4.tar.gz -SOURCE_SUM=0d778d1ab390e0525bb3bb7383298011ea19d89075955622cf23e61e2899acd2 +SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.2.2/mobilizon-1.2.2.tar.gz +SOURCE_SUM=6cdeb3f0a45eff8b340ca66df6c1820c4ce8f31b3247adcb2581eb89ad70c017 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mobilizon-1.1.4.tar.gz +SOURCE_FILENAME=mobilizon-1.2.2.tar.gz SOURCE_EXTRACT=true diff --git a/doc/.gitkeep b/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..7016c78 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,8 @@ +* Any known limitations, constrains or stuff not working, such as (but not limited to): + * **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld + * To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install + * By default registrations are closed + * All YunoHost users are allowed to connect + +* Other infos that people should be aware of, such as: + * Configuration can be made in the Mobilizon administration panel. \ No newline at end of file diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/screenshots/screenshot1.jpg b/doc/screenshots/screenshot1.jpg new file mode 100644 index 0000000..415dcf8 Binary files /dev/null and b/doc/screenshots/screenshot1.jpg differ diff --git a/manifest.json b/manifest.json index 86747db..063f2d5 100644 --- a/manifest.json +++ b/manifest.json @@ -6,8 +6,15 @@ "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": "1.1.4~ynh1", + "version": "1.2.2~ynh1", "url": "https://joinmobilizon.org/", + "upstream": { + "license": "AGPL-3.0-or-later", + "website": "https://joinmobilizon.org/", + "demo": "https://demo.mobilizon.org", + "userdoc": "https://docs.joinmobilizon.org", + "code": "https://framagit.org/framasoft/mobilizon/" + }, "license": "AGPL-3.0-or-later", "maintainer": { "name": "yalh76" diff --git a/scripts/backup b/scripts/backup index e637692..4795b27 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -43,6 +43,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -57,12 +63,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -ynh_backup --src_path="$datadir" --is_big - #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= diff --git a/scripts/change_url b/scripts/change_url index c663812..16d28d7 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -113,7 +113,7 @@ fi #================================================= ynh_script_progression --message="Modifying a config file..." -config="$final_path/$app/config/prod.secret.exs" +config="$final_path/$app/config/runtime.exs" ynh_backup_if_checksum_is_different --file="$config" ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$config" diff --git a/scripts/install b/scripts/install index c85767b..7e698da 100644 --- a/scripts/install +++ b/scripts/install @@ -93,7 +93,7 @@ fi 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 @@ -139,17 +139,14 @@ ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= -# CREATE THE DATA DIRECTORY +# CREATE DATA DIRECTORY #================================================= -ynh_script_progression --message="Creating the data directory..." +ynh_script_progression --message="Creating a data directory..." -# Define app's data directory -datadir="/home/yunohost.app/${app}" +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir -ynh_app_setting_set --app=$app --key=datadir --value="$datadir" - -# Create app folders -mkdir -p "$datadir/" +mkdir -p $datadir mkdir -p "$datadir/uploads/" chmod 750 "$datadir" @@ -161,7 +158,7 @@ chown -R $app:$app "$datadir" #================================================= ynh_script_progression --message="Installing dependencies and building app..." --weight=5 -config="$final_path/$app/config/prod.secret.exs" +config="$final_path/$app/config/runtime.exs" pushd $final_path/$app/js ynh_use_nodejs @@ -187,6 +184,10 @@ cat "../conf/mail.exs" >> "$config" ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="../conf/uploads.exs" cat "../conf/uploads.exs" >> "$config" +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:$app "$datadir" + pushd $final_path/$app chmod o-rwx $config ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="$config" diff --git a/scripts/restore b/scripts/restore index 68d8a14..a446d90 100644 --- a/scripts/restore +++ b/scripts/restore @@ -63,7 +63,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" 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" +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 @@ -80,23 +80,21 @@ chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" #================================================= -# SPECIFIC RESTORATION +# RESTORE THE DATA DIRECTORY #================================================= -# RECREATE THE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Recreating the data directory..." +ynh_script_progression --message="Restoring the data directory..." -# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup. ynh_restore_file --origin_path="$datadir" --not_mandatory -# Create app folders -mkdir -p "$datadir/" +mkdir -p $datadir mkdir -p "$datadir/uploads/" chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir" +#================================================= +# SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 9289772..d419703 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,6 +41,31 @@ abort_if_up_to_date # previous function is what defines 'version', more precisely the 'previous version' previous_version="${version}" +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + read -p "key" + ynh_clean_check_starting + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -62,41 +87,13 @@ ynh_secure_remove --file="$final_path/$app/priv/data/GeoLite2-City.mmdb" ynh_secure_remove --file="/usr/share/GeoIP" -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." - -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped" - -#================================================= -# UPGRADE FROM PREVIOUS VERSION -#================================================= - if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then ynh_script_progression --message="Upgrade configuration to 1.0.0..." ynh_user_password=$(ynh_string_random --length=30) ynh_app_setting_set --app=$app --key=ynh_user_password --value=$ynh_user_password - yunohost user create ${app}_notifs --firstname "Mobilizon" --lastname "Notifications" --mail ${app}_notifs@$domain --password "$ynh_user_password" -q 0 + 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 # Manage previous .env file @@ -105,8 +102,8 @@ if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then ynh_secure_remove --file="$final_path/$app/.env" # Configure Mobilizon - config="$final_path/$app/config/prod.secret.exs" - ynh_add_config --template="../conf/prod.secret.exs" --destination="$config" + config="$final_path/$app/config/runtime.exs" + ynh_add_config --template="../conf/runtime.exs" --destination="$config" # Implement ldap and mail cat "../conf/ldap.exs" >> "$config" @@ -119,18 +116,6 @@ if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then ynh_store_file_checksum --file="$config" fi -#================================================= -# 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" - -#================================================= -# CREATE DATADIR FOLDER -#================================================= - # If datadir doesn't exist, create it if [ -z "$datadir" ]; then ynh_script_progression --message="Create datadir folder..." @@ -150,7 +135,7 @@ if [ -z "$datadir" ]; then rsync -a $final_path/$app/uploads/ $datadir/uploads/ - config="$final_path/$app/config/prod.secret.exs" + config="$final_path/$app/config/runtime.exs" ynh_backup_if_checksum_is_different --file="$config" @@ -165,6 +150,21 @@ if [ -z "$datadir" ]; then ynh_secure_remove --file="$final_path/$app/uploads" fi +if [ ! -f "$final_path/$app/config/runtime.exs" ]; then + ynh_delete_file_checksum --file="$final_path/$app/config/prod.secret.exs" + mv "$final_path/$app/config/prod.secret.exs" "$final_path/$app/config/runtime.exs" + ynh_replace_string --match_string="server: true," --replace_string="" --target_file="$final_path/$app/config/runtime.exs" + ynh_store_file_checksum --file="$final_path/$app/config/runtime.exs" +fi + +#================================================= +# 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 #================================================= @@ -177,7 +177,7 @@ then tmpdir="$(mktemp -d)" # Backup the config file in the temp dir - cp -af "$final_path/$app/config/prod.secret.exs" "$tmpdir/prod.secret.exs" + cp -af "$final_path/$app/config/runtime.exs" "$tmpdir/runtime.exs" # Remove the app directory securely ynh_secure_remove --file="$final_path/$app" @@ -186,7 +186,7 @@ then ynh_setup_source --dest_dir="$final_path/$app" # Restore the config file - cp -af "$tmpdir/prod.secret.exs" "$final_path/$app/config/prod.secret.exs" + cp -af "$tmpdir/runtime.exs" "$final_path/$app/config/runtime.exs" # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" @@ -225,6 +225,25 @@ fi #================================================= # SPECIFIC UPGRADE +#================================================= +# CREATE DATADIR FOLDER +#================================================= + +ynh_script_progression --message="Create datadir folder..." + +mkdir -p $datadir +mkdir -p "$datadir/uploads/" + +config="$final_path/$app/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" + #================================================= # MAKE SETUP #================================================= @@ -265,9 +284,9 @@ fi #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a config file..." +ynh_script_progression --message="Updating a configuration file..." -config="$final_path/$app/config/prod.secret.exs" +config="$final_path/$app/config/runtime.exs" ynh_backup_if_checksum_is_different --file="$config" ynh_store_file_checksum --file="$config"