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/"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.20"
|
||||
yunohost = ">= 11.2"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
|
||||
ldap = false
|
||||
|
||||
sso = false
|
||||
|
||||
disk = "50M"
|
||||
ram.build = "50M"
|
||||
ram.build = "150M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
full_domain = true
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
|
@ -38,7 +40,7 @@ ram.runtime = "50M"
|
|||
[install.language]
|
||||
ask.en = "Choose the application language"
|
||||
ask.fr = "Choisissez la langue de l'application"
|
||||
type = "string"
|
||||
type = "select"
|
||||
choices = ["fr", "en", "es", "ru", "de", "cs", "ja", "ko", "it", "zh"]
|
||||
default = "fr"
|
||||
|
||||
|
@ -46,8 +48,6 @@ ram.runtime = "50M"
|
|||
type = "user"
|
||||
|
||||
[install.password]
|
||||
help.en = "Choose an admin password"
|
||||
help.fr = "Choisissez une phrase de passe pour l'administrateur."
|
||||
type = "password"
|
||||
|
||||
[resources]
|
||||
|
|
|
@ -13,31 +13,3 @@ STATPING_VERSION="0.90.80"
|
|||
get_ip() {
|
||||
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
|
||||
#==================================================
|
||||
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_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
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ chown -R $app:www-data "$install_dir"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
|
||||
ynh_add_config --template="../conf/services.yml" --destination="$install_dir/services.yml"
|
||||
ynh_add_config --template=".env" --destination="$install_dir/.env"
|
||||
ynh_add_config --template="services.yml" --destination="$install_dir/services.yml"
|
||||
|
||||
chmod 400 "$install_dir/.env"
|
||||
chown $app:$app "$install_dir/.env"
|
||||
|
@ -43,7 +43,7 @@ ynh_add_systemd_config
|
|||
# Use logrotate to manage application logfile(s)
|
||||
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
|
||||
|
|
|
@ -20,13 +20,6 @@ ynh_restore_file --origin_path="$install_dir"
|
|||
chmod -R o-rwx "$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
|
||||
#=================================================
|
||||
|
@ -42,20 +35,12 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
|
|||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
mkdir /var/log/$app
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# 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"
|
||||
yunohost service add $app --description="Extern monitoring tool" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
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
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
fi
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
chmod +x $install_dir/statping
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -55,30 +48,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
# Create a dedicated 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)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# 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"
|
||||
yunohost service add $app --description="Extern monitoring tool" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
Loading…
Reference in a new issue