1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/scrumblr_ynh.git synced 2024-09-03 20:16:29 +02:00
scrumblr_ynh/scripts/install
Éric Gaspar 32e7b4ff1b fix
2023-12-27 10:55:21 +01:00

75 lines
2.3 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=5
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=5
ynh_setup_source --dest_dir="$install_dir"
#==================================================
# CONFIGURE REDIS SERVICE
#==================================================
ynh_add_config --template="redis.conf" --destination="$install_dir/redis.conf"
redis_service="redis-$app"
ynh_add_systemd_config --service $redis_service --template scrumblr_redis.service
chmod 770 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_nginx_config
ynh_use_logrotate
chown -R $app:$app "/var/log/$app/"
ynh_add_systemd_config
yunohost service add $app --description="Software for notes" --log="/var/log/$app/$app.log"
#=================================================
# INSTALL SCRUMBLR
#=================================================
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less $ynh_npm install
popd
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Server running at "
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last