diff options
-rw-r--r-- | .SRCINFO | 23 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | PKGBUILD | 83 | ||||
-rw-r--r-- | jupyterhub.install | 12 | ||||
-rw-r--r-- | jupyterhub.service | 46 |
5 files changed, 150 insertions, 19 deletions
@@ -1,12 +1,18 @@ pkgbase = jupyterhub pkgdesc = Multi-user server for Jupyter notebooks - pkgver = 1.1.0 + pkgver = 1.4.0 pkgrel = 1 url = https://jupyter.org/hub + install = jupyterhub.install arch = any license = BSD - makedepends = bower + checkdepends = jupyter-notebook + checkdepends = python-beautifulsoup4 + checkdepends = python-pytest + checkdepends = python-pytest-asyncio + checkdepends = python-requests-mock makedepends = npm + makedepends = python-setuptools depends = ipython depends = nodejs-configurable-http-proxy depends = python-alembic @@ -14,18 +20,21 @@ pkgbase = jupyterhub depends = python-certipy depends = python-entrypoints depends = python-jinja - depends = python-jupyter_telemetry depends = python-jsonschema - depends = python-json-logger + depends = python-jupyter_telemetry depends = python-oauthlib depends = python-pamela depends = python-prometheus_client depends = python-requests depends = python-sqlalchemy depends = python-tornado - optdepends = jupyterlab - source = https://github.com/jupyterhub/jupyterhub/archive/1.1.0.tar.gz - sha256sums = e5f70bf02d0500accdc2c25b33de037bb8be9957d1d95473ea8958b5806906b6 + optdepends = jupyter-notebook: standard notebook server + optdepends = jupyterlab: to use the JupyterLab interface + backup = etc/jupyterhub/jupyterhub_config.py + source = jupyterhub-1.4.0.tar.gz::https://github.com/jupyterhub/jupyterhub/archive/1.4.0.tar.gz + source = jupyterhub.service + sha256sums = fc1f52d7073e65cf7e93caff87ebc3eeff65cd18e0aaa734ffaa0c00cbe6a352 + sha256sums = adb4c09c668c35605d9cddc4a4171dd64ed6e74ab82da97f19b3437d26b052b9 pkgname = jupyterhub diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..8074b077ed04 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +src +pkg +*.tar.zst +*.tar.gz +*.log @@ -1,30 +1,89 @@ -# Maintainer: Sebastiaan Lokhorst <sebastiaanlokhorst@gmail.com> +# Maintainer: Blair Bonnett <blair dot bonnett at gmail dot com> +# Contributor: Sebastiaan Lokhorst <sebastiaanlokhorst@gmail.com> # Contributor: Tommy Li <ttoo74@gmail.com> # Contributor: Mark Lee <mark at markelee dot com> pkgname=jupyterhub -pkgver=1.1.0 +pkgver=1.4.0 pkgrel=1 pkgdesc="Multi-user server for Jupyter notebooks " url="https://jupyter.org/hub" arch=(any) license=('BSD') -depends=('ipython' 'nodejs-configurable-http-proxy' - 'python-alembic' 'python-async_generator' 'python-certipy' 'python-entrypoints' 'python-jinja' 'python-jupyter_telemetry' 'python-jsonschema' - 'python-json-logger' 'python-oauthlib' 'python-pamela' 'python-prometheus_client' 'python-requests' 'python-sqlalchemy' 'python-tornado') -makedepends=('bower' 'npm') -optdepends=('jupyterlab') -source=("https://github.com/jupyterhub/jupyterhub/archive/${pkgver}.tar.gz") -sha256sums=('e5f70bf02d0500accdc2c25b33de037bb8be9957d1d95473ea8958b5806906b6') +depends=( + 'ipython' 'nodejs-configurable-http-proxy' 'python-alembic' + 'python-async_generator' 'python-certipy' 'python-entrypoints' 'python-jinja' + 'python-jsonschema' 'python-jupyter_telemetry' 'python-oauthlib' + 'python-pamela' 'python-prometheus_client' 'python-requests' + 'python-sqlalchemy' 'python-tornado' +) +makedepends=( + 'npm' 'python-setuptools' +) +checkdepends=( + 'jupyter-notebook' 'python-beautifulsoup4' 'python-pytest' + 'python-pytest-asyncio' 'python-requests-mock' +) +optdepends=( + 'jupyter-notebook: standard notebook server' + 'jupyterlab: to use the JupyterLab interface' +) +install=jupyterhub.install +backup=( + 'etc/jupyterhub/jupyterhub_config.py' +) +source=( + "jupyterhub-${pkgver}.tar.gz::https://github.com/jupyterhub/jupyterhub/archive/${pkgver}.tar.gz" + 'jupyterhub.service' +) +sha256sums=( + 'fc1f52d7073e65cf7e93caff87ebc3eeff65cd18e0aaa734ffaa0c00cbe6a352' + 'adb4c09c668c35605d9cddc4a4171dd64ed6e74ab82da97f19b3437d26b052b9' +) build() { cd "${srcdir}/jupyterhub-$pkgver" python setup.py build -} + + # Generate the default configuration. The value of data_files_path is set + # based on the directory containing the loaded code, so we need to replace + # it with the final installed destination. + cd build/lib + python -m jupyterhub --generate-config -f "$srcdir/default_config.py" -y=true + _srcdir_esc="${srcdir////\\/}" + sed -i -e "s/${_srcdir_esc}\/jupyterhub-$pkgver/\/usr/" "$srcdir/default_config.py" +} + +check() { + cd "${srcdir}/jupyterhub-$pkgver" + + # Run the tests we can. The DB upgrade tests always fail for me (it looks + # like the virtual environment they set up is not complete) and the others + # intermittently fail. We'll have to trust the upstream CI on those. + PYTHONPATH="$PWD/build/lib" pytest -v jupyterhub/tests \ + --ignore=jupyterhub/tests/test_db.py \ + -k "not test_external_service and not test_single_user_spawner" +} package() { cd "${srcdir}/jupyterhub-$pkgver" - python setup.py install --root="${pkgdir}" install -Dm644 COPYING.md "${pkgdir}"/usr/share/licenses/$pkgname/COPYING.md -} + # Something in the test suite writes byte code with $srcdir references, even + # if we set PYTHONDONTWRITEBYTECODE=1. Just remove the caches. This also + # covers anything written when generating the default config. + find . -name "*.pyc" -delete + find . -type d -name __pycache__ -delete + + # Install the package. + python setup.py install --root="${pkgdir}" --prefix=/usr --skip-build --optimize=1 + + # Remove $srcdir references from (1) npm metadata and (2) Python egg metadata. + find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d' + _srcdir_esc="${srcdir////\\/}" + find "$pkgdir" -name SOURCES.txt -exec sed -i "/${_srcdir_esc}/d" {} \; + + # systemd service and default configuration. + install -Dm644 "$srcdir/jupyterhub.service" "$pkgdir/usr/lib/systemd/system/jupyterhub.service" + install -Dm644 "$srcdir/default_config.py" "$pkgdir/etc/jupyterhub/jupyterhub_config.py" +} diff --git a/jupyterhub.install b/jupyterhub.install new file mode 100644 index 000000000000..46d662721368 --- /dev/null +++ b/jupyterhub.install @@ -0,0 +1,12 @@ +## arg 1: the new package version +## arg 2: the old package version +post_upgrade () { + # Upgrading from pre-1.4.0: output message about new systemd service. + if [ $(vercmp "$2" 1.4.0-1) -lt 0 ]; then + echo "From 1.4.0-1 this package provides a systemd service file at" + echo " /usr/lib/systemd/system/jupyterhub.service" + echo "If you have a custom service in /etc/systemd/system or a" + echo "similar location, it will continue to be used instead of the" + echo "service from this package." + fi +} diff --git a/jupyterhub.service b/jupyterhub.service new file mode 100644 index 000000000000..34a31173b1db --- /dev/null +++ b/jupyterhub.service @@ -0,0 +1,46 @@ +[Unit] +Description=JupyterHub server +After=network.target +Documentation=https://jupyterhub.readthedocs.io/en/stable/ + +[Service] +# Where the PID and other runtime files will be placed. +RuntimeDirectory=jupyterhub +RuntimeDirectoryMode=0755 + +# Paths in the configuration are relative to the working directory. +WorkingDirectory=/etc/jupyterhub + +# The actual command to run. Note this service doesn't need the PID files, but +# JupyterHub does use them internally. +ExecStart=/usr/bin/jupyterhub \ + -f /etc/jupyterhub/jupyterhub_config.py \ + --pid-file=/run/jupyterhub/jupyterhub.pid \ + --ConfigurableHTTPProxy.pid_file=/run/jupyterhub/jupyterhub-proxy.pid + +# Apply some service hardening. +# The default LocalProcess spawner needs SETUID and SETGID to run the +# single-user servers. +CapabilityBoundingSet=CAP_SETUID CAP_SETGID +LockPersonality=true +NoNewPrivileges=true +PrivateTmp=true +PrivateDevices=true +ProtectClock=true +ProtectControlGroups=true +ProtectHostname=true +ProtectKernelLogs=true +ProtectKernelModules=true +ProtectKernelTunables=true +ProtectProc=invisible +ProtectSystem=full +ReadWritePaths=/etc/jupyterhub +RestrictNamespaces=true +RestrictRealtime=true +RestrictSUIDSGID=true +SystemCallArchitectures=native +SystemCallErrorNumber=EPERM +SystemCallFilter=@system-service + +[Install] +WantedBy=multi-user.target |