mirror of
https://github.com/YunoHost-Apps/statpingng_ynh.git
synced 2024-09-03 20:26:24 +02:00
commit
9ed55505a5
6 changed files with 18 additions and 85 deletions
|
@ -17,19 +17,21 @@ userdoc = "https://statping-ng.github.io/"
|
||||||
code = "https://github.com/statping-ng/statping-ng/"
|
code = "https://github.com/statping-ng/statping-ng/"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.1.20"
|
yunohost = ">= 11.2"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
|
|
||||||
ldap = false
|
ldap = false
|
||||||
|
|
||||||
sso = false
|
sso = false
|
||||||
|
|
||||||
disk = "50M"
|
disk = "50M"
|
||||||
ram.build = "50M"
|
ram.build = "150M"
|
||||||
ram.runtime = "50M"
|
ram.runtime = "50M"
|
||||||
|
|
||||||
[install]
|
[install]
|
||||||
[install.domain]
|
[install.domain]
|
||||||
type = "domain"
|
type = "domain"
|
||||||
full_domain = true
|
|
||||||
|
|
||||||
[install.init_main_permission]
|
[install.init_main_permission]
|
||||||
type = "group"
|
type = "group"
|
||||||
|
@ -38,7 +40,7 @@ ram.runtime = "50M"
|
||||||
[install.language]
|
[install.language]
|
||||||
ask.en = "Choose the application language"
|
ask.en = "Choose the application language"
|
||||||
ask.fr = "Choisissez la langue de l'application"
|
ask.fr = "Choisissez la langue de l'application"
|
||||||
type = "string"
|
type = "select"
|
||||||
choices = ["fr", "en", "es", "ru", "de", "cs", "ja", "ko", "it", "zh"]
|
choices = ["fr", "en", "es", "ru", "de", "cs", "ja", "ko", "it", "zh"]
|
||||||
default = "fr"
|
default = "fr"
|
||||||
|
|
||||||
|
@ -46,8 +48,6 @@ ram.runtime = "50M"
|
||||||
type = "user"
|
type = "user"
|
||||||
|
|
||||||
[install.password]
|
[install.password]
|
||||||
help.en = "Choose an admin password"
|
|
||||||
help.fr = "Choisissez une phrase de passe pour l'administrateur."
|
|
||||||
type = "password"
|
type = "password"
|
||||||
|
|
||||||
[resources]
|
[resources]
|
||||||
|
|
|
@ -13,31 +13,3 @@ STATPING_VERSION="0.90.80"
|
||||||
get_ip() {
|
get_ip() {
|
||||||
curl ip.me
|
curl ip.me
|
||||||
}
|
}
|
||||||
# inspired by restic helper
|
|
||||||
install_statping () {
|
|
||||||
architecture=$(uname -m)
|
|
||||||
arch=''
|
|
||||||
case $architecture in
|
|
||||||
i386|i686)
|
|
||||||
arch="386"
|
|
||||||
;;
|
|
||||||
x86_64)
|
|
||||||
arch=amd64
|
|
||||||
;;
|
|
||||||
armv*)
|
|
||||||
arch=arm-7
|
|
||||||
;;
|
|
||||||
aarch64)
|
|
||||||
arch=arm64
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo
|
|
||||||
ynh_die --message="Unsupported architecture \"$architecture\""
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
wget https://github.com/statping-ng/statping-ng/releases/download/v$STATPING_VERSION/statping-linux-$arch.tar.gz 2>&1 >/dev/null
|
|
||||||
tar zxf statping-linux-$arch.tar.gz
|
|
||||||
rm statping-linux-$arch.tar.gz
|
|
||||||
chmod +x statping
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,10 @@ ynh_change_url_nginx_config
|
||||||
#==================================================
|
#==================================================
|
||||||
# Change config file
|
# Change config file
|
||||||
#==================================================
|
#==================================================
|
||||||
ynh_script_progression --message="Modifying configuration file…" --weight=1
|
ynh_script_progression --message="Modifying configuration file..." --weight=1
|
||||||
|
|
||||||
#ynh_delete_file_checksum --file="$install_dir/.env"
|
#ynh_delete_file_checksum --file="$install_dir/.env"
|
||||||
#ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
|
#ynh_add_config --template=".env" --destination="$install_dir/.env"
|
||||||
|
|
||||||
sed -i "/DOMAIN=/c\DOMAIN=https://${new_domain}" $install_dir/.env
|
sed -i "/DOMAIN=/c\DOMAIN=https://${new_domain}" $install_dir/.env
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ chown -R $app:www-data "$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..."
|
ynh_script_progression --message="Adding a configuration file..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
|
ynh_add_config --template=".env" --destination="$install_dir/.env"
|
||||||
ynh_add_config --template="../conf/services.yml" --destination="$install_dir/services.yml"
|
ynh_add_config --template="services.yml" --destination="$install_dir/services.yml"
|
||||||
|
|
||||||
chmod 400 "$install_dir/.env"
|
chmod 400 "$install_dir/.env"
|
||||||
chown $app:$app "$install_dir/.env"
|
chown $app:$app "$install_dir/.env"
|
||||||
|
@ -43,7 +43,7 @@ ynh_add_systemd_config
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
yunohost service add $app --description="extern monitoring tool" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Extern monitoring tool" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -20,13 +20,6 @@ ynh_restore_file --origin_path="$install_dir"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -42,20 +35,12 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
#=================================================
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
|
||||||
|
|
||||||
mkdir /var/log/$app
|
mkdir /var/log/$app
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
yunohost service add $app --description="Extern monitoring tool" --log="/var/log/$app/$app.log"
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
||||||
|
|
||||||
yunohost service add $app --description="extern monitoring tool" --log="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -24,28 +24,21 @@ 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
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
pushd "$install_dir"
|
|
||||||
install_statping
|
|
||||||
popd
|
|
||||||
|
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:$app "$install_dir"
|
chown -R $app:$app "$install_dir"
|
||||||
|
chmod +x $install_dir/statping
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -55,30 +48,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
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
|
|
||||||
#=================================================
|
|
||||||
# SETUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
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
|
||||||
|
|
||||||
#=================================================
|
yunohost service add $app --description="Extern monitoring tool" --log="/var/log/$app/$app.log"
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
||||||
|
|
||||||
yunohost service add $app --description="extern monitoring tool" --log="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
Loading…
Add table
Reference in a new issue