1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/uptime-kuma_ynh.git synced 2024-10-01 13:34:58 +02:00
This commit is contained in:
Éric Gaspar 2024-10-01 07:43:31 +02:00
parent 6112291517
commit d0ee68531a
7 changed files with 9 additions and 57 deletions

2
doc/ADMIN_fr.md Normal file
View file

@ -0,0 +1,2 @@
- Cette application nécessite une post-installation manuelle
- Nous pourrions préconfigurer les notifications par courrier électronique avec le serveur de messagerie YunoHost en guise d'amélioration. Voir les commentaires dans le fichier pour essayer de le faire avec Curl et WebSockets ou Sqlite.

View file

@ -17,7 +17,7 @@ userdoc = "https://github.com/louislam/uptime-kuma/wiki"
code = "https://github.com/louislam/uptime-kuma" code = "https://github.com/louislam/uptime-kuma"
[integration] [integration]
yunohost = ">= 11.2.18" yunohost = ">= 11.2.30"
helpers_version = "2.1" helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,29 +12,15 @@ ynh_print_info "Declaring files to be backed up..."
ynh_backup "$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup "/etc/logrotate.d/$app" ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup "/var/log/$app/" ynh_backup "/var/log/$app/"
#================================================= #=================================================

View file

@ -15,26 +15,19 @@ ynh_nodejs_install
#================================================= #=================================================
ynh_script_progression "Setting up source files..." ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
# Download, check integrity, uncompress and patch the source from dist.src
ynh_setup_source --dest_dir="$install_dir/dist" --source_id="dist" ynh_setup_source --dest_dir="$install_dir/dist" --source_id="dist"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_script_progression "Adding system configurations related to $app..." ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config
ynh_config_add_nginx ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd ynh_config_add_systemd
# Use logrotate to manage application logfile(s)
ynh_config_add_logrotate ynh_config_add_logrotate
yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$app.log" yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$app.log"
@ -45,9 +38,8 @@ yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$
ynh_script_progression "Installing $app dependencies..." ynh_script_progression "Installing $app dependencies..."
pushd "$install_dir" pushd "$install_dir"
ynh_hide_warnings ynh_exec_as_app npm install --omit=dev
ynh_hide_warnings ynh_exec_as_app node_load_PATH npm install --omit=dev ynh_hide_warnings ynh_exec_as_app npm run download-dist
ynh_hide_warnings ynh_exec_as_app node_load_PATH npm run download-dist
popd popd
#================================================= #=================================================
@ -55,7 +47,6 @@ popd
#================================================= #=================================================
ynh_script_progression "Integrating service in YunoHost..." ynh_script_progression "Integrating service in YunoHost..."
# Start a systemd service
ynh_systemctl --service=$app --action="start" ynh_systemctl --service=$app --action="start"
#================================================= #=================================================

View file

@ -5,33 +5,21 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE SYSTEM CONFIGURATIONS # REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression "Removing system configurations related to $app..." ynh_script_progression "Removing system configurations related to $app..."
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_hide_warnings yunohost service status $app >/dev/null; then
if ynh_hide_warnings yunohost service status $app >/dev/null
then
ynh_script_progression "Removing $app service integration..."
yunohost service remove $app yunohost service remove $app
fi fi
# Remove the dedicated systemd config
ynh_config_remove_systemd ynh_config_remove_systemd
# Remove the app-specific logrotate config
ynh_config_remove_logrotate ynh_config_remove_logrotate
ynh_nodejs_remove ynh_nodejs_remove
# Remove the dedicated NGINX config
ynh_config_remove_nginx ynh_config_remove_nginx
# Remove the log files
#REMOVEME? (Apps should not remove their log dir during remove ... this should only happen if --purge is used, and be handled by the core...) ynh_safe_rm "/var/log/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -11,21 +10,16 @@ ynh_script_progression "Restoring the app main directory..."
ynh_restore "$install_dir" ynh_restore "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression "Reinstalling dependencies..." ynh_script_progression "Reinstalling dependencies..."
# Define and install dependencies
ynh_nodejs_install ynh_nodejs_install
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression "Restoring system configurations related to $app..." ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"

View file

@ -15,14 +15,10 @@ ynh_systemctl --service=$app --action="stop"
#================================================= #=================================================
ynh_script_progression "Upgrading source files..." ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
# Download, check integrity, uncompress and patch the source from dist.src
ynh_setup_source --dest_dir="$install_dir/dist" --source_id="dist" ynh_setup_source --dest_dir="$install_dir/dist" --source_id="dist"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
@ -30,13 +26,10 @@ ynh_script_progression "Upgrading system configurations related to $app..."
ynh_nodejs_install ynh_nodejs_install
# Create a dedicated NGINX config
ynh_config_add_nginx ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd ynh_config_add_systemd
# Use logrotate to manage app-specific logfile(s)
ynh_config_add_logrotate ynh_config_add_logrotate
yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$app.log" yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$app.log"
@ -45,9 +38,8 @@ yunohost service add $app --description="Monitoring tool" --log="/var/log/$app/$
ynh_script_progression "Upgrading $app dependencies..." ynh_script_progression "Upgrading $app dependencies..."
pushd "$install_dir" pushd "$install_dir"
ynh_hide_warnings ynh_exec_as_app npm install --omit=dev
ynh_hide_warnings ynh_exec_as_app node_load_PATH npm install --omit=dev ynh_hide_warnings ynh_exec_as_app npm run download-dist
ynh_hide_warnings ynh_exec_as_app node_load_PATH npm run download-dist
# Residue of old versions caching # Residue of old versions caching
ynh_safe_rm $install_dir/.cache ynh_safe_rm $install_dir/.cache
popd popd