mirror of
https://github.com/YunoHost-Apps/mobilizon_ynh.git
synced 2024-09-03 19:46:19 +02:00
commit
b63c7833f8
14 changed files with 200 additions and 123 deletions
67
README.md
67
README.md
|
@ -1,62 +1,47 @@
|
||||||
|
<!--
|
||||||
|
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||||
|
It shall NOT be edited by hand.
|
||||||
|
-->
|
||||||
|
|
||||||
# Mobilizon for YunoHost
|
# Mobilizon for YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/mobilizon)  
|
[](https://dash.yunohost.org/appci/app/mobilizon)  
|
||||||
[](https://install-app.yunohost.org/?app=mobilizon)
|
[](https://install-app.yunohost.org/?app=mobilizon)
|
||||||
|
|
||||||
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
|
||||||
> *This package allows you to install Mobilizon quickly and simply on a YunoHost server.
|
> *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.*
|
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||||
|
|
||||||
## Overview
|
## 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
|
**Demo:** https://demo.mobilizon.org
|
||||||
|
|
||||||
## 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
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 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.
|
* Official app website: https://joinmobilizon.org/
|
||||||
|
* Official user documentation: https://docs.joinmobilizon.org
|
||||||
## Documentation
|
* Upstream app code repository: https://framagit.org/framasoft/mobilizon/
|
||||||
|
* YunoHost documentation for this app: https://yunohost.org/app_mobilizon
|
||||||
* Official documentation: https://docs.joinmobilizon.org
|
* Report a bug: https://github.com/YunoHost-Apps/mobilizon_ynh/issues
|
||||||
|
|
||||||
## YunoHost specific features
|
|
||||||
|
|
||||||
#### Multi-user support
|
|
||||||
|
|
||||||
LDAP is supported but HTTP auth is not supported?
|
|
||||||
|
|
||||||
#### Supported architectures
|
|
||||||
|
|
||||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/mobilizon/)
|
|
||||||
* ARMv8-A - [](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/
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Developer info
|
## Developer info
|
||||||
|
|
||||||
|
@ -68,3 +53,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/mobilizon_ynh/tree/te
|
||||||
or
|
or
|
||||||
sudo yunohost app upgrade mobilizon -u https://github.com/YunoHost-Apps/mobilizon_ynh/tree/testing --debug
|
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
|
53
README_fr.md
Normal file
53
README_fr.md
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
# Mobilizon pour YunoHost
|
||||||
|
|
||||||
|
[](https://dash.yunohost.org/appci/app/mobilizon)  
|
||||||
|
[](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
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 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
|
|
@ -1,9 +1,9 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
admin="john" (USER)
|
admin="john"
|
||||||
language="fr"
|
language="fr"
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1
|
||||||
password="password"
|
password="password"
|
||||||
name="My_Mobilizon"
|
name="My_Mobilizon"
|
||||||
; Checks
|
; Checks
|
||||||
|
@ -15,7 +15,9 @@
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
# 1.1.3~ynh1
|
# 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
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
@ -26,3 +28,5 @@ Notification=all
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=87d34001dd0b77aed4fa7be2911bc04f58b069ee
|
; commit=87d34001dd0b77aed4fa7be2911bc04f58b069ee
|
||||||
name=1.1.3~ynh1
|
name=1.1.3~ynh1
|
||||||
|
; commit=215b20b0d35178a2c3405a7e3239eba81e22c060
|
||||||
|
name=1.1.4~ynh1
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.1.4/mobilizon-1.1.4.tar.gz
|
SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.2.2/mobilizon-1.2.2.tar.gz
|
||||||
SOURCE_SUM=0d778d1ab390e0525bb3bb7383298011ea19d89075955622cf23e61e2899acd2
|
SOURCE_SUM=6cdeb3f0a45eff8b340ca66df6c1820c4ce8f31b3247adcb2581eb89ad70c017
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
SOURCE_FILENAME=mobilizon-1.1.4.tar.gz
|
SOURCE_FILENAME=mobilizon-1.2.2.tar.gz
|
||||||
SOURCE_EXTRACT=true
|
SOURCE_EXTRACT=true
|
||||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
8
doc/DISCLAIMER.md
Normal file
8
doc/DISCLAIMER.md
Normal file
|
@ -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.
|
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/screenshot1.jpg
Normal file
BIN
doc/screenshots/screenshot1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 90 KiB |
|
@ -6,8 +6,15 @@
|
||||||
"en": "A decentralized and federated platform to organize events",
|
"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"
|
"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/",
|
"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",
|
"license": "AGPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "yalh76"
|
"name": "yalh76"
|
||||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
true
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -43,6 +43,12 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE DATA DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="$datadir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# 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"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE POSTGRESQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -113,7 +113,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modifying a config file..."
|
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_backup_if_checksum_is_different --file="$config"
|
||||||
|
|
||||||
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$config"
|
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$config"
|
||||||
|
|
|
@ -93,7 +93,7 @@ fi
|
||||||
ynh_script_progression --message="Configuring system user..."
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
|
||||||
# Create a 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 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
|
yunohost user update ${app}_notifs --add-mailalias $app@$domain --add-mailforward $admin_email
|
||||||
|
@ -139,17 +139,14 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# 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"
|
mkdir -p $datadir
|
||||||
|
|
||||||
# Create app folders
|
|
||||||
mkdir -p "$datadir/"
|
|
||||||
mkdir -p "$datadir/uploads/"
|
mkdir -p "$datadir/uploads/"
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
chmod 750 "$datadir"
|
||||||
|
@ -161,7 +158,7 @@ chown -R $app:$app "$datadir"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies and building app..." --weight=5
|
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
|
pushd $final_path/$app/js
|
||||||
ynh_use_nodejs
|
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"
|
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="../conf/uploads.exs"
|
||||||
cat "../conf/uploads.exs" >> "$config"
|
cat "../conf/uploads.exs" >> "$config"
|
||||||
|
|
||||||
|
chmod 750 "$datadir"
|
||||||
|
chmod -R o-rwx "$datadir"
|
||||||
|
chown -R $app:$app "$datadir"
|
||||||
|
|
||||||
pushd $final_path/$app
|
pushd $final_path/$app
|
||||||
chmod o-rwx $config
|
chmod o-rwx $config
|
||||||
ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="$config"
|
ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="$config"
|
||||||
|
|
|
@ -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..."
|
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# 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 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
|
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"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DATA DIRECTORY
|
ynh_script_progression --message="Restoring the data directory..."
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreating 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
|
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||||
|
|
||||||
# Create app folders
|
mkdir -p $datadir
|
||||||
mkdir -p "$datadir/"
|
|
||||||
mkdir -p "$datadir/uploads/"
|
mkdir -p "$datadir/uploads/"
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:$app "$datadir"
|
chown -R $app:$app "$datadir"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
115
scripts/upgrade
115
scripts/upgrade
|
@ -41,6 +41,31 @@ abort_if_up_to_date
|
||||||
# previous function is what defines 'version', more precisely the 'previous version'
|
# previous function is what defines 'version', more precisely the 'previous version'
|
||||||
previous_version="${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
|
# 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"
|
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
|
if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then
|
||||||
ynh_script_progression --message="Upgrade configuration to 1.0.0..."
|
ynh_script_progression --message="Upgrade configuration to 1.0.0..."
|
||||||
|
|
||||||
ynh_user_password=$(ynh_string_random --length=30)
|
ynh_user_password=$(ynh_string_random --length=30)
|
||||||
ynh_app_setting_set --app=$app --key=ynh_user_password --value=$ynh_user_password
|
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
|
yunohost user update ${app}_notifs --add-mailalias $app@$domain --add-mailforward $admin_email
|
||||||
|
|
||||||
# Manage previous .env file
|
# 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"
|
ynh_secure_remove --file="$final_path/$app/.env"
|
||||||
|
|
||||||
# Configure Mobilizon
|
# Configure Mobilizon
|
||||||
config="$final_path/$app/config/prod.secret.exs"
|
config="$final_path/$app/config/runtime.exs"
|
||||||
ynh_add_config --template="../conf/prod.secret.exs" --destination="$config"
|
ynh_add_config --template="../conf/runtime.exs" --destination="$config"
|
||||||
|
|
||||||
# Implement ldap and mail
|
# Implement ldap and mail
|
||||||
cat "../conf/ldap.exs" >> "$config"
|
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"
|
ynh_store_file_checksum --file="$config"
|
||||||
fi
|
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 datadir doesn't exist, create it
|
||||||
if [ -z "$datadir" ]; then
|
if [ -z "$datadir" ]; then
|
||||||
ynh_script_progression --message="Create datadir folder..."
|
ynh_script_progression --message="Create datadir folder..."
|
||||||
|
@ -150,7 +135,7 @@ if [ -z "$datadir" ]; then
|
||||||
|
|
||||||
rsync -a $final_path/$app/uploads/ $datadir/uploads/
|
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"
|
ynh_backup_if_checksum_is_different --file="$config"
|
||||||
|
|
||||||
|
@ -165,6 +150,21 @@ if [ -z "$datadir" ]; then
|
||||||
ynh_secure_remove --file="$final_path/$app/uploads"
|
ynh_secure_remove --file="$final_path/$app/uploads"
|
||||||
fi
|
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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -177,7 +177,7 @@ then
|
||||||
tmpdir="$(mktemp -d)"
|
tmpdir="$(mktemp -d)"
|
||||||
|
|
||||||
# Backup the config file in the temp dir
|
# 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
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path/$app"
|
ynh_secure_remove --file="$final_path/$app"
|
||||||
|
@ -186,7 +186,7 @@ then
|
||||||
ynh_setup_source --dest_dir="$final_path/$app"
|
ynh_setup_source --dest_dir="$final_path/$app"
|
||||||
|
|
||||||
# Restore the config file
|
# 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
|
# Remove the tmp directory securely
|
||||||
ynh_secure_remove --file="$tmpdir"
|
ynh_secure_remove --file="$tmpdir"
|
||||||
|
@ -225,6 +225,25 @@ fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# 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
|
# MAKE SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -265,9 +284,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# 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_backup_if_checksum_is_different --file="$config"
|
||||||
ynh_store_file_checksum --file="$config"
|
ynh_store_file_checksum --file="$config"
|
||||||
|
|
Loading…
Add table
Reference in a new issue