mirror of
https://github.com/YunoHost-Apps/jupyterlab_ynh.git
synced 2024-09-03 19:26:35 +02:00
Fix install and multi instance
This commit is contained in:
parent
c397763f87
commit
bb1cd8aa8b
6 changed files with 19 additions and 4 deletions
|
@ -205,6 +205,8 @@ c.JupyterHub.bind_url = 'http://:__PORT____PATH__'
|
||||||
# .. versionadded:: 0.9
|
# .. versionadded:: 0.9
|
||||||
c.JupyterHub.hub_bind_url = 'http://127.0.0.1:__PORT_HUB__'
|
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.
|
## 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
|
# Use when the bind address (`hub_ip`) is 0.0.0.0 or otherwise different from
|
||||||
|
|
|
@ -4,7 +4,7 @@ After=syslog.target network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment="PATH=__FINALPATH__/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
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
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
WorkingDirectory=__FINALPATH__
|
WorkingDirectory=__FINALPATH__
|
||||||
|
|
|
@ -47,6 +47,7 @@ config_jupyterlab() {
|
||||||
ynh_replace_string "__PATH__" "${path_url%/}" $jupyterlab_conf_path
|
ynh_replace_string "__PATH__" "${path_url%/}" $jupyterlab_conf_path
|
||||||
ynh_replace_string "__PORT__" "$port" $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_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 "__FINAL_PATH__" "$final_path" $jupyterlab_conf_path
|
||||||
ynh_replace_string "__ADMIN__" "$admin" $jupyterlab_conf_path
|
ynh_replace_string "__ADMIN__" "$admin" $jupyterlab_conf_path
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
admin=$(ynh_app_setting_get "$app" admin)
|
admin=$(ynh_app_setting_get "$app" admin)
|
||||||
port=$(ynh_app_setting_get "$app" port)
|
port=$(ynh_app_setting_get "$app" port)
|
||||||
port_hub=$(ynh_app_setting_get "$app" port_hub)
|
port_hub=$(ynh_app_setting_get "$app" port_hub)
|
||||||
|
port_http_proxy=$(ynh_app_setting_get "$app" port_http_proxy)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK PATHS SYNTAX
|
# CHECK PATHS SYNTAX
|
||||||
|
@ -109,4 +110,6 @@ systemctl reload nginx
|
||||||
# START SERVICE
|
# START SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_systemd_action -n $app -a start -l "JupyterHub is now running at" -p /var/log/$app.log
|
systemctl start $app
|
||||||
|
|
||||||
|
ynh_systemd_action -n $app -a start -l "JupyterHub is now running at" -p "systemd"
|
|
@ -63,12 +63,15 @@ ynh_app_setting_set $app enable_terminal $is_public
|
||||||
|
|
||||||
# Find free ports
|
# Find free ports
|
||||||
port=$(ynh_find_port 8080)
|
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 2>&1
|
||||||
yunohost firewall allow --no-upnp TCP $port_hub 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 $port
|
||||||
ynh_app_setting_set $app port_hub $port_hub
|
ynh_app_setting_set $app port_hub $port_hub
|
||||||
|
ynh_app_setting_set $app port_http_proxy $port_http_proxy
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -141,4 +144,4 @@ yunohost service add $app --log "/var/log/$app.log"
|
||||||
# START SERVICE
|
# START SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_systemd_action -n $app -a start -l "JupyterHub is now running at" -p /var/log/$app.log
|
ynh_systemd_action -n $app -a start -l "JupyterHub is now running at" -p "systemd"
|
|
@ -21,6 +21,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
port=$(ynh_app_setting_get "$app" port)
|
port=$(ynh_app_setting_get "$app" port)
|
||||||
port_hub=$(ynh_app_setting_get "$app" port_hub)
|
port_hub=$(ynh_app_setting_get "$app" port_hub)
|
||||||
|
port_http_proxy=$(ynh_app_setting_get "$app" port_http_proxy)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -73,6 +74,11 @@ then
|
||||||
echo "Close port $port_hub" >&2
|
echo "Close port $port_hub" >&2
|
||||||
yunohost firewall disallow TCP $port_hub 2>&1
|
yunohost firewall disallow TCP $port_hub 2>&1
|
||||||
fi
|
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
|
# REMOVE NGINX CONFIGURATION
|
||||||
|
|
Loading…
Reference in a new issue