mirror of
https://github.com/YunoHost-Apps/uptime-kuma_ynh.git
synced 2024-10-01 13:34:58 +02:00
Merge branch 'testing'
This commit is contained in:
commit
339f104845
14 changed files with 295 additions and 335 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*~
|
*~
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
|
.DS_Store
|
18
README.md
18
README.md
|
@ -40,25 +40,11 @@ It is a self-hosted monitoring tool like "Uptime Robot".
|
||||||
## Disclaimers / important information
|
## Disclaimers / important information
|
||||||
|
|
||||||
- Requires a full dedicated domain
|
- Requires a full dedicated domain
|
||||||
|
- node_modules folder is backed up and shouldn't be (600Mo...)
|
||||||
- ARM architecture not supported
|
- ARM architecture not supported
|
||||||
- This app needs a manual post-install
|
- This app needs a manual post-install
|
||||||
- No upgrade script in this package
|
|
||||||
- No restore script in this package
|
|
||||||
- Backup script is untested in this package
|
|
||||||
- Uses N to install specific nodejs version
|
- Uses N to install specific nodejs version
|
||||||
<!-- * Any known limitations, constrains or stuff not working, such as (but not limited to):
|
- We could pre-configure mail notifications with YunoHost mail server as an improvement.
|
||||||
* requiring a full dedicated domain ?
|
|
||||||
* architectures not supported ?
|
|
||||||
* not-working single-sign on or LDAP integration ?
|
|
||||||
* the app requires an important amount of RAM / disk / .. to install or to work properly
|
|
||||||
* etc...
|
|
||||||
|
|
||||||
|
|
||||||
- Other infos that people should be aware of, such as:
|
|
||||||
- any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
|
|
||||||
- how to configure / administrate the application if it ain't obvious
|
|
||||||
- upgrade process / specificities / things to be aware of ?
|
|
||||||
- security considerations ? -->
|
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
|
|
18
README_fr.md
18
README_fr.md
|
@ -36,25 +36,11 @@ It is a self-hosted monitoring tool like "Uptime Robot".
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
- Requires a full dedicated domain
|
- Requires a full dedicated domain
|
||||||
|
- node_modules folder is backed up and shouldn't be (600Mo...)
|
||||||
- ARM architecture not supported
|
- ARM architecture not supported
|
||||||
- This app needs a manual post-install
|
- This app needs a manual post-install
|
||||||
- No upgrade script in this package
|
|
||||||
- No restore script in this package
|
|
||||||
- Backup script is untested in this package
|
|
||||||
- Uses N to install specific nodejs version
|
- Uses N to install specific nodejs version
|
||||||
<!-- * Any known limitations, constrains or stuff not working, such as (but not limited to):
|
- We could pre-configure mail notifications with YunoHost mail server as an improvement.
|
||||||
* requiring a full dedicated domain ?
|
|
||||||
* architectures not supported ?
|
|
||||||
* not-working single-sign on or LDAP integration ?
|
|
||||||
* the app requires an important amount of RAM / disk / .. to install or to work properly
|
|
||||||
* etc...
|
|
||||||
|
|
||||||
|
|
||||||
- Other infos that people should be aware of, such as:
|
|
||||||
- any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
|
|
||||||
- how to configure / administrate the application if it ain't obvious
|
|
||||||
- upgrade process / specificities / things to be aware of ?
|
|
||||||
- security considerations ? -->
|
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
|
|
|
@ -6,21 +6,18 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
path="/path"
|
path="/"
|
||||||
admin="john"
|
|
||||||
language="fr"
|
|
||||||
is_public=1
|
is_public=1
|
||||||
password="1Strong-Password"
|
|
||||||
port="666"
|
port="666"
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=0
|
||||||
setup_root=1
|
setup_root=1
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
upgrade=1 from_commit=CommitHash
|
upgrade=1 from_commit=20c58daa4be910e554058914633f9a94500bc7e1
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
@ -29,6 +26,6 @@
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=CommitHash
|
; commit=20c58daa4be910e554058914633f9a94500bc7e1
|
||||||
name=Name and date of the commit.
|
name="Merge pull request #1 from YunoHost-Apps/helper-in-service"
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
manifest_arg=domain=domain.td&path=/&is_public=1&port=666&
|
||||||
|
|
7
conf/dist.src
Normal file
7
conf/dist.src
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SOURCE_URL=https://github.com/louislam/uptime-kuma/releases/download/1.10.0/dist.tar.gz
|
||||||
|
SOURCE_SUM=f9f41507b427f155cb6a9bbc136ebba87587fd51c6d11e1999e5a66cc4249e6e
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=dist.tar.gz
|
||||||
|
SOURCE_EXTRACT=true
|
|
@ -1,5 +1,5 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Uptime Kuma
|
Description=Uptime Kuma, a fancy monitoring tool
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|
|
@ -1,20 +1,6 @@
|
||||||
- Requires a full dedicated domain
|
- Requires a full dedicated domain
|
||||||
|
- node_modules folder is backed up and shouldn't be (600Mo...)
|
||||||
- ARM architecture not supported
|
- ARM architecture not supported
|
||||||
- This app needs a manual post-install
|
- This app needs a manual post-install
|
||||||
- No upgrade script in this package
|
|
||||||
- No restore script in this package
|
|
||||||
- Backup script is untested in this package
|
|
||||||
- Uses N to install specific nodejs version
|
- Uses N to install specific nodejs version
|
||||||
<!-- * Any known limitations, constrains or stuff not working, such as (but not limited to):
|
- We could pre-configure mail notifications with YunoHost mail server as an improvement.
|
||||||
* requiring a full dedicated domain ?
|
|
||||||
* architectures not supported ?
|
|
||||||
* not-working single-sign on or LDAP integration ?
|
|
||||||
* the app requires an important amount of RAM / disk / .. to install or to work properly
|
|
||||||
* etc...
|
|
||||||
|
|
||||||
|
|
||||||
- Other infos that people should be aware of, such as:
|
|
||||||
- any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
|
|
||||||
- how to configure / administrate the application if it ain't obvious
|
|
||||||
- upgrade process / specificities / things to be aware of ?
|
|
||||||
- security considerations ? -->
|
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
"version": "1.0~ynh1",
|
"version": "1.0~ynh1",
|
||||||
"url": "https://github.com/louislam/uptime-kuma/",
|
"url": "https://github.com/louislam/uptime-kuma/",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "free",
|
"license": "MIT",
|
||||||
"website": "https://uptime.kuma.pet/",
|
"website": "https://uptime.kuma.pet/",
|
||||||
"demo": "https://demo.uptime.kuma.pet",
|
"demo": "https://demo.uptime.kuma.pet",
|
||||||
"admindoc": "https://github.com/louislam/uptime-kuma/wiki",
|
"admindoc": "https://github.com/louislam/uptime-kuma/wiki",
|
||||||
"userdoc": "https://github.com/louislam/uptime-kuma/wiki",
|
"userdoc": "https://github.com/louislam/uptime-kuma/wiki",
|
||||||
"code": "https://github.com/louislam/uptime-kuma/"
|
"code": "https://github.com/louislam/uptime-kuma/"
|
||||||
},
|
},
|
||||||
"license": "free",
|
"license": "AGPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "Hadrien",
|
"name": "Hadrien",
|
||||||
"email": "ketsapiwiq@protonmail.com"
|
"email": "ketsapiwiq@protonmail.com"
|
||||||
|
|
|
@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
# db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
# db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
# phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
# phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
# datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -48,13 +48,13 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$final_path" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
# ynh_backup --src_path="$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
@ -95,7 +95,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
# ynh_backup --src_path="/etc/cron.d/$app"
|
# ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/$app/"
|
# ynh_backup --src_path="/etc/$app/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
|
|
|
@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
@ -37,7 +37,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1
|
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -72,14 +72,14 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -116,14 +116,14 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -131,4 +131,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app" --time --last
|
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||||
|
|
|
@ -54,7 +54,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
### Use the execution time, given by --time, to estimate the weight of a step.
|
### Use the execution time, given by --time, to estimate the weight of a step.
|
||||||
### A common way to do it is to set a weight equal to the execution time in second +1.
|
### A common way to do it is to set a weight equal to the execution time in second +1.
|
||||||
### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
|
### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
|
||||||
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
||||||
### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app"
|
### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app"
|
||||||
|
@ -67,7 +67,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --time --weight=1
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
# Subpath not supported
|
# Subpath not supported
|
||||||
ynh_app_setting_set --app=$app --key=path --value=/
|
ynh_app_setting_set --app=$app --key=path --value=/
|
||||||
|
@ -81,7 +81,7 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Finding an available port..." --time --weight=1
|
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
|
|
||||||
### Use these lines if you have to open a port for the application
|
### Use these lines if you have to open a port for the application
|
||||||
### `ynh_find_port` will find the first available port starting from the given port.
|
### `ynh_find_port` will find the first available port starting from the given port.
|
||||||
|
@ -118,7 +118,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL NODEJS
|
# INSTALL NODEJS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing NodeJS..." --time --weight=2
|
ynh_script_progression --message="Installing nodejs..." --weight=2
|
||||||
|
|
||||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ ynh_use_nodejs
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring system user..." --time --weight=1
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
@ -158,7 +158,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --time --weight=1
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
|
|
||||||
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
||||||
### downloaded from an upstream source, like a git repository.
|
### downloaded from an upstream source, like a git repository.
|
||||||
|
@ -166,7 +166,9 @@ ynh_script_progression --message="Setting up source files..." --time --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$final_path" --keep=data/
|
||||||
|
# Download, check integrity, uncompress and patch the source from dist.src
|
||||||
|
ynh_setup_source --source_id="dist" --dest_dir="$final_path/dist"
|
||||||
|
|
||||||
# FIXME: this should be managed by the core in the future
|
# FIXME: this should be managed by the core in the future
|
||||||
# Here, as a packager, you may have to tweak the ownerhsip/permissions
|
# Here, as a packager, you may have to tweak the ownerhsip/permissions
|
||||||
|
@ -181,7 +183,7 @@ chown -R $app:www-data "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
|
|
||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
|
|
||||||
|
@ -210,16 +212,13 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Uptime Kuma dependencies..." --time --weight=7
|
ynh_script_progression --message="Installing Uptime Kuma dependencies..." --weight=7
|
||||||
cd $final_path && ynh_exec_warn_less $ynh_npm install
|
cd $final_path && ynh_exec_warn_less $ynh_npm install
|
||||||
ynh_script_progression --message="Downloading Uptime Kuma frontend..." --time --weight=1
|
|
||||||
ynh_exec_warn_less wget https://github.com/louislam/uptime-kuma/releases/download/1.10.0/dist.tar.gz
|
|
||||||
ynh_exec_as $app tar -xvf dist.tar.gz --directory=$final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..." --time --weight=1
|
# ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||||
|
|
||||||
### Use these lines if you need to create a directory to store "persistent files" for the application.
|
### Use these lines if you need to create a directory to store "persistent files" for the application.
|
||||||
### Usually this directory is used to store uploaded files or any file that won't be updated during
|
### Usually this directory is used to store uploaded files or any file that won't be updated during
|
||||||
|
@ -229,20 +228,20 @@ ynh_script_progression --message="Creating a data directory..." --time --weight=
|
||||||
### - Remove the section "RESTORE THE DATA DIRECTORY" in the restore script
|
### - Remove the section "RESTORE THE DATA DIRECTORY" in the restore script
|
||||||
### - As well as the section "REMOVE DATA DIR" in the remove script
|
### - As well as the section "REMOVE DATA DIR" in the remove script
|
||||||
|
|
||||||
datadir=/home/yunohost.app/$app/data
|
# datadir=/home/yunohost.app/$app/data
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
# ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||||
|
|
||||||
mkdir -p $datadir
|
# mkdir -p $datadir
|
||||||
|
|
||||||
# FIXME: this should be managed by the core in the future
|
# # FIXME: this should be managed by the core in the future
|
||||||
# Here, as a packager, you may have to tweak the ownerhsip/permissions
|
# # Here, as a packager, you may have to tweak the ownerhsip/permissions
|
||||||
# such that the appropriate users (e.g. maybe www-data) can access
|
# # such that the appropriate users (e.g. maybe www-data) can access
|
||||||
# files in some cases.
|
# # files in some cases.
|
||||||
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
# # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
||||||
# this will be treated as a security issue.
|
# # this will be treated as a security issue.
|
||||||
chmod 750 "$datadir"
|
# chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
# chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:www-data "$datadir"
|
# chown -R $app:www-data "$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
|
@ -279,7 +278,7 @@ chown -R $app:www-data "$datadir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --time --weight=1
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
### `ynh_systemd_config` is used to configure a systemd script for an app.
|
### `ynh_systemd_config` is used to configure a systemd script for an app.
|
||||||
### It can be used for apps that use sysvinit (with adaptation) or systemd.
|
### It can be used for apps that use sysvinit (with adaptation) or systemd.
|
||||||
|
@ -296,29 +295,31 @@ ynh_script_progression --message="Configuring a systemd service..." --time --wei
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP APPLICATION WITH CURL
|
# SETUP APPLICATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
### We cannot use it since this app uses websocket exclusively.
|
### It could be tricky to use CURL since this app uses websocket exclusively.
|
||||||
|
# curl --data-binary '{"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "1"}' -H "Upgrade:websocket" -H 'content-type: application/json;' http://localhost:9090/jsonrpc
|
||||||
|
|
||||||
# # Set the app as temporarily public for curl call
|
# curl 'wss://uptime-kuma.example.fr/socket.io/?EIO=4&transport=websocket' -H 'Accept: */*' -H 'Sec-WebSocket-Version: 13' -H 'Origin: https://uptime-kuma.example.fr' -H 'Sec-WebSocket-Extensions: permessage-deflate' -H 'Sec-WebSocket-Key: ZziEpfBMcnRSyFryHHsVmA==' -H 'Connection: keep-alive, Upgrade' -H 'Sec-Fetch-Dest: websocket' -H 'Sec-Fetch-Mode: websocket' -H 'Sec-Fetch-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Upgrade: websocket' --data-binary '["setup","admin","password"]' -H 'content-type: application/json;'
|
||||||
# ynh_script_progression --message="Configuring SSOwat..." --time --weight=1
|
|
||||||
# # Making the app public for curl
|
|
||||||
# ynh_permission_update --permission="main" --add="visitors"
|
|
||||||
|
|
||||||
# # Installation with curl
|
# 421["setup","admin","password"]
|
||||||
# ynh_script_progression --message="Finalizing installation..." --time --weight=1
|
|
||||||
# ynh_local_curl "/" "key1=value1" "key2=value2" "key3=value3"
|
|
||||||
|
|
||||||
# # Remove the public access
|
### We could write to its SQLite. Didn't find where the language preferences are though.
|
||||||
# ynh_permission_update --permission="main" --remove="visitors"
|
|
||||||
|
# password_hashed = $(htpasswd -bnBC 10 "" $password | tr -d ':\n')
|
||||||
|
# sqlite3 $final_path/data/kuma.db <<EOF
|
||||||
|
# INSERT INTO "main"."user" ("id", "username", "password", "active", "timezone", "twofa_secret", "twofa_status", "twofa_last_token") VALUES ('1', '$admin', '$password_hashed', '1', '', '', '0', '');
|
||||||
|
# EOF
|
||||||
|
|
||||||
|
### We could pre-configure mail notifications.
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring log rotation..." --time --weight=1
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||||
|
|
||||||
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
|
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
|
||||||
### Use this helper only if there is effectively a log file for this app.
|
### Use this helper only if there is effectively a log file for this app.
|
||||||
|
@ -334,7 +335,7 @@ ynh_use_logrotate
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
### `yunohost service add` integrates a service in YunoHost. It then gets
|
### `yunohost service add` integrates a service in YunoHost. It then gets
|
||||||
### displayed in the admin interface and through the others `yunohost service` commands.
|
### displayed in the admin interface and through the others `yunohost service` commands.
|
||||||
|
@ -345,7 +346,7 @@ ynh_script_progression --message="Integrating service in YunoHost..." --time --w
|
||||||
### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script
|
### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script
|
||||||
### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script
|
### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script
|
||||||
|
|
||||||
yunohost service add $app --description="Uptime Kuma" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Uptime Kuma, a fancy monitoring tool" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
### Additional options starting with 3.8:
|
### Additional options starting with 3.8:
|
||||||
###
|
###
|
||||||
|
@ -366,7 +367,7 @@ yunohost service add $app --description="Uptime Kuma" --log="/var/log/$app/$app.
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
### `ynh_systemd_action` is used to start a systemd service for an app.
|
### `ynh_systemd_action` is used to start a systemd service for an app.
|
||||||
### Only needed if you have configure a systemd service
|
### Only needed if you have configure a systemd service
|
||||||
|
@ -390,7 +391,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..." --time --weight=1
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
|
@ -414,7 +415,7 @@ ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --sho
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -422,4 +423,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --time --last
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
# db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
# db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
# db_user=$db_name
|
# db_user=$db_name
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
# datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -39,7 +39,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP AND REMOVE SERVICE
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
@ -47,7 +47,7 @@ ynh_remove_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
@ -63,7 +63,7 @@ ynh_remove_logrotate
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NODEJS
|
# REMOVE NODEJS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing nodejs version..." --time --weight=1
|
ynh_script_progression --message="Removing nodejs version..." --weight=1
|
||||||
|
|
||||||
ynh_remove_nodejs
|
ynh_remove_nodejs
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ ynh_remove_nodejs
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing app main directory..." --time --weight=1
|
ynh_script_progression --message="Removing app main directory and dependencies..." --weight=2
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
@ -87,17 +87,17 @@ ynh_secure_remove --file="$final_path"
|
||||||
# REMOVE DATA DIR
|
# REMOVE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the data directory if --purge option is used
|
# # Remove the data directory if --purge option is used
|
||||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
# if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||||
then
|
# then
|
||||||
ynh_script_progression --message="Removing app data directory..." --time --weight=1
|
# ynh_script_progression --message="Removing app data directory..." --time --weight=1
|
||||||
ynh_secure_remove --file="$datadir"
|
# ynh_secure_remove --file="$datadir"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -133,13 +133,13 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE VARIOUS FILES
|
# REMOVE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing various files..." --time --weight=1
|
ynh_script_progression --message="Removing various files..." --weight=1
|
||||||
|
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
# ynh_secure_remove --file="/etc/cron.d/$app"
|
# ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
# Remove a directory securely
|
# Remove a directory securely
|
||||||
ynh_secure_remove --file="/etc/$app"
|
# ynh_secure_remove --file="/etc/$app"
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove --file="/var/log/$app"
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
@ -149,7 +149,7 @@ ynh_secure_remove --file="/var/log/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete --username=$app
|
ynh_system_user_delete --username=$app
|
||||||
|
@ -158,4 +158,4 @@ ynh_system_user_delete --username=$app
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --time --last
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
|
@ -24,22 +24,22 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
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)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
# db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
# db_user=$db_name
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
# phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
# datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
@ -49,14 +49,14 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the NGINX configuration..." --time --weight=1
|
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
@ -64,7 +64,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --time --weight=1
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
|
@ -81,28 +81,21 @@ chown -R $app:www-data "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..." --time --weight=1
|
# ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
# ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $datadir
|
# mkdir -p $datadir
|
||||||
|
|
||||||
# FIXME: this should be managed by the core in the future
|
# # FIXME: this should be managed by the core in the future
|
||||||
# Here, as a packager, you may have to tweak the ownerhsip/permissions
|
# # Here, as a packager, you may have to tweak the ownerhsip/permissions
|
||||||
# such that the appropriate users (e.g. maybe www-data) can access
|
# # such that the appropriate users (e.g. maybe www-data) can access
|
||||||
# files in some cases.
|
# # files in some cases.
|
||||||
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
# # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
||||||
# this will be treated as a security issue.
|
# # this will be treated as a security issue.
|
||||||
chmod 750 "$datadir"
|
# chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
# chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:www-data "$datadir"
|
# chown -R $app:www-data "$datadir"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
# ynh_script_progression --message="Restoring the PHP-FPM configuration..." --time --weight=1
|
|
||||||
|
|
||||||
# ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE FAIL2BAN CONFIGURATION
|
# RESTORE FAIL2BAN CONFIGURATION
|
||||||
|
@ -115,10 +108,26 @@ chown -R $app:www-data "$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL NODEJS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstalling nodejs version..." --weight=2
|
||||||
|
|
||||||
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NODEJS Version
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_use_nodejs
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
|
||||||
|
cd $final_path && ynh_exec_warn_less $ynh_npm install
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
# ynh_install_app_dependencies $pkg_dependencies
|
# ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
@ -135,16 +144,16 @@ ynh_script_progression --message="Reinstalling dependencies..." --time --weight=
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring various files..." --time --weight=1
|
# ynh_script_progression --message="Restoring various files..." --time --weight=1
|
||||||
|
|
||||||
# ynh_restore_file --origin_path="/etc/cron.d/$app"
|
# ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/$app/"
|
# ynh_restore_file --origin_path="/etc/$app/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||||
|
|
||||||
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
|
||||||
|
@ -152,21 +161,21 @@ systemctl enable $app.service --quiet
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1
|
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Uptime Kuma, a fancy monitoring tool" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
|
@ -175,13 +184,13 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --time --weight=1
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
# ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --time --last
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
313
scripts/upgrade
313
scripts/upgrade
|
@ -1,167 +1,154 @@
|
||||||
# #!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# See
|
#=================================================
|
||||||
# https://github.com/louislam/uptime-kuma/wiki/%F0%9F%86%99-How-to-Update
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# #=================================================
|
source _common.sh
|
||||||
# # GENERIC START
|
source /usr/share/yunohost/helpers
|
||||||
# #=================================================
|
|
||||||
# # IMPORT GENERIC HELPERS
|
|
||||||
# #=================================================
|
|
||||||
|
|
||||||
# source _common.sh
|
#=================================================
|
||||||
# source /usr/share/yunohost/helpers
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
# #=================================================
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
# # LOAD SETTINGS
|
|
||||||
# #=================================================
|
|
||||||
# ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
|
||||||
|
|
||||||
# app=$YNH_APP_INSTANCE_NAME
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
# domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
# path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
||||||
# admin=$(ynh_app_setting_get --app=$app --key=admin)
|
# admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
# 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)
|
||||||
# language=$(ynh_app_setting_get --app=$app --key=language)
|
# language=$(ynh_app_setting_get --app=$app --key=language)
|
||||||
# db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
# db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # CHECK VERSION
|
# CHECK VERSION
|
||||||
# #=================================================
|
#=================================================
|
||||||
|
|
||||||
# ### This helper will compare the version of the currently installed app and the version of the upstream package.
|
### This helper will compare the version of the currently installed app and the version of the upstream package.
|
||||||
# ### $upgrade_type can have 2 different values
|
### $upgrade_type can have 2 different values
|
||||||
# ### - UPGRADE_APP if the upstream app version has changed
|
### - UPGRADE_APP if the upstream app version has changed
|
||||||
# ### - UPGRADE_PACKAGE if only the YunoHost package has changed
|
### - UPGRADE_PACKAGE if only the YunoHost package has changed
|
||||||
# ### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
|
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
|
||||||
# ### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
|
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
|
||||||
# upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||||
|
|
||||||
# # Backup the current version of the app
|
# Backup the current version of the app
|
||||||
# ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
# ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# # Restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
# ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
# }
|
}
|
||||||
# # Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
# ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
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"
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# #
|
#
|
||||||
# # N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
|
# N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
|
||||||
# # of what you may want to do in some cases (e.g. a setting was not defined on
|
# of what you may want to do in some cases (e.g. a setting was not defined on
|
||||||
# # some legacy installs and you therefore want to initiaze stuff during upgrade)
|
# some legacy installs and you therefore want to initiaze stuff during upgrade)
|
||||||
# #
|
#
|
||||||
|
|
||||||
# # If db_name doesn't exist, create it
|
# If db_name doesn't exist, create it
|
||||||
# #if [ -z "$db_name" ]; then
|
#if [ -z "$db_name" ]; then
|
||||||
# # db_name=$(ynh_sanitize_dbid --db_name=$app)
|
# db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
# # ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
# #fi
|
|
||||||
|
|
||||||
# # If final_path doesn't exist, create it
|
|
||||||
# #if [ -z "$final_path" ]; then
|
|
||||||
# # final_path=/var/www/$app
|
|
||||||
# # ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|
||||||
# #fi
|
|
||||||
|
|
||||||
# ### If nobody installed your app before 4.1,
|
|
||||||
# ### then you may safely remove these lines
|
|
||||||
|
|
||||||
# # Cleaning legacy permissions
|
|
||||||
# if ynh_legacy_permissions_exists; then
|
|
||||||
# ynh_legacy_permissions_delete_all
|
|
||||||
|
|
||||||
# ynh_app_setting_delete --app=$app --key=is_public
|
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
# if ! ynh_permission_exists --permission="admin"; then
|
# If final_path doesn't exist, create it
|
||||||
# # Create the required permissions
|
# if [ -z "$final_path" ]; then
|
||||||
# ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
# final_path=/var/www/$app
|
||||||
|
# ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
# # Create a permission if needed
|
#=================================================
|
||||||
# if ! ynh_permission_exists --permission="api"; then
|
# CREATE DEDICATED USER
|
||||||
# ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
|
#=================================================
|
||||||
# fi
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
# #=================================================
|
# Create a dedicated user (if not existing)
|
||||||
# # CREATE DEDICATED USER
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
# #=================================================
|
|
||||||
# ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1
|
|
||||||
|
|
||||||
# # Create a dedicated user (if not existing)
|
#=================================================
|
||||||
# ynh_system_user_create --username=$app --home_dir="$final_path"
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# #=================================================
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
# # DOWNLOAD, CHECK AND UNPACK SOURCE
|
then
|
||||||
# #=================================================
|
ynh_script_progression --message="Upgrading source files..." --time --weight=1
|
||||||
|
|
||||||
# if [ "$upgrade_type" == "UPGRADE_APP" ]
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
# then
|
ynh_setup_source --dest_dir="$final_path" --keep=data/
|
||||||
# ynh_script_progression --message="Upgrading source files..." --time --weight=1
|
# Download, check integrity, uncompress and patch the source from dist.src
|
||||||
|
ynh_setup_source --source_id="dist" --dest_dir="$final_path/dist"
|
||||||
|
|
||||||
# # Download, check integrity, uncompress and patch the source from app.src
|
fi
|
||||||
# ynh_setup_source --dest_dir="$final_path"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# # FIXME: this should be managed by the core in the future
|
# FIXME: this should be managed by the core in the future
|
||||||
# # Here, as a packager, you may have to tweak the ownerhsip/permissions
|
# Here, as a packager, you may have to tweak the ownerhsip/permissions
|
||||||
# # such that the appropriate users (e.g. maybe www-data) can access
|
# such that the appropriate users (e.g. maybe www-data) can access
|
||||||
# # files in some cases.
|
# files in some cases.
|
||||||
# # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
||||||
# # this will be treated as a security issue.
|
# this will be treated as a security issue.
|
||||||
# chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
# chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
# chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # NGINX CONFIGURATION
|
# INSTALL NODEJS
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Upgrading NGINX web server configuration..." --time --weight=1
|
ynh_script_progression --message="Upgrading nodejs..." --weight=2
|
||||||
|
|
||||||
# # Create a dedicated NGINX config
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
# ynh_add_nginx_config
|
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # UPGRADE DEPENDENCIES
|
# NODEJS Version
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
|
||||||
|
ynh_use_nodejs
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||||
|
|
||||||
# ynh_install_app_dependencies $pkg_dependencies
|
# ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # PHP-FPM CONFIGURATION
|
# SPECIFIC UPGRADE
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Upgrading PHP-FPM configuration..." --time --weight=1
|
|
||||||
|
|
||||||
# # Create a dedicated PHP-FPM config
|
ynh_script_progression --message="Upgrading Uptime Kuma dependencies..." --weight=7
|
||||||
# ynh_add_fpm_config
|
cd $final_path && ynh_exec_warn_less $ynh_npm install
|
||||||
|
|
||||||
# #=================================================
|
|
||||||
# # SPECIFIC UPGRADE
|
|
||||||
# #=================================================
|
|
||||||
# # ...
|
|
||||||
# #=================================================
|
|
||||||
|
|
||||||
# #=================================================
|
# #=================================================
|
||||||
# # UPDATE A CONFIG FILE
|
# # UPDATE A CONFIG FILE
|
||||||
|
@ -188,37 +175,37 @@
|
||||||
# ### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/some_config_file"
|
# ### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/some_config_file"
|
||||||
# ### ynh_store_file_checksum --file="$final_path/some_config_file"
|
# ### ynh_store_file_checksum --file="$final_path/some_config_file"
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1
|
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||||
|
|
||||||
# # Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
# ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1
|
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||||
|
|
||||||
# # Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
# ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
# yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Uptime Kuma, a fancy monitoring tool" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
# #=================================================
|
# #=================================================
|
||||||
# # UPGRADE FAIL2BAN
|
# # UPGRADE FAIL2BAN
|
||||||
|
@ -228,15 +215,15 @@
|
||||||
# # Create a dedicated Fail2Ban config
|
# # Create a dedicated Fail2Ban config
|
||||||
# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # RELOAD NGINX
|
# RELOAD NGINX
|
||||||
# #=================================================
|
#=================================================
|
||||||
# ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
# ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # END OF SCRIPT
|
# END OF SCRIPT
|
||||||
# #=================================================
|
#=================================================
|
||||||
|
|
||||||
# ynh_script_progression --message="Upgrade of $app completed" --time --last
|
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||||
|
|
Loading…
Reference in a new issue