mirror of
https://github.com/YunoHost-Apps/wekan_ynh.git
synced 2024-09-03 20:36:09 +02:00
Merge pull request #30 from yalh76/testing
Fix Restore + Ready for Level 7 Package_check
This commit is contained in:
commit
49f85a0ad6
7 changed files with 136 additions and 25 deletions
20
README.md
20
README.md
|
@ -1,16 +1,23 @@
|
||||||
# Wekan for Yunohost
|
# Wekan for Yunohost
|
||||||
|
|
||||||
Attempt to package Wekan for Yunohost....
|
Wekan is an open-source kanban board (task manager and organizer)
|
||||||
|
|
||||||
|
[](https://dash.yunohost.org/appci/app/wekan)
|
||||||
|
[](https://install-app.yunohost.org/?app=wekan)
|
||||||
|
|
||||||
|
## Screenshot
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
For the moment it kind of works, but this is still experimental and has not been much tested. DO NOT DEPLOY IN PRODUCTION.
|
- This app only works on x86, 64bits architecture ! In particular, it won't work on 32 bit machines or ARM. See the discussion [here](https://github.com/YunoHost-Apps/wekan_ynh/issues/1#issuecomment-401612500). On the long term, [support for ARM64 might happen](https://blog.wekan.team/2018/01/wekan-progress-on-x64-and-arm/index.html)...
|
||||||
|
|
||||||
The main drawback at the moment is that it's [not integrated with the LDAP](https://github.com/wekan/wekan/issues/119). So users have to create accounts (and can create infinite number of accounts) manually, and need to login manually specifically in Wekan.
|
- There is currently no SSO/LDAP integration though it might be integrated at some point in the app, now that it's supported in Meteor/Wekan. c.f. discussion in [here](https://github.com/YunoHost-Apps/wekan_ynh/issues/4). In the meantime, users can create accounts (in fact, they can create infinite number of accounts) manually, and need to login manually specifically in Wekan.
|
||||||
|
|
||||||
## Infos
|
## Infos
|
||||||
**Package by:** ljf & Aleks
|
|
||||||
|
|
||||||
|
**Package by:** ljf & Aleks
|
||||||
**Categories:** Productivity, Task
|
**Categories:** Productivity, Task
|
||||||
|
|
||||||
**Upgrade this package:**
|
**Upgrade this package:**
|
||||||
|
@ -21,8 +28,3 @@ The main drawback at the moment is that it's [not integrated with the LDAP](http
|
||||||
**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.
|
||||||
|
|
||||||
## To-do
|
|
||||||
|
|
||||||
- Test / make it work on ARM
|
|
||||||
- LDAP is not yet integrated in Wekan, unfortunately... but some people did tweak things as discussed [here](https://github.com/wekan/wekan/issues/119#issuecomment-224319252)
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
port_already_use=1
|
port_already_use=1
|
||||||
change_url=1
|
change_url=0
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
|
|
BIN
screenshot.jpg
Normal file
BIN
screenshot.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 123 KiB |
|
@ -5,6 +5,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
source _future.sh
|
source _future.sh
|
||||||
|
source ynh_systemd_action
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -146,9 +147,12 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Starting wekan ..."
|
|
||||||
systemctl restart $app
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
ynh_print_info "Waiting for wekan to be up ..."
|
#=================================================
|
||||||
|
# START SERVICE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Finishing add-custom-html-before-body-end migration"
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
source ../settings/scripts/_future.sh
|
source ../settings/scripts/_future.sh
|
||||||
|
source ../settings/scripts/ynh_systemd_action
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -31,7 +32,7 @@ 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 "
|
||||||
|
@ -52,7 +53,7 @@ ynh_system_user_create $app "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_install_nodejs 4.8.7
|
ynh_install_nodejs 8.9.3
|
||||||
|
|
||||||
# Install mongodb
|
# Install mongodb
|
||||||
ynh_install_app_dependencies "mongodb mongodb-server"
|
ynh_install_app_dependencies "mongodb mongodb-server"
|
||||||
|
@ -63,18 +64,18 @@ ynh_install_app_dependencies "mongodb mongodb-server"
|
||||||
# Start mogodb
|
# Start mogodb
|
||||||
systemctl enable mongodb
|
systemctl enable mongodb
|
||||||
systemctl start mongodb
|
systemctl start mongodb
|
||||||
mongorestore --db $app ./dump
|
mongorestore --db $app ./dump/$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Install wekan dependencies
|
# Install wekan dependencies
|
||||||
chown -R $app $final_path
|
#chown -R $app $final_path
|
||||||
pushd $final_path/bundle/programs/server
|
#pushd $final_path/programs/server
|
||||||
ynh_use_nodejs
|
#ynh_use_nodejs
|
||||||
npm install
|
#npm install
|
||||||
popd
|
#popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -106,5 +107,12 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
systemctl restart $app
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SERVICE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_systemd_action --action=start --service_name=$app --log_path="systemd"
|
||||||
|
sleep 10
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _future.sh
|
source _future.sh
|
||||||
|
source ynh_systemd_action
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -113,5 +114,12 @@ popd
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
systemctl restart $app
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SERVICE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_systemd_action --action=restart --service_name=$app --log_path="systemd"
|
||||||
|
sleep 10
|
||||||
|
|
89
scripts/ynh_systemd_action
Normal file
89
scripts/ynh_systemd_action
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
|
||||||
|
#
|
||||||
|
# usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ]
|
||||||
|
# | arg: -n, --service_name= - Name of the service to reload. Default : $app
|
||||||
|
# | arg: -a, --action= - Action to perform with systemctl. Default: start
|
||||||
|
# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot.
|
||||||
|
# If not defined it don't wait until the service is completely started.
|
||||||
|
# | arg: -p, --log_path= - Log file - Path to the log file. Default : /var/log/$app/$app.log
|
||||||
|
# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds.
|
||||||
|
# | arg: -e, --length= - Length of the error log : Default : 20
|
||||||
|
ynh_systemd_action() {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= )
|
||||||
|
local service_name
|
||||||
|
local action
|
||||||
|
local line_match
|
||||||
|
local length
|
||||||
|
local log_path
|
||||||
|
local timeout
|
||||||
|
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
local service_name="${service_name:-$app}"
|
||||||
|
local action=${action:-start}
|
||||||
|
local log_path="${log_path:-/var/log/$service_name/$service_name.log}"
|
||||||
|
local length=${length:-20}
|
||||||
|
local timeout=${timeout:-300}
|
||||||
|
|
||||||
|
# Start to read the log
|
||||||
|
if [[ -n "${line_match:-}" ]]
|
||||||
|
then
|
||||||
|
local templog="$(mktemp)"
|
||||||
|
# Following the starting of the app in its log
|
||||||
|
if [ "$log_path" == "systemd" ] ; then
|
||||||
|
# Read the systemd journal
|
||||||
|
journalctl -u $service_name -f --since=-45 > "$templog" &
|
||||||
|
else
|
||||||
|
# Read the specified log file
|
||||||
|
tail -F -n0 "$log_path" > "$templog" &
|
||||||
|
fi
|
||||||
|
# Get the PID of the tail command
|
||||||
|
local pid_tail=$!
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${action^} the service $service_name" >&2
|
||||||
|
systemctl $action $service_name \
|
||||||
|
|| ( journalctl --lines=$length -u $service_name >&2 \
|
||||||
|
; test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \
|
||||||
|
; false )
|
||||||
|
|
||||||
|
# Start the timeout and try to find line_match
|
||||||
|
if [[ -n "${line_match:-}" ]]
|
||||||
|
then
|
||||||
|
local i=0
|
||||||
|
for i in $(seq 1 $timeout)
|
||||||
|
do
|
||||||
|
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
||||||
|
if grep --quiet "$line_match" "$templog"
|
||||||
|
then
|
||||||
|
echo "The service $service_name has correctly started." >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo -n "." >&2
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
if [ $i -eq $timeout ]
|
||||||
|
then
|
||||||
|
echo "The service $service_name didn't fully started before the timeout." >&2
|
||||||
|
journalctl --lines=$length -u $service_name >&2
|
||||||
|
test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
ynh_clean_check_starting
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Clean temporary process and file used by ynh_check_starting
|
||||||
|
# (usually used in ynh_clean_setup scripts)
|
||||||
|
#
|
||||||
|
# usage: ynh_clean_check_starting
|
||||||
|
ynh_clean_check_starting () {
|
||||||
|
# Stop the execution of tail.
|
||||||
|
kill -s 15 $pid_tail 2>&1
|
||||||
|
ynh_secure_remove "$templog" 2>&1
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue