mirror of
https://github.com/YunoHost-Apps/scrumblr_ynh.git
synced 2024-09-03 20:16:29 +02:00
use custom redis instance
This commit is contained in:
parent
75763c88c8
commit
a310de9974
4 changed files with 67 additions and 1 deletions
|
@ -59,6 +59,21 @@ ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
port=$(ynh_find_port --port=8080)
|
port=$(ynh_find_port --port=8080)
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
|
#==================================================
|
||||||
|
# CONFIGURE REDIS SERVICE
|
||||||
|
#==================================================
|
||||||
|
|
||||||
|
ynh_install_app_dependencies redis-server redis-tools
|
||||||
|
|
||||||
|
# Find an available port for redis
|
||||||
|
redis_port=$(ynh_find_port --port=8081)
|
||||||
|
ynh_app_setting_set --app=$app --key=redis_port --value=$redis_port
|
||||||
|
|
||||||
|
ynh_add_config --template="redis.conf" --destination="$final_path/redis.conf"
|
||||||
|
|
||||||
|
redis_service="redis-$app$"
|
||||||
|
ynh_add_systemd_config --service $redis_service --template scrumblr_redis
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL NODEJS
|
# INSTALL NODEJS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -66,6 +81,8 @@ ynh_script_progression --message="Installing dependencies..." --weight=5
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -57,6 +57,10 @@ ynh_script_progression --message="Removing dependencies..." --weight=2
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_nodejs
|
ynh_remove_nodejs
|
||||||
|
|
||||||
|
ynh_script_progression --message="Removing redis service" --weight=2
|
||||||
|
|
||||||
|
ynh_remove_systemd_config --service="redis-$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -84,6 +84,14 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE redis service
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the redis configuration..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/systemd/system/redis-$app.service"
|
||||||
|
systemctl enable "redis-$app.service" --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -103,7 +111,7 @@ yunohost service add $app --description="Software for notes" --log="/var/log/$ap
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Server running at port"
|
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Server running at"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -20,6 +20,10 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
if [ $(ynh_compare_current_package_version --comparison gt --version "0.2.0~ynh1" ]
|
||||||
|
then
|
||||||
|
redis_port=$(ynh_app_setting_get --app=$app --key=redis_port)
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -50,6 +54,10 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
|
if [ $(ynh_compare_current_package_version --comparison lt --version "0.2.0~ynh2" ]
|
||||||
|
then
|
||||||
|
ynh_systemd_action --service_name=redis-$app --action="stop" --log_path="/var/log/$app/redis-$app.log"ls
|
||||||
|
fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -100,6 +108,35 @@ then
|
||||||
ynh_exec_warn_less $ynh_npm install
|
ynh_exec_warn_less $ynh_npm install
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MIGRATE DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="migrating database..." --weight=1
|
||||||
|
|
||||||
|
if [ $(ynh_compare_current_package_version "0.2.0~ynh1" ]
|
||||||
|
then
|
||||||
|
pushd $final_path
|
||||||
|
redis-cli --rdb "redis-$app.rdb"
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REDIS CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ $(ynh_compare_current_package_version --comparison lt --version "0.2.0~ynh2" ]
|
||||||
|
then
|
||||||
|
# Find an available port for redis
|
||||||
|
redis_port=$(ynh_find_port --port=8081)
|
||||||
|
ynh_app_setting_set --app=$app --key=redis_port --value=$redis_port
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_add_config --template="redis.conf" --destination="$final_path/redis.conf"
|
||||||
|
|
||||||
|
redis_service="redis-$app$"
|
||||||
|
ynh_add_systemd_config --service $redis_service --template scrumblr_redis
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue