mirror of
https://github.com/YunoHost-Apps/mobilizon_ynh.git
synced 2024-09-03 19:46:19 +02:00
commit
f6b6dc12b9
9 changed files with 68 additions and 38 deletions
|
@ -22,7 +22,7 @@ Mobilizon is a tool designed to create platforms for managing communities and ev
|
|||
1. Even if requested during installation: admin, language and password variables are not used
|
||||
1. Admin Dashboard is still not implemented
|
||||
1. When your mobilizon instance is installed, you need to register.
|
||||
1. When registered to be admin you have to manually goes in PostgreSQL, database $app, table users, and change the role value to `administrator` instead of `user` (other role available: `moderator`)
|
||||
1. When registered, to be admin you have to manually goes in PostgreSQL, database $app, table users, and change the role value to `administrator` instead of `user` (other role available: `moderator`)
|
||||
|
||||
Example to manually put user with id=1 as administrator:
|
||||
```bash
|
||||
|
@ -48,7 +48,6 @@ exit
|
|||
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/mobilizon/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/mobilizon/)
|
||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/mobilizon/)
|
||||
|
||||
## Links
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
warning="Understood"
|
||||
domain="domain.tld" (DOMAIN)
|
||||
admin="john" (USER)
|
||||
language="fr"
|
||||
|
|
|
@ -21,15 +21,6 @@
|
|||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "warning",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"text": "\nMobilizon is in early development, a lot of features are not implemented.\n\nFor advanced testing use only.\n\n"
|
||||
},
|
||||
"choices": ["Understood"],
|
||||
"default": "Understood"
|
||||
},
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
|
|
|
@ -39,7 +39,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|||
#=================================================
|
||||
ynh_print_info --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
|
@ -76,7 +76,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
|
|||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -34,6 +34,23 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
#db_user=$db_name
|
||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the app before changing its url (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
@ -57,7 +74,7 @@ fi
|
|||
#=================================================
|
||||
ynh_print_info --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --action=stop --service_name=$app
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
|
@ -93,6 +110,7 @@ fi
|
|||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Modifying a config file..."
|
||||
|
||||
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/$app/.env"
|
||||
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
|
@ -100,6 +118,7 @@ ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" -
|
|||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
ynh_print_info --message="Storing the config file checksum..."
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/$app/.env"
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
|
@ -110,8 +129,9 @@ ynh_store_file_checksum --file="$final_path/$app/.env"
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
ynh_print_info --message="Managing script failure..."
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
|
@ -23,6 +24,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
ynh_print_info --message="Retrieving arguments from the manifest..."
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
|
@ -69,7 +71,7 @@ ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email
|
|||
#=================================================
|
||||
ynh_print_info --message="Configuring firewall..."
|
||||
|
||||
# Find a free port
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
|
@ -141,6 +143,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Modifying a config file..."
|
||||
|
||||
config="$final_path/$app/.env"
|
||||
cp ../conf/.env "$config"
|
||||
|
@ -157,6 +160,7 @@ ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_ema
|
|||
#=================================================
|
||||
# MAKE SETUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Making setup..."
|
||||
|
||||
# Temporarly bypass error : WARNING ** (ArgumentError) argument error and System.get_env doesn't load environment variables
|
||||
|
||||
|
@ -190,8 +194,6 @@ pushd $final_path/$app
|
|||
ynh_replace_string --match_string="#config :logger" --replace_string="config :logger" --target_file="$final_path/$app/config/prod.exs"
|
||||
popd
|
||||
|
||||
curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz --output GeoLite2-City.tar.gz -s && tar zxf GeoLite2-City.tar.gz && mkdir -p /usr/share/GeoIP && mv GeoLite2-City_*/GeoLite2-City.mmdb $final_path/$app/priv/data/GeoLite2-City.mmdb
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
@ -213,21 +215,24 @@ ynh_store_file_checksum --file="$config"
|
|||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Securing files and directories..."
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R "$app":"$app" "$final_path"
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_print_info --message="Integrating service in YunoHost..."
|
||||
|
||||
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
|
||||
yunohost service add $app --description "$app daemon for Mobilizon"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -25,11 +25,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing service integration in YunoHost..."
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
if yunohost service status $app >/dev/null 2>&1
|
||||
# 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_print_info --message="Removing $app service..."
|
||||
yunohost service remove $app
|
||||
|
@ -38,7 +39,7 @@ fi
|
|||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Stopping and removing the systemd service"
|
||||
ynh_print_info --message="Stopping and removing the systemd service..."
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
@ -46,7 +47,7 @@ ynh_remove_systemd_config
|
|||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the PostgreSQL database"
|
||||
ynh_print_info --message="Removing the PostgreSQL database..."
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
@ -54,7 +55,7 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing dependencies"
|
||||
ynh_print_info --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
@ -64,7 +65,7 @@ ynh_remove_nodejs
|
|||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing app main directory"
|
||||
ynh_print_info --message="Removing app main directory..."
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
@ -72,7 +73,7 @@ ynh_secure_remove --file="$final_path"
|
|||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing nginx web server configuration"
|
||||
ynh_print_info --message="Removing nginx web server configuration..."
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
@ -84,25 +85,29 @@ ynh_print_info --message="Closing a port..."
|
|||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port..."
|
||||
ynh_print_info --message="Closing port $port..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
# REMOVE THE LOG FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the log files..."
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app/"
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
# Remove the GeoIP folder
|
||||
ynh_secure_remove --file="/usr/share/GeoIP"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the dedicated system user"
|
||||
ynh_print_info --message="Removing the dedicated system user..."
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
|
|
@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
ynh_print_info --message="Managing script failure..."
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
|
@ -72,6 +73,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
ynh_print_info --message="Restoring user rights..."
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R "$app":"$app" "$final_path"
|
||||
|
@ -114,14 +116,16 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|||
systemctl enable $app.service
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_print_info --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description "$app daemon for Mobilizon"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at"
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ if [ -z "$final_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
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
|
||||
#=================================================
|
||||
|
@ -85,7 +89,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
ynh_print_info --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -93,7 +97,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --time --weight=1
|
||||
ynh_print_info --message="Upgrading source files..."
|
||||
|
||||
# Create a temporary directory
|
||||
tmpdir="$(mktemp -d)"
|
||||
|
@ -149,6 +153,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Modifying a config file..."
|
||||
|
||||
config="$final_path/$app/.env"
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
|
@ -166,6 +171,7 @@ ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_ema
|
|||
#=================================================
|
||||
# MAKE SETUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Making setup..."
|
||||
|
||||
# Temporarly bypass error : WARNING ** (ArgumentError) argument error and System.get_env doesn't load environment variables
|
||||
|
||||
|
@ -202,7 +208,7 @@ popd
|
|||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Storing the config file checksum..."
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
|
@ -219,6 +225,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Securing files and directories..."
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R "$app":"$app" "$final_path"
|
||||
|
@ -236,7 +243,7 @@ then
|
|||
fi
|
||||
|
||||
#=================================================
|
||||
# START SERVICE
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue