1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yunomonitor_ynh.git synced 2024-09-03 17:46:11 +02:00
This commit is contained in:
ericgaspar 2021-08-23 11:55:13 +02:00
parent 25063b4cee
commit 917d2f0592
4 changed files with 28 additions and 29 deletions

View file

@ -4,6 +4,8 @@ After=network.target
[Service]
Type=oneshot
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__
ExecStart=__FINALPATH__/yunomonitor.py -c __FINALPATH__/conf/__APP__.yml
User=root

View file

@ -28,6 +28,7 @@ ynh_export () {
}
# Save listed var in YunoHost app settings
# usage: ynh_save_args VARNAME1 [VARNAME2 [...]]
ynh_save_args () {
for var in $@;
do

View file

@ -45,6 +45,14 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_save_args domain path_url monitored_servers monitoring_servers mails sms_api
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -63,6 +71,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -77,14 +89,6 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path"
ynh_store_file_checksum --file="$finalnginxconf"
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# SPECIFIC SETUP
#=================================================
@ -134,8 +138,6 @@ echo "method level server message target" > $final_path/conf/ignore_alert.csv
#=================================================
# Set permissions to app files
chown -R root: $final_path
chown $app:$app $final_path/yunomonitor.py
chmod u+x $final_path/yunomonitor.py
chmod u+w $final_path/conf
chmod u+w $final_path/well-known

View file

@ -48,6 +48,14 @@ ynh_clean_setup () {
## Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -62,6 +70,11 @@ then
ynh_setup_source --dest_dir="$final_path"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod u+x $final_path/yunomonitor.py
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -83,14 +96,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# SETUP SYSTEMD
#=================================================
@ -109,17 +114,6 @@ ynh_backup_if_checksum_is_different --file="$final_path/conf/$app.yml"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/conf/$app.yml"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R root: $final_path
chown $app:$app $final_path/yunomonitor.py
chmod u+x $final_path/yunomonitor.py
#=================================================
# RELOAD NGINX
#=================================================