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

Apply example_ynh

This commit is contained in:
yalh76 2019-02-05 15:41:20 +01:00
parent e020faacaa
commit 0841560297
7 changed files with 147 additions and 58 deletions

View file

@ -1,9 +1,9 @@
# Wekan for Yunohost
[![Integration level](https://dash.yunohost.org/integration/REPLACEBYYOURAPP.svg)](https://dash.yunohost.org/appci/app/REPLACEBYYOURAPP)
[![Install REPLACEBYYOURAPP with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP)
[![Integration level](https://dash.yunohost.org/integration/wekan.svg)](https://dash.yunohost.org/appci/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 REPLACEBYYOURAPP quickly and simply on a YunoHost server.
> *This package allow 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.*
## Overview
@ -13,7 +13,7 @@ Wekan is an open-source kanban board (task manager and organizer)
## Screenshots
![](Link to an screenshot for this app)
![](screenshot.jpg)
## Status
@ -34,3 +34,31 @@ Wekan is an open-source kanban board (task manager and organizer)
**Private/Public mode:** In private mode, only authorized YunoHost members can access to the wekan.
**SSO/LDAP:** SSO and LDAP are not configured.
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/wekan%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/wekan/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/wekan%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/wekan/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/wekan%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/wekan/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/wekan_ynh/issues
* App website: https://wekan.github.io/
* Github app website: https://github.com/wekan/wekan
* YunoHost website: https://yunohost.org/
---
Developers info
----------------
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
Please do 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.
```
sudo yunohost app install https://github.com/YunoHost-Apps/wekan_ynh/tree/testing --debug
or
sudo yunohost app upgrade wekan -u https://github.com/YunoHost-Apps/wekan_ynh/tree/testing --debug
```

View file

@ -1,5 +1,7 @@
location __PATH__
{
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}

View file

@ -46,7 +46,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# BACKUP OF MONGODB
# BACKUP THE MONGODB DATABASE
#=================================================
mongodump --db "$app" -o "./dump"

View file

@ -143,11 +143,11 @@ yunohost service add $app
# SETUP SSOWAT
#=================================================
# Make app public if necessary or protect it
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set "$app" unprotected_uris "/"
ynh_app_setting_set $app unprotected_uris "/"
fi
#=================================================

View file

@ -20,21 +20,25 @@ readonly final_path=$(ynh_app_setting_get "$app" final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
ynh_remove_systemd_config
#=================================================
# DISABLE SERVICE IN ADMIN PANEL
#=================================================
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status | grep -q $app
then
echo "Remove $app service"
yunohost service remove $app
fi
yunohost service remove mongodb
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE DB
#=================================================
@ -53,23 +57,51 @@ ynh_remove_app_dependencies
ynh_remove_nodejs
#=================================================
# REMOVE THE MAIN DIR OF THE APP
# REMOVE APP MAIN DIR
#=================================================
ynh_secure_remove "/var/www/$app"
# Remove the app directory securely
ynh_secure_remove "$final_path"
#=================================================
# REMOVE THE NGINX CONFIGURATION
# REMOVE NGINX CONFIGURATION
#=================================================
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
echo "Close port $port" >&2
yunohost firewall disallow TCP $port 2>&1
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE CRON FILE
#=================================================
# Remove a cron file
#ynh_secure_remove "/etc/cron.d/$app"
# Remove a directory securely
ynh_secure_remove "/etc/$app/"
# Remove the log files
ynh_secure_remove "/var/log/$app/"
#=================================================
# GENERIC FINALISATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
# Delete a system user
ynh_system_user_delete $app

View file

@ -26,36 +26,53 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path)
port=$(ynh_app_setting_get $app final_path)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
yunohost app checkurl "${domain}${path_url}" -a "$app" \
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
|| ynh_die "There is already a directory: $final_path "
#=================================================
# STANDARD RESTORE STEPS
# STANDARD RESTORATION STEPS
#=================================================
ynh_restore
#=================================================
# CREATE DEDICATED USER
# RESTORE THE NGINX CONFIGURATION
#=================================================
# Create a system user
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_restore_file "$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
# Create the dedicated user (if not existing)
ynh_system_user_create $app "$final_path"
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
chown -R $app: $final_path
#=================================================
# INSTALL DEPENDENCIES
# SPECIFIC RESTORATION
#=================================================
ynh_install_nodejs 4.8.7
# REINSTALL DEPENDENCIES
#=================================================
# Define and install dependencies
ynh_install_nodejs 8.9.3
# Install mongodb
ynh_install_app_dependencies "mongodb mongodb-server"
@ -75,12 +92,10 @@ mongorestore --db $app ./dump/$app
# Install wekan dependencies
chown -R $app $final_path
pushd $final_path/programs/server
ynh_use_nodejs
npm install
ynh_use_nodejs
npm install
popd
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
@ -90,22 +105,18 @@ chmod -R 640 "$final_path"
find "$final_path" -type d -print0 | xargs -0 chmod 750
#=================================================
# ADD SERVICE IN ADMIN PANEL
# RESTORE SYSTEMD
#=================================================
ynh_restore_file "/etc/systemd/system/$app.service"
systemctl enable $app.service
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add mongodb --log "/var/log/mongodb/mongodb.log"
yunohost service add $app
#=================================================
# SETUP SSOWAT
#=================================================
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set "$app" unprotected_uris "/"
fi
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -34,11 +34,14 @@ previous_version="${version}"
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_backup_before_upgrade # Backup the current version of the app
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_restore_upgradebackup # restore it if the upgrade fails
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
ynh_abort_if_errors # 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
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
@ -48,9 +51,11 @@ if ynh_version_gt "0.45-2" "${previous_version}" ; then
ynh_replace_string "Environment=ROOT_URL=http://127.0.0.1:$port$path_url" "Environment=ROOT_URL=https://$domain$path_url/" "/etc/systemd/system/$app.service"
systemctl daemon-reload
fi
if ynh_version_gt "0.45-3" "${previous_version}" ; then
yunohost service add $app
fi
if ynh_version_gt "0.77-2" "${previous_version}" ; then
ynh_install_nodejs 8.9.3
# Create a dedicated systemd config
@ -62,6 +67,7 @@ if ynh_version_gt "0.77-2" "${previous_version}" ; then
ynh_replace_string "__DOMAIN__" "$domain" "../conf/systemd.service"
ynh_add_systemd_config
fi
if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
# Replace mongodb packages
@ -92,7 +98,6 @@ fi
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
# For this app sources are in app subdirectory
ynh_setup_source "$final_path"
#=================================================
@ -101,17 +106,28 @@ ynh_setup_source "$final_path"
# SECURE FILES AND DIRECTORIES
#=================================================
# Set strong right permissions to app files
# Set permissions on app files
chown -R $app: "$final_path"
chmod -R 640 "$final_path"
find "$final_path" -type d -print0 | xargs -0 chmod 750
# Relaunch a npm install
pushd $final_path/programs/server
ynh_use_nodejs
npm install
ynh_use_nodejs
npm install
popd
#=================================================
# SETUP SSOWAT
#=================================================
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set $app unprotected_uris "/"
fi
#=================================================
# RELOAD NGINX
#=================================================