1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/garage_ynh.git synced 2024-09-03 18:36:32 +02:00
This commit is contained in:
Éric Gaspar 2023-12-10 20:52:41 +01:00
parent b9f09dd2e6
commit 37f93ac72c
5 changed files with 23 additions and 52 deletions

6
doc/POST_INSTALL.md Normal file
View 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__

View file

@ -15,11 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
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
#=================================================

View file

@ -14,14 +14,14 @@ source /usr/share/yunohost/helpers
#=================================================
# 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"
#=================================================
# 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
@ -30,7 +30,7 @@ ynh_change_url_nginx_config
#=================================================
# 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"
@ -38,4 +38,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
# 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

View file

@ -27,7 +27,7 @@ fi
#=================================================
# 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=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
#=================================================
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"
# 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
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
@ -51,7 +51,7 @@ ynh_add_nginx_config
#=================================================
# 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="umount_disk.sh" --destination="$install_dir/umount_disk.sh"
@ -79,7 +79,7 @@ fi
#=================================================
# 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"
yunohost tools regen-conf nginx
@ -87,7 +87,7 @@ yunohost tools regen-conf nginx
#=================================================
# 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
ynh_add_systemd_config
@ -100,7 +100,7 @@ yunohost service add $app --description="s3 storage" --log="/var/log/$app/$app.l
#=================================================
# 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
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
#=================================================
ynh_script_progression --message="Configuring garage..."
ynh_script_progression --message="Configuring garage..." --weight=1
garage_command="$install_dir/garage -c $install_dir/garage.toml"
@ -138,21 +138,7 @@ fi
self_bootstrap_peers="$($garage_command node id --quiet)"
garage_layout="$($garage_command layout show)"
#=================================================
# 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"
ynh_app_setting_set --app=$app --key=garage_layout --value=$garage_layout
#=================================================
# END OF SCRIPT

View file

@ -9,10 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#=================================================
# 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"
fi
#=================================================
# STANDARD REMOVE
#=================================================
@ -60,7 +55,7 @@ then
#=================================================
# REMOVE VIRTUAL DISK
#=================================================
ynh_script_progression --message="umount virtual disk..."
ynh_script_progression --message="Umount virtual disk..."
# Remove the app directory securely
$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_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
#=================================================