diff --git a/manifest.toml b/manifest.toml index eae9aac..9bd5e9a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,7 +14,6 @@ maintainers = [] [upstream] license = "GPL-3.0-or-later" code = "https://github.com/YunoHost/yunorunner" -website = "https://github.com/YunoHost/yunorunner" [integration] yunohost = ">= 11.2" diff --git a/scripts/_common.sh b/scripts/_common.sh index b45be1c..700239b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -33,7 +33,7 @@ setup_lxd() { ynh_print_info "Configuring lxd..." - if [ "$cluster" == "cluster" ]; then + if [ "$cluster" -eq 1 ]; then setup_lxd else 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 } +exposed_ports_if_cluster() { + if [ "$cluster" -eq 1 ]; then + echo "8443" + fi +} + setup_lxd_cluster() { local free_space=$(df --output=avail / | sed 1d) local btrfs_size=$(( free_space * 90 / 100 / 1024 / 1024 )) diff --git a/scripts/install b/scripts/install index 86675d7..8fd832c 100644 --- a/scripts/install +++ b/scripts/install @@ -74,7 +74,7 @@ ynh_add_nginx_config # Create a dedicated 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" diff --git a/scripts/restore b/scripts/restore index 2b5f6c4..9c080e0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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" 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" diff --git a/scripts/upgrade b/scripts/upgrade index 33ca2f4..1405fec 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,6 +41,16 @@ if echo "$context" | grep -- -; then ynh_app_setting_set --app="$app" --key="context" --value="$context" 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 ynh_secure_remove --file="$install_dir/.pythonz" @@ -89,7 +99,7 @@ ynh_add_nginx_config # Create a dedicated 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"