mirror of
https://github.com/YunoHost-Apps/garage_ynh.git
synced 2024-09-03 18:36:32 +02:00
cleaning
This commit is contained in:
parent
b9f09dd2e6
commit
37f93ac72c
5 changed files with 23 additions and 52 deletions
6
doc/POST_INSTALL.md
Normal file
6
doc/POST_INSTALL.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Your Garage node have been installed. You can now connect to other nodes with the following identifiers :
|
||||||
|
|
||||||
|
rpc_secret: __RPC_SECRET__
|
||||||
|
bootstrap_peers: __SELF_BOOTSTRAP_PEERS__
|
||||||
|
|
||||||
|
Current garage layout: __GARAGE_LAYOUT__
|
|
@ -15,11 +15,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
|
|
||||||
### to be backuped and not an actual copy of any file. The actual backup that
|
|
||||||
### creates and fill the archive with the files happens in the core after this
|
|
||||||
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -14,14 +14,14 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --time
|
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
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
ynh_change_url_nginx_config
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ ynh_change_url_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --time
|
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"
|
||||||
|
|
||||||
|
@ -38,4 +38,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
||||||
# 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
|
||||||
|
|
|
@ -27,7 +27,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..."
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=rpc_secret --value=$rpc_secret
|
ynh_app_setting_set --app=$app --key=rpc_secret --value=$rpc_secret
|
||||||
ynh_app_setting_set --app=$app --key=bootstrap_peers --value=$bootstrap_peers
|
ynh_app_setting_set --app=$app --key=bootstrap_peers --value=$bootstrap_peers
|
||||||
|
@ -35,7 +35,7 @@ ynh_app_setting_set --app=$app --key=bootstrap_peers --value=$bootstrap_peers
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..."
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
# chmod +x $install_dir/garage # this file doesnt seem to exist ... remove this line ?
|
# chmod +x $install_dir/garage # this file doesnt seem to exist ... remove this line ?
|
||||||
|
@ -43,7 +43,7 @@ ynh_setup_source --dest_dir="$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..."
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -51,7 +51,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..."
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="mount_disk.sh" --destination="$install_dir/mount_disk.sh"
|
ynh_add_config --template="mount_disk.sh" --destination="$install_dir/mount_disk.sh"
|
||||||
ynh_add_config --template="umount_disk.sh" --destination="$install_dir/umount_disk.sh"
|
ynh_add_config --template="umount_disk.sh" --destination="$install_dir/umount_disk.sh"
|
||||||
|
@ -64,7 +64,7 @@ chown $app:$app "$install_dir/garage.toml"
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..." --weight=5
|
ynh_script_progression --message="Creating a data directory..." --weight=5
|
||||||
|
|
||||||
if [[ "$system_is_inside_container" == "true" ]]
|
if [[ "$system_is_inside_container" == "true" ]]
|
||||||
then
|
then
|
||||||
|
@ -79,7 +79,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD REGEN-CONF HOOK
|
# ADD REGEN-CONF HOOK
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding regen-conf hook..."
|
ynh_script_progression --message="Adding regen-conf hook..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="regenconf_nginx_garage" --destination="/usr/share/yunohost/hooks/conf_regen/98-nginx_$app"
|
ynh_add_config --template="regenconf_nginx_garage" --destination="/usr/share/yunohost/hooks/conf_regen/98-nginx_$app"
|
||||||
yunohost tools regen-conf nginx
|
yunohost tools regen-conf nginx
|
||||||
|
@ -87,7 +87,7 @@ yunohost tools regen-conf nginx
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
@ -100,7 +100,7 @@ yunohost service add $app --description="s3 storage" --log="/var/log/$app/$app.l
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
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"
|
||||||
|
@ -108,7 +108,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE GARAGE
|
# CONFIGURE GARAGE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring garage..."
|
ynh_script_progression --message="Configuring garage..." --weight=1
|
||||||
|
|
||||||
garage_command="$install_dir/garage -c $install_dir/garage.toml"
|
garage_command="$install_dir/garage -c $install_dir/garage.toml"
|
||||||
|
|
||||||
|
@ -138,24 +138,10 @@ fi
|
||||||
|
|
||||||
self_bootstrap_peers="$($garage_command node id --quiet)"
|
self_bootstrap_peers="$($garage_command node id --quiet)"
|
||||||
garage_layout="$($garage_command layout show)"
|
garage_layout="$($garage_command layout show)"
|
||||||
|
ynh_app_setting_set --app=$app --key=garage_layout --value=$garage_layout
|
||||||
#=================================================
|
|
||||||
# Send email to admin
|
|
||||||
#=================================================
|
|
||||||
app_message="
|
|
||||||
your garage node have been installed. You can now connect to other nodes with the following identifiers :
|
|
||||||
|
|
||||||
rpc_secret: $rpc_secret
|
|
||||||
bootstrap_peers: $self_bootstrap_peers
|
|
||||||
|
|
||||||
Current garage layout :
|
|
||||||
|
|
||||||
$garage_layout"
|
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="$app_message"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
|
@ -9,10 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NODE CONFIGURATION
|
# REMOVE NODE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -24,7 +20,6 @@ then
|
||||||
ynh_print_warn --message="unable to remove the node. Maybe the number of node staying alive is not enough"
|
ynh_print_warn --message="unable to remove the node. Maybe the number of node staying alive is not enough"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -60,7 +55,7 @@ then
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE VIRTUAL DISK
|
# REMOVE VIRTUAL DISK
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="umount virtual disk..."
|
ynh_script_progression --message="Umount virtual disk..."
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
$install_dir/umount_disk.sh
|
$install_dir/umount_disk.sh
|
||||||
|
@ -82,17 +77,6 @@ ynh_remove_nginx_config
|
||||||
ynh_replace_string --replace_string="server_name $domain" --match_string="server_name $domain *.$domain" --target_file="/etc/nginx/conf.d/$domain.conf"
|
ynh_replace_string --replace_string="server_name $domain" --match_string="server_name $domain *.$domain" --target_file="/etc/nginx/conf.d/$domain.conf"
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.conf"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CLOSE A PORT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Closing port $port..."
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue