mirror of
https://github.com/YunoHost-Apps/garage_ynh.git
synced 2024-09-03 18:36:32 +02:00
Testing improve garage package (#5)
* - improve config panel * add regen conf --------- Co-authored-by: oiseauroch <contact@oiseauroch.fr> Co-authored-by: yunohost-bot <yunohost@yunohost.org> Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
This commit is contained in:
parent
7cbe56b685
commit
935802384d
10 changed files with 95 additions and 23 deletions
|
@ -3,15 +3,15 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
|
||||||
It shall NOT be edited by hand.
|
It shall NOT be edited by hand.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# garage_ynh for YunoHost
|
# Garage for YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/garage)  
|
[](https://dash.yunohost.org/appci/app/garage)  
|
||||||
|
|
||||||
[](https://install-app.yunohost.org/?app=garage)
|
[](https://install-app.yunohost.org/?app=garage)
|
||||||
|
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
|
||||||
> *This package allows you to install garage_ynh quickly and simply on a YunoHost server.
|
> *This package allows you to install Garage quickly and simply on a YunoHost server.
|
||||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
@ -35,7 +35,7 @@ Garage is designed for storage clusters composed of nodes running at different p
|
||||||
- K2V API (experimental)
|
- K2V API (experimental)
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 0.8.0~ynh3
|
**Shipped version:** 0.8.0~ynh4
|
||||||
## Disclaimers / important information
|
## Disclaimers / important information
|
||||||
|
|
||||||
* Limitations :
|
* Limitations :
|
||||||
|
|
|
@ -3,15 +3,15 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
|
||||||
It shall NOT be edited by hand.
|
It shall NOT be edited by hand.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# garage_ynh pour YunoHost
|
# Garage pour YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/garage)  
|
[](https://dash.yunohost.org/appci/app/garage)  
|
||||||
|
|
||||||
[](https://install-app.yunohost.org/?app=garage)
|
[](https://install-app.yunohost.org/?app=garage)
|
||||||
|
|
||||||
*[Read this readme in english.](./README.md)*
|
*[Read this readme in english.](./README.md)*
|
||||||
|
|
||||||
> *Ce package vous permet d’installer garage_ynh rapidement et simplement sur un serveur YunoHost.
|
> *Ce package vous permet d’installer Garage rapidement et simplement sur un serveur YunoHost.
|
||||||
Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.*
|
Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.*
|
||||||
|
|
||||||
## Vue d’ensemble
|
## Vue d’ensemble
|
||||||
|
@ -35,7 +35,7 @@ Garage is designed for storage clusters composed of nodes running at different p
|
||||||
- K2V API (experimental)
|
- K2V API (experimental)
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 0.8.0~ynh3
|
**Version incluse :** 0.8.0~ynh4
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
* Limitations :
|
* Limitations :
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
|
|
||||||
|
|
||||||
[main]
|
[main]
|
||||||
|
|
||||||
|
[main.infos]
|
||||||
|
name = "Garage cluster informations"
|
||||||
|
|
||||||
|
[main.infos.node]
|
||||||
|
type = "alert"
|
||||||
|
|
||||||
|
[main.infos.status]
|
||||||
|
type = "alert"
|
||||||
|
|
||||||
|
|
||||||
[main.garage_conf]
|
[main.garage_conf]
|
||||||
name = "Garage configuration"
|
name = "Garage configuration"
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "garage_ynh",
|
"name": "Garage",
|
||||||
"id": "garage",
|
"id": "garage",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "S3 storage",
|
"en": "S3 storage",
|
||||||
"fr": "stockage S3"
|
"fr": "stockage S3"
|
||||||
},
|
},
|
||||||
"version": "0.8.0~ynh3",
|
"version": "0.8.0~ynh4",
|
||||||
"url": "https://garagehq.deuxfleurs.fr/",
|
"url": "https://garagehq.deuxfleurs.fr/",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
|
|
|
@ -66,6 +66,7 @@ ynh_backup --src_path="$final_path"
|
||||||
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
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -74,6 +75,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP HOOK
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/98-nginx_$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -81,6 +88,8 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
|
|
||||||
|
ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/98-nginx_$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -18,7 +18,10 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
node_id=$(ynh_app_setting_get $app node_id)
|
node_id=$(ynh_app_setting_get $app node_id)
|
||||||
virtualisation=$(ynh_app_setting_get $app virtualisation)
|
virtualisation=$(ynh_app_setting_get $app virtualisation)
|
||||||
datadir=$(ynh_app_setting_get $app datadir)
|
datadir=$(ynh_app_setting_get $app datadir)
|
||||||
|
if [ "$virtualisation" = "true" ]
|
||||||
|
then
|
||||||
nbd_index=$(cat $datadir/nbd_index)
|
nbd_index=$(cat $datadir/nbd_index)
|
||||||
|
fi
|
||||||
command="$final_path/garage -c $final_path/garage.toml"
|
command="$final_path/garage -c $final_path/garage.toml"
|
||||||
|
|
||||||
get__weight() {
|
get__weight() {
|
||||||
|
@ -64,6 +67,35 @@ set__bootstrap_peers() {
|
||||||
ynh_app_setting_set --app=$app --key=bootstrap_peers --value=$bootstrap_peers
|
ynh_app_setting_set --app=$app --key=bootstrap_peers --value=$bootstrap_peers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get__node() {
|
||||||
|
cat << EOF
|
||||||
|
ask:
|
||||||
|
en: "**Node Id** : $($command node id -q) \n
|
||||||
|
*This id is a sensitive information and should not be shared with anyone else than other nodes of the cluster*"
|
||||||
|
style: "info"
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
get__status() {
|
||||||
|
status=$($command status 2> /dev/null | sed -E 's/([a-z0-9]{16})/\n**\1**/g')
|
||||||
|
cat << EOF
|
||||||
|
ask:
|
||||||
|
en: "**Current garage layout**: \n
|
||||||
|
$status"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [[ "$(echo \"$status\" | grep \"FAILED NODES\")" ]] || [[ "$(echo \"$status\" | grep 'garage layout show')" ]]
|
||||||
|
then
|
||||||
|
cat << EOF
|
||||||
|
style: "danger"
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat << EOF
|
||||||
|
style: "success"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -201,14 +201,6 @@ 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
|
||||||
|
|
||||||
#add wildcard subdomain
|
|
||||||
ynh_replace_special_string --match_string="server_name $domain" --replace_string="server_name $domain *.$domain" --target_file="/etc/nginx/conf.d/$domain.conf"
|
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.conf"
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETUP
|
|
||||||
#=================================================
|
|
||||||
# ...
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
|
@ -292,6 +284,20 @@ then
|
||||||
VIRTUALISATION=true $final_path/umount_disk.sh
|
VIRTUALISATION=true $final_path/umount_disk.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD REGEN-CONF HOOK
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="adding regen-conf hook..." --weight=1
|
||||||
|
|
||||||
|
ynh_add_config --template="../sources/hooks/conf_regen/98-nginx_garage" --destination="/usr/share/yunohost/hooks/conf_regen/98-nginx_$app"
|
||||||
|
#cp -R ../sources/hooks/conf_regen/98-nginx_garage /usr/share/yunohost/hooks/conf_regen/95-nginx_$app
|
||||||
|
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action="reload"
|
||||||
|
|
||||||
|
yunohost tools regen-conf nginx
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -96,6 +96,10 @@ ynh_secure_remove --file="$final_path"
|
||||||
ynh_script_progression --message="Removing app data directory..." --weight=1
|
ynh_script_progression --message="Removing app data directory..." --weight=1
|
||||||
ynh_secure_remove --file="$datadir"
|
ynh_secure_remove --file="$datadir"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE NGINX HOOK
|
||||||
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -147,6 +151,10 @@ ynh_script_progression --message="Removing the dedicated system user..." --weig
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete --username=$app
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
|
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/98-nginx_$app"
|
||||||
|
yunohost tools regen-conf nginx
|
||||||
|
ynh_systemd_action --service_name=nginx --action="reload"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -115,7 +115,11 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#add wildcard subdomain
|
#add wildcard subdomain
|
||||||
ynh_replace_special_string --match_string="server_name $domain" --replace_string="server_name $domain *.$domain" --target_file="/etc/nginx/conf.d/$domain.conf"
|
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/usr/share/yunohost/hooks/conf_regen/98-nginx_$app"
|
||||||
|
yunohost tools regen-conf nginx
|
||||||
|
ynh_systemd_action --service_name=nginx --action="reload"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
|
|
||||||
action=$1
|
action=$1
|
||||||
|
pending_dir=$4
|
||||||
domain=__DOMAIN__
|
domain=__DOMAIN__
|
||||||
|
app=__APP__
|
||||||
|
|
||||||
|
[[ "$action" == "pre" ]] || exit 0
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_replace_special_string --match_string="server_name $domain" --replace_string="server_name $domain *.$domain" --target_file="/etc/nginx/conf.d/$domain.conf"
|
ynh_replace_special_string --match_string="server_name $domain" --replace_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"
|
Loading…
Add table
Reference in a new issue