mirror of
https://github.com/YunoHost-Apps/influxdb_v2_ynh.git
synced 2024-09-03 19:26:11 +02:00
cleaning
This commit is contained in:
parent
76b4e208b1
commit
96183387f6
10 changed files with 35 additions and 126 deletions
|
@ -1,6 +1,7 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
proxy_pass http://localhost:__PORT__/;
|
||||
proxy_pass http://127.0.0.1:__PORT__/;
|
||||
|
||||
# These configuration options are required for WebSockets to work.
|
||||
proxy_http_version 1.1;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[Unit]
|
||||
Description=InfluxDB is an open-source, distributed, time series database
|
||||
Description=InfluxDB: distributed, time series database
|
||||
Documentation=https://docs.influxdata.com/influxdb/
|
||||
After=network-online.target
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
The app install dir is `__INSTALL_DIR__`
|
|
@ -1 +0,0 @@
|
|||
Le dossier d'install de l'app est `__INSTALL_DIR__`
|
|
@ -2,7 +2,7 @@ packaging_format = 2
|
|||
|
||||
id = "influxdb_v2"
|
||||
name = "InfluxDB v2"
|
||||
description.en = "Time-series database for storing, querying, and visualizing real-time data efficiently."
|
||||
description.en = "Time-series database for storing, querying, and visualizing real-time data efficiently"
|
||||
description.fr = "Base de données séries temporelles pour stocker, interroger et visualiser données temps réel efficacement"
|
||||
|
||||
version = "2.7.1~ynh1"
|
||||
|
|
|
@ -27,23 +27,14 @@ ynh_backup --src_path="$install_dir"
|
|||
ynh_backup --src_path="$data_dir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE AND LOGS
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
ynh_backup --src_path="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_backup --src_path="/var/log/$app"
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
|
|
|
@ -33,24 +33,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
|
|||
ynh_setup_source --dest_dir="$install_dir" --source_id=influxdb2
|
||||
ynh_setup_source --dest_dir="$install_dir" --source_id=influx
|
||||
|
||||
chmod -R 750 "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting permissions for the data directory..." --weight=1
|
||||
|
||||
chmod -R 0750 "$data_dir"
|
||||
chown -R $app:$app "$data_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# ADD CONFIGURATION
|
||||
|
@ -63,38 +46,33 @@ chmod 400 "$install_dir/config.toml"
|
|||
chown $app:$app "$install_dir/config.toml"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE SYSTEMD
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --service="$app" --template="systemd.service"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
ynh_add_systemd_config --service="$app" --description="Time-series database" --template="systemd.service"
|
||||
|
||||
yunohost service add "$app" --log="/var/log/$app/$app.log"
|
||||
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# START AND ENABLE SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="enable"
|
||||
ynh_systemd_action --service_name=$app --action="start"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# APP INITIAL CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring $app ..." --weight=30
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="msg=Listening"
|
||||
|
||||
# First setup InfluxDB v2 using influx
|
||||
|
|
|
@ -12,8 +12,6 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# REMOVE SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
|
@ -22,35 +20,12 @@ then
|
|||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||
ynh_remove_nginx_config
|
||||
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing InfluxDB V2 data" --weight=1
|
||||
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
ynh_secure_remove --file="$data_dir"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -16,8 +16,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
|||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod -R 750 "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
|
@ -26,8 +25,7 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1
|
|||
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
|
||||
chmod -R 0750 "$data_dir"
|
||||
chown -R $app:$app "$data_dir"
|
||||
chown -R "$app:www-data" "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
|
@ -35,15 +33,11 @@ chown -R $app:$app "$data_dir"
|
|||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
ynh_systemd_action --service_name=$app --action="enable"
|
||||
|
||||
yunohost service add "$app" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION AND LOGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
yunohost service add "$app" --description="Time-series database" --log="/var/log/$app/$app.log"
|
||||
|
||||
ynh_restore_file --origin_path="/var/log/$app"
|
||||
chown -R $app:$app "/var/log/$app"
|
||||
|
|
|
@ -9,16 +9,11 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
|
@ -26,33 +21,18 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
ynh_setup_source --dest_dir="$install_dir" --source_id=influxdb2 --keep=".influxdbv2/"
|
||||
ynh_setup_source --dest_dir="$install_dir" --source_id=influx
|
||||
fi
|
||||
ynh_setup_source --dest_dir="$install_dir" --source_id=influxdb2 --keep=".influxdbv2/"
|
||||
ynh_setup_source --dest_dir="$install_dir" --source_id=influx
|
||||
|
||||
chmod -R 750 "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# ADD CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding $app configuration file..." --weight=1
|
||||
ynh_script_progression --message="Updating $app's configuration files..." --weight=1
|
||||
|
||||
ynh_add_config --template="config.toml.example" --destination="$install_dir/config.toml"
|
||||
|
||||
|
@ -60,28 +40,20 @@ chmod 400 "$install_dir/config.toml"
|
|||
chown $app:$app "$install_dir/config.toml"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE SYSTEMD
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
ynh_add_systemd_config --service="$app" --template="systemd.service"
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
yunohost service add "$app" --log="/var/log/$app/$app.log"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
yunohost service add "$app" --description="Time-series database" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START AND ENABLE SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_systemd_action --service_name=$app --action="enable"
|
||||
ynh_systemd_action --service_name=$app --action="start"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue