From bfd2a8bca3f4f90528db273546891774268097b5 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Wed, 27 Jun 2018 14:21:08 -0700 Subject: [PATCH] Store hub state inside install_prefix rm -rf'ing the prefix should get rid of almost everything --- tljh/installer.py | 2 ++ tljh/systemd-units/jupyterhub.service | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tljh/installer.py b/tljh/installer.py index 86dabb1..d17e296 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -37,6 +37,8 @@ def ensure_jupyterhub_service(prefix): with open(proxy_secret_path, 'w') as f: f.write('CONFIGPROXY_AUTH_TOKEN=' + secrets.token_hex(32)) + os.makedirs(os.path.join(INSTALL_PREFIX, 'hub', 'state'), mode=0o700, exist_ok=True) + def ensure_jupyterhub_package(prefix): """ diff --git a/tljh/systemd-units/jupyterhub.service b/tljh/systemd-units/jupyterhub.service index 58b42f9..525b74b 100644 --- a/tljh/systemd-units/jupyterhub.service +++ b/tljh/systemd-units/jupyterhub.service @@ -8,9 +8,7 @@ User=root Restart=always # jupyterhub process should have no access to home directories ProtectHome=tmpfs -# Use a persistent, permissioned state directory for db + cookie secrets -StateDirectory=jupyterhub -WorkingDirectory=/var/lib/jupyterhub +WorkingDirectory={install_prefix}/hub/state # Protect bits that are normally shared across the system PrivateTmp=yes PrivateDevices=yes