Skip to content

Instantly share code, notes, and snippets.

@yyuu
Created December 28, 2015 01:26
Show Gist options
  • Save yyuu/6932ad3ac07d7ede9cb1 to your computer and use it in GitHub Desktop.
Save yyuu/6932ad3ac07d7ede9cb1 to your computer and use it in GitHub Desktop.
runit's run script for JupyterHub
#!/usr/bin/env bash
set -e
set -x
JUPYTERHUB_HOME="/srv/jupyterhub"
shopt -s nullglob
for node_module_bin in "${JUPYTERHUB_HOME}/current/node_modules/"*"/bin"; do
PATH="${node_module_bin}:${PATH}"
done
shopt -u nullglob
export HOME="${JUPYTERHUB_HOME}"
export PATH="${JUPYTERHUB_HOME}/current/bin:${PATH}"
export VIRTUAL_ENV="${JUPYTERHUB_HOME}/current"
# SSL encryption
SSL_CERTIFICATE_FILE="/etc/letsencrypt/live/acme.example.com/fullchain.pem"
SSL_CERTIFICATE_KEY_FILE="/etc/letsencrypt/live/acme.example.com/privkey.pem"
# Cookie secret
export JPY_COOKIE_SECRET="$(openssl rand -hex 1024)"
# Proxy authentication token
export CONFIGPROXY_AUTH_TOKEN="$(openssl rand -hex 32)"
exec 2>&1
exec jupyterhub --debug --ssl-cert="${SSL_CERTIFICATE_FILE}" --db="${JUPYTERHUB_HOME}/shared/jupyterhub.sqlite" --config="${JUPYTERHUB_HOME}/shared/jupyterhub_config.py" --ssl-key="${SSL_CERTIFICATE_KEY_FILE}" --ip=0.0.0.0 --port=443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment