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

Merge branch 'example_ynh' into testing

This commit is contained in:
yalh76 2019-02-05 16:00:59 +01:00 committed by GitHub
commit bdea8d1394
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 331 additions and 2714 deletions

2666
LICENSE

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,17 @@
# Wekan for Yunohost
[![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 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
Wekan is an open-source kanban board (task manager and organizer)
[![Integration level](https://dash.yunohost.org/integration/wekan.svg)](https://dash.yunohost.org/appci/app/wekan)
[![Install Wordpress with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wekan)
**Shipped version:** 2.09
## Screenshot
## Screenshots
![](screenshot.jpg)
@ -28,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

@ -5,4 +5,4 @@ SOURCE_SUM=1956dd19f17d76a6d820a15bcf93a3eb12172f9f5cb1dd40d9925b977e8f930d
SOURCE_SUM_PRG=sha256sum
ARCH_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=wekan-1.07.tar.gz
SOURCE_FILENAME=

View file

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

View file

@ -2,11 +2,11 @@
"name": "Wekan",
"id": "wekan",
"packaging_format": 1,
"version": "1.07~ynh2",
"description": {
"en": "Trello-like kanban",
"fr": "Un kanban similaire à Trello"
},
"version": "2.09~ynh2",
"url": "https://wekan.io",
"license": "MIT",
"maintainer": {
@ -19,8 +19,7 @@
},
"multi_instance": true,
"services": [
"nginx",
"mongod"
"nginx"
],
"arguments": {
"install" : [

13
scripts/_common.sh Normal file
View file

@ -0,0 +1,13 @@
#!/bin/bash
# ============= FUTURE YUNOHOST HELPER =============
# Delete a file checksum from the app settings
#
# $app should be defined when calling this helper
#
# usage: ynh_remove_file_checksum file
# | arg: file - The file for which the checksum will be deleted
ynh_delete_file_checksum () {
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
ynh_app_setting_delete $app $checksum_setting_name
}

View file

@ -5,6 +5,8 @@
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
@ -26,16 +28,25 @@ domain=$(ynh_app_setting_get $app domain)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP OF THE MAIN DIR OF THE APP
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup "$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# BACKUP OF MONGODB
# BACKUP THE MONGODB DATABASE
#=================================================
mongodump --db "$app" -o "./dump"

102
scripts/change_url Normal file
View file

@ -0,0 +1,102 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get $app final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get "$app" db_name)
#db_pwd=$(ynh_app_setting_get $app db_pwd)
#=================================================
# CHECK THE SYNTAX OF THE PATHS
#=================================================
test -n "$old_path" || old_path="/"
test -n "$new_path" || new_path="/"
new_path=$(ynh_normalize_url_path $new_path)
old_path=$(ynh_normalize_url_path $old_path)
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different "$nginx_conf_path"
# Set global variables for nginx helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
ynh_add_nginx_config
fi
# Change the domain for nginx
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum "$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx

View file

@ -1,9 +1,12 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source _future.sh
source ynh_systemd_action
source /usr/share/yunohost/helpers
@ -11,13 +14,14 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
@ -42,6 +46,9 @@ ynh_webpath_register $app $domain $path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app is_public $is_public
#=================================================
@ -90,12 +97,13 @@ ynh_system_user_create $app "$final_path"
#=================================================
# SPECIFIC SETUP
#=================================================
# Install wekan dependencies
ynh_print_info "Installing npm dependencies ..."
chown -R $app $final_path
pushd $final_path/programs/server
ynh_use_nodejs
npm install
ynh_use_nodejs
npm install
popd
# Start mogodb
@ -106,6 +114,7 @@ systemctl restart mongodb
#=================================================
# SETUP SYSTEMD
#=================================================
# Create a dedicated systemd config
ynh_print_info "Adding wekan systemd service ..."
ynh_replace_string "__NODEJS__" "$nodejs_use_version" "../conf/systemd.service"
@ -121,6 +130,7 @@ ynh_add_systemd_config
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_print_info "Fixing permissions ..."
# Set strong right permissions to app files
chown -R $app: "$final_path"
@ -130,6 +140,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750
#=================================================
# ADD SERVICE IN ADMIN PANEL
#=================================================
yunohost service add mongodb --log "/var/log/mongodb/mongodb.log"
yunohost service add $app
@ -137,11 +148,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 "/"
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set $app unprotected_uris "/"
fi
#=================================================

View file

@ -1,40 +1,49 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source _future.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
readonly app=$YNH_APP_INSTANCE_NAME
readonly domain=$(ynh_app_setting_get "$app" domain)
readonly final_path=$(ynh_app_setting_get "$app" final_path)
#=================================================
# 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
#=================================================
# Remove the dedicated 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
#=================================================
mongo $app --eval "db.dropDatabase()"
#=================================================
@ -50,23 +59,49 @@ 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

@ -5,6 +5,8 @@
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source ../settings/scripts/_future.sh
source ../settings/scripts/ynh_systemd_action
source /usr/share/yunohost/helpers
@ -24,35 +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_die "Path not available: ${domain}${path_url}"
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
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
# Define and install dependencies
ynh_install_nodejs 8.9.3
# Install mongodb
@ -61,6 +81,7 @@ ynh_install_app_dependencies "mongodb mongodb-server"
#=================================================
# RESTORE DB
#=================================================
# Start mogodb
systemctl enable mongodb
systemctl start mongodb
@ -73,37 +94,33 @@ 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
#=================================================
# Set strong right permissions to app files
chown -R $app: "$final_path"
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

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source _future.sh
source ynh_systemd_action
source /usr/share/yunohost/helpers
@ -25,6 +26,7 @@ port=$(ynh_app_setting_get $app port)
#=================================================
# Check version
#=================================================
abort_if_up_to_date
# previous function is what defines 'version', more precisely the 'previous version'
previous_version="${version}"
@ -33,11 +35,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
@ -47,9 +52,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
@ -61,6 +68,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
@ -83,7 +91,6 @@ if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
ynh_add_systemd_config
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -91,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"
#=================================================
@ -100,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
#=================================================