diff --git a/conf/jupyterhub_config.py b/conf/jupyterhub_config.py index 3a26dff..9377df4 100644 --- a/conf/jupyterhub_config.py +++ b/conf/jupyterhub_config.py @@ -205,6 +205,8 @@ c.JupyterHub.bind_url = 'http://:__PORT____PATH__' # .. versionadded:: 0.9 c.JupyterHub.hub_bind_url = 'http://127.0.0.1:__PORT_HUB__' +c.ConfigurableHTTPProxy.api_url = 'http://127.0.0.1:__PORT_HTTP_PROXY__' + ## The ip or hostname for proxies and spawners to use for connecting to the Hub. # # Use when the bind address (`hub_ip`) is 0.0.0.0 or otherwise different from diff --git a/conf/systemd.service.default b/conf/systemd.service.default index c8063f7..0b35399 100644 --- a/conf/systemd.service.default +++ b/conf/systemd.service.default @@ -4,7 +4,7 @@ After=syslog.target network.target [Service] Environment="PATH=__FINALPATH__/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -ExecStart=/bin/sh -c "__FINALPATH__/bin/jupyterhub -f __CONFIGPATH__/jupyterhub_config.py 2&>> /var/log/__APP__.log" +ExecStart=__FINALPATH__/bin/jupyterhub -f __CONFIGPATH__/jupyterhub_config.py 2&>> /var/log/__APP__.log Restart=always RestartSec=10 WorkingDirectory=__FINALPATH__ diff --git a/scripts/_common.sh b/scripts/_common.sh index cebe3a8..cbdc2cd 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -47,6 +47,7 @@ config_jupyterlab() { ynh_replace_string "__PATH__" "${path_url%/}" $jupyterlab_conf_path ynh_replace_string "__PORT__" "$port" $jupyterlab_conf_path ynh_replace_string "__PORT_HUB__" "$port_hub" $jupyterlab_conf_path + ynh_replace_string "__PORT_HTTP_PROXY__" "$port_http_proxy" $jupyterlab_conf_path ynh_replace_string "__FINAL_PATH__" "$final_path" $jupyterlab_conf_path ynh_replace_string "__ADMIN__" "$admin" $jupyterlab_conf_path diff --git a/scripts/change_url b/scripts/change_url index 832c559..6023277 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -34,6 +34,7 @@ app=$YNH_APP_INSTANCE_NAME admin=$(ynh_app_setting_get "$app" admin) port=$(ynh_app_setting_get "$app" port) port_hub=$(ynh_app_setting_get "$app" port_hub) +port_http_proxy=$(ynh_app_setting_get "$app" port_http_proxy) #================================================= # CHECK PATHS SYNTAX @@ -109,4 +110,6 @@ systemctl reload nginx # START SERVICE #================================================= -ynh_systemd_action -n $app -a start -l "JupyterHub is now running at" -p /var/log/$app.log \ No newline at end of file +systemctl start $app + +ynh_systemd_action -n $app -a start -l "JupyterHub is now running at" -p "systemd" \ No newline at end of file diff --git a/scripts/install b/scripts/install index 9d181d5..49d8605 100644 --- a/scripts/install +++ b/scripts/install @@ -63,12 +63,15 @@ ynh_app_setting_set $app enable_terminal $is_public # Find free ports port=$(ynh_find_port 8080) -port_hub=$(ynh_find_port 8081) +port_hub=$(ynh_find_port $(($port + 1))) +port_http_proxy=$(ynh_find_port $(($port_hub + 1))) yunohost firewall allow --no-upnp TCP $port 2>&1 yunohost firewall allow --no-upnp TCP $port_hub 2>&1 +yunohost firewall allow --no-upnp TCP $port_http_proxy 2>&1 ynh_app_setting_set $app port $port ynh_app_setting_set $app port_hub $port_hub +ynh_app_setting_set $app port_http_proxy $port_http_proxy #================================================= # NGINX CONFIGURATION @@ -141,4 +144,4 @@ yunohost service add $app --log "/var/log/$app.log" # START SERVICE #================================================= -ynh_systemd_action -n $app -a start -l "JupyterHub is now running at" -p /var/log/$app.log \ No newline at end of file +ynh_systemd_action -n $app -a start -l "JupyterHub is now running at" -p "systemd" \ No newline at end of file diff --git a/scripts/remove b/scripts/remove index 075c5d2..54f70d1 100644 --- a/scripts/remove +++ b/scripts/remove @@ -21,6 +21,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) port=$(ynh_app_setting_get "$app" port) port_hub=$(ynh_app_setting_get "$app" port_hub) +port_http_proxy=$(ynh_app_setting_get "$app" port_http_proxy) #================================================= # STANDARD REMOVE @@ -73,6 +74,11 @@ then echo "Close port $port_hub" >&2 yunohost firewall disallow TCP $port_hub 2>&1 fi +if yunohost firewall list | grep -q "\- $port_http_proxy$" +then + echo "Close port $port_http_proxy" >&2 + yunohost firewall disallow TCP $port_http_proxy 2>&1 +fi #================================================= # REMOVE NGINX CONFIGURATION