1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/garage_ynh.git synced 2024-09-03 18:36:32 +02:00

Merge branch 'testing' into 0.9.0

This commit is contained in:
Éric Gaspar 2023-12-10 21:13:07 +01:00
commit b66b201270
8 changed files with 39 additions and 46 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

@ -27,8 +27,6 @@ ynh_backup --src_path="$install_dir"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================

View file

@ -14,14 +14,14 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a 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" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_change_url_nginx_config ynh_change_url_nginx_config
@ -30,12 +30,12 @@ ynh_change_url_nginx_config
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." 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="systemd"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app"--last ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -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"
@ -44,7 +44,7 @@ chmod +x $install_dir/garage
#================================================= #=================================================
# 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
@ -52,7 +52,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"
@ -65,7 +65,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
@ -80,7 +80,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
@ -88,7 +88,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
@ -101,15 +101,15 @@ 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="systemd"
#================================================= #=================================================
# 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"
@ -139,24 +139,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

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# GENERIC START # GENERIC START
@ -18,7 +18,7 @@ $install_dir/garage -c $install_dir/garage.toml layout remove "$node_id"
apply_layout "$install_dir/garage -c $install_dir/garage.toml " apply_layout "$install_dir/garage -c $install_dir/garage.toml "
if [ $? -ne 0 ] if [ $? -ne 0 ]
then 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
#================================================= #=================================================
@ -42,9 +42,6 @@ ynh_remove_logrotate
if [[ "$system_is_inside_container" == "true" ]] if [[ "$system_is_inside_container" == "true" ]]
then then
#=================================================
# 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
@ -68,4 +65,4 @@ yunohost tools regen-conf nginx
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -59,7 +59,7 @@ ynh_script_progression --message="Starting a systemd service..."
#recreate log folder #recreate log folder
mkdir /var/log/$app mkdir /var/log/$app
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="systemd"
#================================================= #=================================================
# RECREATE CONFIGURATION # RECREATE CONFIGURATION
@ -78,12 +78,13 @@ if [ -n "$bootstrap_peers" ]
then then
garage_connect "$garage_command" "$bootstrap_peers" garage_connect "$garage_command" "$bootstrap_peers"
fi fi
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -22,7 +22,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." ynh_script_progression --message="Stopping a systemd service..."
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="systemd"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -68,10 +68,10 @@ ynh_add_config --template="garage.toml" --destination="$install_dir/garage.toml"
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting 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="systemd"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression --message="Upgrade of $app completed" --last

View file

@ -6,4 +6,9 @@ test_format = 1.0
# Tests to run # Tests to run
# ------------ # ------------
args.weight = "10" exclude = ["install.private", "install.root", "install.subdir", "install.multi"]
# -------------------------------
# Default args to use for install
# -------------------------------
args.weight = "10"