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 'master' into testing

This commit is contained in:
ljf 2019-01-28 23:34:54 +01:00
commit 5937f0aaf9
8 changed files with 63 additions and 49 deletions

View file

@ -1,6 +1,8 @@
SOURCE_URL=https://releases.wekan.team/wekan-1.02.tar.gz
SOURCE_SUM=892efb817ef3b7db34abd5c42f9751953338fea027db74babcf66cf5d2f4549e
# This is on YunoHost server just to avoid the file from disappearing
# Original source is https://releases.wekan.team/
SOURCE_URL=https://build.yunohost.org/apps/wekan-1.07.tar.gz
SOURCE_SUM=34105938c067b6ebcacaa3e2472061c919eb9e00aaa8e114c0e6b31a89772735
SOURCE_SUM_PRG=sha256sum
ARCH_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=wekan-1.02.tar.gz
SOURCE_FILENAME=wekan-1.07.tar.gz

View file

@ -1,7 +1,7 @@
[Unit]
Description=Wekan, task board
Wants=mongod.service
After=network.target mongod.service
Wants=mongodb.service
After=network.target mongodb.service
[Service]
Type=simple

View file

@ -2,7 +2,7 @@
"name": "Wekan",
"id": "wekan",
"packaging_format": 1,
"version": "1.02~ynh2",
"version": "1.07~ynh2",
"description": {
"en": "Trello-like kanban",
"fr": "Un kanban similaire à Trello"
@ -15,7 +15,7 @@
"url": "https://github.com/alexAubin/"
},
"requirements": {
"yunohost": ">= 2.7.2"
"yunohost": ">= 3.0.0"
},
"multi_instance": true,
"services": [

View file

@ -160,6 +160,7 @@ ynh_remove_nodejs () {
ynh_secure_remove "$n_install_dir"
ynh_secure_remove "/usr/local/n"
sed --in-place "/N_PREFIX/d" /root/.bashrc
rm -f /etc/cron.daily/node_update
fi
}
@ -210,4 +211,7 @@ EOF
chmod +x "/etc/cron.daily/node_update"
}
ynh_version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
ynh_version_gt ()
{
dpkg --compare-versions "$1" gt "$2"
}

View file

@ -48,18 +48,18 @@ ynh_app_setting_set $app port $port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing nodejs ..."
ynh_install_nodejs 8.9.3
# Install mongodb
wget https://www.mongodb.org/static/pgp/server-3.2.asc -O - | apt-key add -
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
ynh_install_app_dependencies "mongodb-org mongodb-org-server mongodb-org-shell mongodb-org-mongos mongodb-org-tools"
ynh_print_info "Installing mongodb dependencies ..."
ynh_install_app_dependencies "mongodb mongodb-server"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Setting up Wekan's sources ..."
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
# For this app sources are in app subdirectory
@ -68,7 +68,9 @@ ynh_setup_source "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
# Create a dedicated nginx config
ynh_print_info "Configuring nginx ..."
ynh_add_nginx_config
#=================================================
@ -82,6 +84,7 @@ 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
@ -89,13 +92,15 @@ npm install
popd
# Start mogodb
systemctl enable mongod
systemctl restart mongod
ynh_print_info "Starting mongodb ..."
systemctl enable mongodb
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"
ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
ynh_replace_string "__DB_NAME__" "$app" "../conf/systemd.service"
@ -109,6 +114,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"
chmod -R 640 "$final_path"
@ -117,7 +123,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750
#=================================================
# ADD SERVICE IN ADMIN PANEL
#=================================================
yunohost service add mongod --log "/var/log/mongodb.log"
yunohost service add mongodb --log "/var/log/mongodb/mongodb.log"
yunohost service add $app
#=================================================
@ -134,5 +140,9 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Starting wekan ..."
systemctl restart $app
systemctl reload nginx
ynh_print_info "Waiting for wekan to be up ..."
sleep 10

View file

@ -49,23 +49,12 @@ ynh_remove_app_dependencies
ynh_remove_nodejs
#=================================================
# REMOVE MONGODB
#=================================================
# TODO / FIXME : remove the keys added ?
#apt-key del EA312927
#apt-key del 0C49F3730359A14518585931BC711F9BA15703C6
#rm -f /etc/apt/sources.list.d/mongodb-org-3.2.list
#=================================================
# REMOVE THE MAIN DIR OF THE APP
#=================================================
ynh_secure_remove "/var/www/$app"
#=================================================
# REMOVE THE NGINX CONFIGURATION
#=================================================

View file

@ -55,17 +55,14 @@ ynh_system_user_create $app "$final_path"
ynh_install_nodejs 4.8.7
# Install mongodb
wget https://www.mongodb.org/static/pgp/server-3.2.asc -O - | apt-key add -
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.2.list
ynh_install_app_dependencies "mongodb-org mongodb-org-server mongodb-org-shell mongodb-org-mongos mongodb-org-tools"
ynh_install_app_dependencies "mongodb mongodb-server"
#=================================================
# RESTORE DB
#=================================================
# Start mogodb
systemctl enable mongod
systemctl start mongod
systemctl enable mongodb
systemctl start mongodb
mongorestore --db $app ./dump
#=================================================
@ -92,7 +89,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750
#=================================================
# ADD SERVICE IN ADMIN PANEL
#=================================================
yunohost service add mongod --log "/var/log/mongodb.log"
yunohost service add mongodb --log "/var/log/mongodb/mongodb.log"
yunohost service add $app
#=================================================

View file

@ -25,6 +25,8 @@ 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}"
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -40,25 +42,14 @@ ynh_abort_if_errors # Exit if an error occurs during the execution of the script
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
if ynh_version_gt "0.45-2" "${version}" ; then
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" "${version}" ; then
if ynh_version_gt "0.45-3" "${previous_version}" ; then
yunohost service add $app
fi
if ynh_version_gt "0.54-2" "${version}" ; then
systemctl enable mongod
systemctl restart mongod
fi
if ynh_version_gt "0.54-3" "${version}" ; then
apt-key del EA312927
wget https://www.mongodb.org/static/pgp/server-3.2.asc -O - | apt-key add -
fi
if ynh_version_gt "0.63-1" "${version}" ; then
ynh_install_nodejs 4.8.7
fi
if ynh_version_gt "0.77-2" "${version}" ; then
if ynh_version_gt "0.77-2" "${previous_version}" ; then
ynh_install_nodejs 8.9.3
# Create a dedicated systemd config
ynh_replace_string "__NODEJS__" "$nodejs_use_version" "../conf/systemd.service"
@ -69,6 +60,27 @@ if ynh_version_gt "0.77-2" "${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
# Assume no other app needs it >.>
rm -f /etc/apt/sources.list.d/mongodb-org-3.2.list
ynh_remove_app_dependencies
ynh_install_app_dependencies "mongodb mongodb-server"
yunohost service remove mongod
yunohost service add mongodb --log "/var/log/mongodb/mongodb.log"
# Gotta regen the systemd config because mongodb service name changed
nodejs_version=$(ynh_app_setting_get $app nodejs_version)
nodejs_use_version="$n_install_dir/bin/n -q $nodejs_version"
ynh_replace_string "__NODEJS__" "$nodejs_use_version" "../conf/systemd.service"
ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
ynh_replace_string "__DB_NAME__" "$app" "../conf/systemd.service"
ynh_replace_string "__URI__" "$path_url/" "../conf/systemd.service"
ynh_replace_string "__PORT__" "$port" "../conf/systemd.service"
ynh_replace_string "__DOMAIN__" "$domain" "../conf/systemd.service"
ynh_add_systemd_config
fi
#=================================================