diff --git a/tljh/installer.py b/tljh/installer.py index d5875eb..86dabb1 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -31,8 +31,10 @@ def ensure_jupyterhub_service(prefix): systemd.install_unit('jupyterhub.service', hub_unit_template.format(**unit_params)) # Set up proxy / hub secret oken if it is not already setup - if not os.path.exists('/etc/jupyterhub/configurable-http-proxy.secret'): - with open('/etc/jupyterhub/configurable-http-proxy.secret', 'w') as f: + # FIXME: Check umask here properly + proxy_secret_path = os.path.join(INSTALL_PREFIX, 'configurable-http-proxy.secret') + if not os.path.exists(proxy_secret_path): + with open(proxy_secret_path, 'w') as f: f.write('CONFIGPROXY_AUTH_TOKEN=' + secrets.token_hex(32)) diff --git a/tljh/jupyterhub_config.py b/tljh/jupyterhub_config.py index 89cdcd5..4889a2f 100644 --- a/tljh/jupyterhub_config.py +++ b/tljh/jupyterhub_config.py @@ -29,4 +29,4 @@ c.JupyterHub.port = 80 c.SystemdSpawner.extra_paths = [os.path.join(USER_ENV_PREFIX, 'bin')] -configurer.apply_yaml_config('/etc/jupyterhub/jupyterhub.yaml', c) +configurer.apply_yaml_config(os.path.join(INSTALL_PREFIX, 'jupyterhub.yaml'), c) diff --git a/tljh/systemd-units/configurable-http-proxy.service b/tljh/systemd-units/configurable-http-proxy.service index d0ddd9c..1187593 100644 --- a/tljh/systemd-units/configurable-http-proxy.service +++ b/tljh/systemd-units/configurable-http-proxy.service @@ -13,7 +13,7 @@ PrivateTmp=yes PrivateDevices=yes ProtectKernelTunables=yes ProtectKernelModules=yes -EnvironmentFile=/etc/jupyterhub/configurable-http-proxy.secret +EnvironmentFile={install_prefix}/configurable-http-proxy.secret ExecStart={install_prefix}/hub/bin/configurable-http-proxy \ --ip 0.0.0.0 \ --port 80 \ diff --git a/tljh/systemd-units/jupyterhub.service b/tljh/systemd-units/jupyterhub.service index 6ea4cf0..58b42f9 100644 --- a/tljh/systemd-units/jupyterhub.service +++ b/tljh/systemd-units/jupyterhub.service @@ -17,6 +17,6 @@ PrivateDevices=yes ProtectKernelTunables=yes ProtectKernelModules=yes # Source CONFIGPROXY_AUTH_TOKEN from here! -EnvironmentFile=/etc/jupyterhub/configurable-http-proxy.secret +EnvironmentFile={install_prefix}/configurable-http-proxy.secret Environment=TLJH_INSTALL_PREFIX={install_prefix} ExecStart={python_interpreter_path} -m jupyterhub.app -f {jupyterhub_config_path}