mirror of
https://github.com/YunoHost-Apps/yunorunner_ynh.git
synced 2024-09-03 20:36:13 +02:00
Fix linter, fix cluster now being a boolean
This commit is contained in:
parent
2146effb72
commit
240403cbd3
5 changed files with 20 additions and 5 deletions
|
@ -14,7 +14,6 @@ maintainers = []
|
||||||
[upstream]
|
[upstream]
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
code = "https://github.com/YunoHost/yunorunner"
|
code = "https://github.com/YunoHost/yunorunner"
|
||||||
website = "https://github.com/YunoHost/yunorunner"
|
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2"
|
yunohost = ">= 11.2"
|
||||||
|
|
|
@ -33,7 +33,7 @@ setup_lxd() {
|
||||||
|
|
||||||
ynh_print_info "Configuring lxd..."
|
ynh_print_info "Configuring lxd..."
|
||||||
|
|
||||||
if [ "$cluster" == "cluster" ]; then
|
if [ "$cluster" -eq 1 ]; then
|
||||||
setup_lxd
|
setup_lxd
|
||||||
else
|
else
|
||||||
lxd init --auto # --storage-backend=dir
|
lxd init --auto # --storage-backend=dir
|
||||||
|
@ -45,6 +45,12 @@ setup_lxd() {
|
||||||
ynh_exec_as "$app" lxc remote add yunohost https://devbaseimgs.yunohost.org --public --accept-certificate
|
ynh_exec_as "$app" lxc remote add yunohost https://devbaseimgs.yunohost.org --public --accept-certificate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exposed_ports_if_cluster() {
|
||||||
|
if [ "$cluster" -eq 1 ]; then
|
||||||
|
echo "8443"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
setup_lxd_cluster() {
|
setup_lxd_cluster() {
|
||||||
local free_space=$(df --output=avail / | sed 1d)
|
local free_space=$(df --output=avail / | sed 1d)
|
||||||
local btrfs_size=$(( free_space * 90 / 100 / 1024 / 1024 ))
|
local btrfs_size=$(( free_space * 90 / 100 / 1024 / 1024 ))
|
||||||
|
|
|
@ -74,7 +74,7 @@ ynh_add_nginx_config
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
yunohost service add "$app" --description="$app daemon for YunoRunner"
|
yunohost service add "$app" --description="$app daemon for YunoRunner" --needs_exposed_ports="$(exposed_ports_if_cluster)"
|
||||||
|
|
||||||
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable "$app.service" --quiet
|
systemctl enable "$app.service" --quiet
|
||||||
yunohost service add "$app" --description="$app daemon for YunoRunner"
|
yunohost service add "$app" --description="$app daemon for YunoRunner" --needs_exposed_ports="$(exposed_ports_if_cluster)"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,16 @@ if echo "$context" | grep -- -; then
|
||||||
ynh_app_setting_set --app="$app" --key="context" --value="$context"
|
ynh_app_setting_set --app="$app" --key="context" --value="$context"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# cluster is now a boolean
|
||||||
|
if [[ "$cluster" == "cluster" ]] || [[ "$cluster" == "no" ]]; then
|
||||||
|
if [[ "$cluster" == "cluster" ]]; then
|
||||||
|
cluster=1
|
||||||
|
else
|
||||||
|
cluster=0
|
||||||
|
fi
|
||||||
|
ynh_app_setting_set --app="$app" --key="cluster" --value="$cluster"
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove Pythonz
|
# Remove Pythonz
|
||||||
ynh_secure_remove --file="$install_dir/.pythonz"
|
ynh_secure_remove --file="$install_dir/.pythonz"
|
||||||
|
|
||||||
|
@ -89,7 +99,7 @@ ynh_add_nginx_config
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
yunohost service add "$app" --description="$app daemon for YunoRunner"
|
yunohost service add "$app" --description="$app daemon for YunoRunner" --needs_exposed_ports="$(exposed_ports_if_cluster)"
|
||||||
|
|
||||||
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue