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:
parent
e020faacaa
commit
0841560297
7 changed files with 147 additions and 58 deletions
36
README.md
36
README.md
|
@ -1,9 +1,9 @@
|
||||||
# Wekan for Yunohost
|
# Wekan for Yunohost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/REPLACEBYYOURAPP)
|
[](https://dash.yunohost.org/appci/app/wekan)
|
||||||
[](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP)
|
[](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.*
|
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
@ -13,7 +13,7 @@ Wekan is an open-source kanban board (task manager and organizer)
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Status
|
## 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.
|
**Private/Public mode:** In private mode, only authorized YunoHost members can access to the wekan.
|
||||||
|
|
||||||
**SSO/LDAP:** SSO and LDAP are not configured.
|
**SSO/LDAP:** SSO and LDAP are not configured.
|
||||||
|
|
||||||
|
#### Supported architectures
|
||||||
|
|
||||||
|
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/wekan/)
|
||||||
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/wekan/)
|
||||||
|
* Jessie x86-64b - [](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
|
||||||
|
```
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
location __PATH__
|
location __PATH__
|
||||||
{
|
{
|
||||||
|
|
||||||
|
# Force usage of https
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
ynh_backup "/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP OF MONGODB
|
# BACKUP THE MONGODB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
mongodump --db "$app" -o "./dump"
|
mongodump --db "$app" -o "./dump"
|
||||||
|
|
|
@ -143,11 +143,11 @@ yunohost service add $app
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Make app public if necessary or protect it
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -19,22 +19,26 @@ readonly final_path=$(ynh_app_setting_get "$app" final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SERVICE FROM ADMIN PANEL
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# 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
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DISABLE SERVICE IN ADMIN PANEL
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
|
|
||||||
then
|
|
||||||
echo "Remove $app service"
|
|
||||||
yunohost service remove $app
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DB
|
# REMOVE DB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -53,16 +57,43 @@ ynh_remove_app_dependencies
|
||||||
ynh_remove_nodejs
|
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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_remove_nginx_config
|
# 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
|
# GENERIC FINALISATION
|
||||||
|
@ -70,6 +101,7 @@ ynh_remove_nginx_config
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Delete a system user
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete $app
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,36 +26,53 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
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)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
port=$(ynh_app_setting_get $app final_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# 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}"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
test ! -d $final_path \
|
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
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# 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"
|
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
|
# Install mongodb
|
||||||
ynh_install_app_dependencies "mongodb mongodb-server"
|
ynh_install_app_dependencies "mongodb mongodb-server"
|
||||||
|
@ -75,12 +92,10 @@ mongorestore --db $app ./dump/$app
|
||||||
# Install wekan dependencies
|
# Install wekan dependencies
|
||||||
chown -R $app $final_path
|
chown -R $app $final_path
|
||||||
pushd $final_path/programs/server
|
pushd $final_path/programs/server
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
npm install
|
npm install
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -90,22 +105,18 @@ chmod -R 640 "$final_path"
|
||||||
find "$final_path" -type d -print0 | xargs -0 chmod 750
|
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 mongodb --log "/var/log/mongodb/mongodb.log"
|
||||||
yunohost service add $app
|
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
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -34,11 +34,14 @@ previous_version="${version}"
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# 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_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
|
# 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"
|
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
|
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
|
||||||
yunohost service add $app
|
yunohost service add $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ynh_version_gt "0.77-2" "${previous_version}" ; then
|
if ynh_version_gt "0.77-2" "${previous_version}" ; then
|
||||||
ynh_install_nodejs 8.9.3
|
ynh_install_nodejs 8.9.3
|
||||||
# Create a dedicated systemd config
|
# 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_replace_string "__DOMAIN__" "$domain" "../conf/systemd.service"
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
|
if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
|
||||||
|
|
||||||
# Replace mongodb packages
|
# Replace mongodb packages
|
||||||
|
@ -92,7 +98,6 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
# For this app sources are in app subdirectory
|
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -101,17 +106,28 @@ ynh_setup_source "$final_path"
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set strong right permissions to app files
|
# Set permissions on app files
|
||||||
chown -R $app: "$final_path"
|
chown -R $app: "$final_path"
|
||||||
chmod -R 640 "$final_path"
|
chmod -R 640 "$final_path"
|
||||||
find "$final_path" -type d -print0 | xargs -0 chmod 750
|
find "$final_path" -type d -print0 | xargs -0 chmod 750
|
||||||
|
|
||||||
# Relaunch a npm install
|
# Relaunch a npm install
|
||||||
pushd $final_path/programs/server
|
pushd $final_path/programs/server
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
npm install
|
npm install
|
||||||
popd
|
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
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue