mirror of
https://github.com/YunoHost-Apps/garage_ynh.git
synced 2024-09-03 18:36:32 +02:00
- improve config panel
- fix backup script for no virtualisation - improve hook regen_conf
This commit is contained in:
parent
4e175088b8
commit
1a7800facf
5 changed files with 56 additions and 7 deletions
|
@ -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"
|
||||||
|
|
|
@ -2,9 +2,15 @@
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
garage_domains=$(yunohost app list --json | jq '.apps[] | select(.id | test("garage*")) | .domain_path')
|
||||||
|
|
||||||
action=$1
|
for domain in $garage_domains;
|
||||||
domain=__DOMAIN__
|
do
|
||||||
|
domain=${domain//\"/}
|
||||||
|
if [[ "$domain" =~ "/" ]]
|
||||||
|
then
|
||||||
|
domain=${domain/\//}
|
||||||
|
ynh_replace_special_string --match_string="server_name $domain;" --replace_string="server_name $domain *.$>
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
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"
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"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",
|
||||||
|
|
|
@ -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)
|
||||||
nbd_index=$(cat $datadir/nbd_index)
|
if [ "$virtualisation" = "true" ]
|
||||||
|
then
|
||||||
|
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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -202,7 +202,7 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#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_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"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
|
Loading…
Add table
Reference in a new issue