1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wekan_ynh.git synced 2024-09-03 20:36:09 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2020-06-15 04:15:42 +02:00
parent b7dd85d135
commit c2f5710a8e
10 changed files with 147 additions and 117 deletions

View file

@ -1,10 +1,10 @@
# Wekan for Yunohost # Wekan for Yunohost
[![Integration level](https://dash.yunohost.org/integration/wekan.svg)](https://dash.yunohost.org/appci/app/wekan) [![Integration level](https://dash.yunohost.org/integration/wekan.svg)](https://dash.yunohost.org/appci/app/wekan) ![](https://ci-apps.yunohost.org/ci/badges/wekan.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/wekan.maintain.svg)
[![Install Wekan with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wekan) [![Install Wekan with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wekan)
> *This package allow you to install Wekan quickly and simply on a YunoHost server. > *This package allows you to install Wekan quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
Wekan is an open-source kanban board (task manager and organizer) Wekan is an open-source kanban board (task manager and organizer)
@ -28,7 +28,7 @@ Wekan is an open-source kanban board (task manager and organizer)
## Configuration ## Configuration
As LDAP authentification is enabled by default, wekan admins correspond to the permission `Wekan Admin`. The user you choose during installation is member of this group. As LDAP authentification is enabled by default, Wekan admins correspond to the permission `Wekan Admin`. The user you choose during installation is member of this group.
To add an admin account, you can: To add an admin account, you can:
- [with the webadmin] go to Users > Groups and permissions > Add the user to the permission `Wekan Admin` - [with the webadmin] go to Users > Groups and permissions > Add the user to the permission `Wekan Admin`
@ -38,7 +38,7 @@ All others YunhoHost user can access with LDAP authentication.
If you have disable ldap authentication, first registered user will be admin, and next ones normal users. If you want other admins too, you can change their permission to admin at Wekan Admin Panel. If you have disable ldap authentication, first registered user will be admin, and next ones normal users. If you want other admins too, you can change their permission to admin at Wekan Admin Panel.
**Private/Public mode:** In private mode, only authorized YunoHost members can access to the wekan. **Private/Public mode:** In private mode, only authorized YunoHost members can access to the Wekan.
## Documentation ## Documentation
@ -46,13 +46,13 @@ If you have disable ldap authentication, first registered user will be admin, an
## YunoHost specific features ## YunoHost specific features
#### Multi-users support #### Multi-user support
LDAP is supported but HTTP auth is still not supported LDAP is supported but HTTP auth is still not supported
#### Supported architectures #### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/wekan%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/wekan/) * x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/wekan%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/wekan/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/wekan%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/wekan/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/wekan%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/wekan/)
## Links ## Links
@ -64,10 +64,10 @@ LDAP is supported but HTTP auth is still not supported
--- ---
Developers info Developer info
---------------- ----------------
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/wekan_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/wekan_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
``` ```

46
issue_template.md Normal file
View file

@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
- *Otherwise, the issue may be due to Wekan itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
**Describe the bug**
*A clear and concise description of what the bug is.*
**Versions**
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce**
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install wekan
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '....'*
3. *Scroll down to '....'*
4. *See error*
**Expected behavior**
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs**
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
*If applicable and useful, add screenshots to help explain your problem.*

View file

@ -8,7 +8,7 @@
}, },
"version": "4.09~ynh1", "version": "4.09~ynh1",
"url": "https://wekan.io", "url": "https://wekan.io",
"license": "MIT", "license": "MIT",
"maintainer": [ "maintainer": [
{ {
"name": "alexAubin", "name": "alexAubin",

View file

@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting ynh_clean_check_starting
@ -33,28 +32,30 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# STANDARD BACKUP STEPS # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
# STOP SYSTEMD SERVICE ynh_print_info --message="Declaring files to be backed up..."
#=================================================
ynh_print_info --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#================================================= #=================================================
# BACKUP THE MONGODB DATABASE # BACKUP THE MONGODB DATABASE
#================================================= #=================================================
@ -62,25 +63,6 @@ ynh_print_info --message="Backing up the MongoDB database..."
mongodump --quiet --db="$db_name" --out="./dump" mongodump --quiet --db="$db_name" --out="./dump"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_print_info --message="Backing up systemd configuration..."
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60
fi
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -34,12 +34,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#db_user=$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=db_pwd)
port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_print_info --message="Backing up the app before changing its url (may take a while)..." ynh_script_progression --message="Backing up the app before changing its url (may take a while)..."
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -74,14 +72,14 @@ fi
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_print_info --message="Stopping a systemd service..." ynh_script_progression --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
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_print_info --message="Updating nginx web server configuration..." ynh_script_progression --message="Updating nginx web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -112,18 +110,22 @@ fi
#================================================= #=================================================
# MODIFY URL IN .ENV # MODIFY URL IN .ENV
#================================================= #=================================================
ynh_print_info --message="Updating .env configuration..." ynh_script_progression --message="Updating .env configuration..."
ynh_backup_if_checksum_is_different --file="$final_path/.env"
ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_domain$new_path" --target_file="$final_path/.env" ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_domain$new_path" --target_file="$final_path/.env"
ynh_store_file_checksum --file="$final_path/.env"
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_print_info --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board" ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60 sleep 60
fi fi
@ -131,7 +133,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info --message="Reloading nginx web server..." ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -139,4 +141,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Change of URL completed for $app" ynh_script_progression --message="Change of URL completed for $app"

View file

@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting ynh_clean_check_starting
@ -25,7 +24,6 @@ ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
ynh_print_info --message="Retrieving arguments from the manifest..."
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
@ -37,7 +35,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_print_info --message="Validating installation parameters..." ynh_script_progression --message="Validating installation parameters..."
architecture=$(ynh_detect_arch) architecture=$(ynh_detect_arch)
# Check machine architecture (in particular, we don't support ARM and 32bit machines) # Check machine architecture (in particular, we don't support ARM and 32bit machines)
@ -55,7 +53,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_print_info --message="Storing installation settings..." ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
@ -66,7 +64,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_print_info --message="Configuring firewall..." ynh_script_progression --message="Configuring firewall..."
# Find an available port # Find an available port
port=$(ynh_find_port --port=8095) port=$(ynh_find_port --port=8095)
@ -75,7 +73,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_print_info --message="Installing dependencies..." ynh_script_progression --message="Installing dependencies..."
ynh_install_nodejs --nodejs_version=$nodejsversion ynh_install_nodejs --nodejs_version=$nodejsversion
ynh_use_nodejs ynh_use_nodejs
@ -91,7 +89,7 @@ fi
#================================================= #=================================================
# CREATE A MONGODB DATABASE # CREATE A MONGODB DATABASE
#================================================= #=================================================
ynh_print_info --message="Creating a MongoDB database..." ynh_script_progression --message="Creating a MongoDB database..."
# Start mongodb # Start mongodb
systemctl enable $mongodb_servicename systemctl enable $mongodb_servicename
@ -104,7 +102,7 @@ ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_print_info --message="Setting up source files..." ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
@ -113,7 +111,7 @@ ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info --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 ynh_add_nginx_config
@ -121,7 +119,7 @@ ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_print_info --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"
@ -131,7 +129,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_print_info --message="Configuring a systemd service..." ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --others_var="mongodb_servicename ynh_node" ynh_add_systemd_config --others_var="mongodb_servicename ynh_node"
@ -139,7 +137,7 @@ ynh_add_systemd_config --others_var="mongodb_servicename ynh_node"
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_print_info --message="Modifying a config file..." ynh_script_progression --message="Modifying a config file..."
# Create a dedicated .env config # Create a dedicated .env config
ynh_add_config ynh_add_config
@ -149,7 +147,7 @@ ynh_add_config
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
ynh_print_info --message="Securing files and directories..." ynh_script_progression --message="Securing files and directories..."
# Set strong right permissions to app files # Set strong right permissions to app files
chown -R $app: "$final_path" chown -R $app: "$final_path"
@ -159,18 +157,19 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_print_info --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Wekan daemon" yunohost service add $app --description "Wekan daemon" --log_type "systemd"
yunohost service add mongodb --description "MongoDB daemon" --log "/var/log/mongodb/mongodb.log" yunohost service add mongodb --description "MongoDB daemon" --log "/var/log/mongodb/mongodb.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_print_info --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Meteor APM: completed instrumenting the app" ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Meteor APM: completed instrumenting the app"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60 sleep 60
fi fi
@ -178,7 +177,7 @@ fi
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_print_info --message="Configuring SSOwat..." ynh_script_progression --message="Configuring SSOwat..."
ynh_permission_create --permission="admin" --allowed "$admin" ynh_permission_create --permission="admin" --allowed "$admin"
@ -191,7 +190,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info --message="Reloading nginx web server..." ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -199,4 +198,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Installation of $app completed" ynh_script_progression --message="Installation of $app completed"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -27,19 +27,18 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST # REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
ynh_print_info --message="Removing 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 >/dev/null if ynh_exec_warn_less yunohost service status $app >/dev/null
then then
ynh_print_info --message="Removing $app service..." ynh_script_progression --message="Removing $app service..."
yunohost service remove $app yunohost service remove $app
fi fi
#================================================= #=================================================
# STOP AND REMOVE SERVICE # STOP AND REMOVE SERVICE
#================================================= #=================================================
ynh_print_info --message="Stopping and removing the systemd service..." ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
@ -47,7 +46,7 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE THE MONGODB DATABASE # REMOVE THE MONGODB DATABASE
#================================================= #=================================================
ynh_print_info --message="Removing the MongoDB database..." ynh_script_progression --message="Removing the MongoDB database..."
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
mongo $db_name --eval "db.dropDatabase()" mongo $db_name --eval "db.dropDatabase()"
@ -55,7 +54,7 @@ mongo $db_name --eval "db.dropDatabase()"
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_print_info --message="Removing dependencies..." ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
@ -70,7 +69,7 @@ fi
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_print_info --message="Removing app main directory..." ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
@ -78,7 +77,7 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info --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 ynh_remove_nginx_config
@ -88,7 +87,7 @@ ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_print_info --message="Removing the dedicated system user..." ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app ynh_system_user_delete --username=$app
@ -97,4 +96,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Removal of $app completed" ynh_script_progression --message="Removal of $app completed"

View file

@ -6,13 +6,13 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
#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/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting ynh_clean_check_starting
@ -23,7 +23,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading settings..." ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -35,7 +35,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_print_info --message="Validating restoration parameters..." ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=$path_url \ ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"
@ -47,20 +47,21 @@ test ! -d $final_path \
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the nginx configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info --message="Restoring the app main directory..." ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_print_info --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"
@ -68,7 +69,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
ynh_print_info --message="Restoring user rights..." ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files # Restore permissions on app files
chown -R $app: "$final_path" chown -R $app: "$final_path"
@ -80,7 +81,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_print_info --message="Reinstalling dependencies..." ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies # Define and install dependencies
ynh_install_nodejs --nodejs_version=$nodejsversion ynh_install_nodejs --nodejs_version=$nodejsversion
@ -97,7 +98,7 @@ fi
#================================================= #=================================================
# RESTORE THE MONGODB DATABASE # RESTORE THE MONGODB DATABASE
#================================================= #=================================================
ynh_print_info --message="Restoring the MongoDB database..." ynh_script_progression --message="Restoring the MongoDB database..."
# Start mongodb # Start mongodb
systemctl enable $mongodb_servicename systemctl enable $mongodb_servicename
@ -107,7 +108,7 @@ mongorestore --quiet --db="$db_name" "./dump/$db_name"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
ynh_print_info --message="Restoring the systemd configuration..." ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service systemctl enable $app.service
@ -115,18 +116,18 @@ systemctl enable $app.service
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_print_info --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Wekan daemon"
yunohost service add mongodb --log "/var/log/mongodb/mongodb.log"
yunohost service add $app --description "Wekan daemon" --log_type "systemd"
yunohost service add mongodb --description "MongoDB daemon" --log "/var/log/mongodb/mongodb.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_print_info --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board" ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60 sleep 60
fi fi
@ -136,7 +137,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info --message="Reloading nginx web server..." ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -144,4 +145,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Restoration completed for $app" ynh_script_progression --message="Restoration completed for $app"

View file

@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -28,14 +28,14 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_print_info --message="Checking version..." ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_print_info --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
# If db_name doesn't exist, create it # If db_name doesn't exist, create it
if [ -z "$db_name" ]; then if [ -z "$db_name" ]; then
@ -57,7 +57,7 @@ previous_version="${version}"
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_print_info --message="Backing up the app before upgrading (may take a while)..." ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -80,36 +80,36 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url)
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_print_info --message="Stopping a systemd service..." ynh_script_progression --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
#================================================= #=================================================
# MANAGE UPGRADE FROM PREVIOUS VERSION # MANAGE UPGRADE FROM PREVIOUS VERSION
#================================================= #=================================================
ynh_print_info --message="Managing upgrade from previous version..." ynh_script_progression --message="Managing upgrade from previous version..."
if ynh_version_gt "0.45-2" "${previous_version}" ; then if ynh_version_gt "0.45-2" "${previous_version}" ; then
ynh_print_info --message="Upgrading to 0.45-2..." ynh_script_progression --message="Upgrading to 0.45-2..."
ynh_replace_string --match_string="Environment=ROOT_URL=http://127.0.0.1:$port$path_url" --replace_string="Environment=ROOT_URL=https://$domain$path_url/" --target_file="/etc/systemd/system/$app.service" ynh_replace_string --match_string="Environment=ROOT_URL=http://127.0.0.1:$port$path_url" --replace_string="Environment=ROOT_URL=https://$domain$path_url/" --target_file="/etc/systemd/system/$app.service"
systemctl daemon-reload systemctl daemon-reload
fi fi
if ynh_version_gt "0.45-3" "${previous_version}" ; then if ynh_version_gt "0.45-3" "${previous_version}" ; then
ynh_print_info --message="Upgrading to 0.45-3..." ynh_script_progression --message="Upgrading to 0.45-3..."
yunohost service add $app yunohost service add $app --description "Wekan daemon" --log_type "systemd"
fi fi
if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
ynh_print_info --message="Upgrading to 1.07~ynh2..." ynh_script_progression --message="Upgrading to 1.07~ynh2..."
# Replace mongodb packages # Replace mongodb packages
# Assume no other app needs it >.> # Assume no other app needs it >.>
rm -f /etc/apt/sources.list.d/mongodb-org-3.2.list rm -f /etc/apt/sources.list.d/mongodb-org-3.2.list
ynh_remove_app_dependencies ynh_remove_app_dependencies
ynh_install_app_dependencies "mongodb mongodb-server" ynh_install_app_dependencies "mongodb mongodb-server"
yunohost service remove mongod yunohost service add $app --description "Wekan daemon" --log_type "systemd"
yunohost service add mongodb --log "/var/log/mongodb/mongodb.log" yunohost service add mongodb --description "MongoDB daemon" --log "/var/log/mongodb/mongodb.log"
fi fi
if ynh_version_gt "2.56~ynh1" "${previous_version}" ; then if ynh_version_gt "2.56~ynh1" "${previous_version}" ; then
@ -121,7 +121,7 @@ fi
# Create the permission "admin" only if it doesn't exist. # Create the permission "admin" only if it doesn't exist.
if ! ynh_permission_exists --permission="admin" if ! ynh_permission_exists --permission="admin"
then then
ynh_print_info --message="Upgrading Permission configuration..." ynh_script_progression --message="Upgrading Permission configuration..."
ynh_app_setting_delete --app=$app --key=unprotected_uris ynh_app_setting_delete --app=$app --key=unprotected_uris
@ -142,7 +142,7 @@ fi
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_print_info --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# Create a temporary directory # Create a temporary directory
tmpdir="$(mktemp -d)" tmpdir="$(mktemp -d)"
@ -167,7 +167,7 @@ fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Upgrading nginx web server configuration..." ynh_script_progression --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -175,7 +175,7 @@ ynh_add_nginx_config
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_print_info --message="Upgrading dependencies..." ynh_script_progression --message="Upgrading dependencies..."
ynh_remove_nodejs ynh_remove_nodejs
ynh_install_nodejs --nodejs_version=$nodejsversion ynh_install_nodejs --nodejs_version=$nodejsversion
@ -192,7 +192,7 @@ fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_print_info --message="Making sure dedicated system user exists..." ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # 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"
@ -200,7 +200,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_print_info --message="Modifying a config file..." ynh_script_progression --message="Modifying a config file..."
# Create a dedicated .env config # Create a dedicated .env config
ynh_add_config ynh_add_config
@ -208,7 +208,7 @@ ynh_add_config
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_print_info --message="Upgrading systemd configuration..." ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --others_var="mongodb_servicename ynh_node" ynh_add_systemd_config --others_var="mongodb_servicename ynh_node"
@ -218,7 +218,7 @@ ynh_add_systemd_config --others_var="mongodb_servicename ynh_node"
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
ynh_print_info --message="Securing files and directories..." ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files # Set permissions on app files
chown -R $app: "$final_path" chown -R $app: "$final_path"
@ -228,9 +228,10 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_print_info --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board" ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board"
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60 sleep 60
fi fi
@ -238,7 +239,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info --message="Reloading nginx web server..." ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -246,4 +247,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Upgrade of $app completed" ynh_script_progression --message="Upgrade of $app completed"

View file

@ -16,7 +16,7 @@ abort_if_up_to_date () {
version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7') version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7')
last_version=$(read_manifest 'version') last_version=$(read_manifest 'version')
if [ "${version}" = "${last_version}" ]; then if [ "${version}" = "${last_version}" ]; then
ynh_print_info "Up-to-date, nothing to do" ynh_script_progression --message="Up-to-date, nothing to do"
ynh_die "" 0 ynh_die "" 0
fi fi
} }