This repository provides a setup to deploy a JupyterHub server that supports NeuroDesktop, offering each user a private, containerized environment. This setup leverages Docker Compose and includes features like security enhancements (fail2ban
), user management with NativeAuthenticator
, and Slack notifications.
This setup is designed for research or educational institutions where users need access to data science and neuroimaging tools in isolated environments. Each user has a personal directory in BASE_USER_DIR=/path/to/user/dir
(change this in the .env), enabling persistent storage across sessions. With NativeAuthenticator
, users can self-register, though admin approval is required for access.
-
Install git
-
Install Docker https://docs.docker.com/engine/install
-
Install docker compose https://docs.docker.com/compose/install
-
Clone the Repository:
git clone https://github.com/wieluk/jupyterhub-neurodesk.git cd jupyterhub-neurodesk
-
Create docker network
docker network create jupyterhub-network
-
Edit .env
Open
.env
and ensureBASE_USER_DIR
is set to the directory where you want to save user data. This is where each user’s data will be stored persistently on the host machine. -
Use Docker Compose:
docker compose up -d
-
Create Admin User
Go to
localhost:8000
orserverip:port_you_choose
in your browser and sign up asadmin
.
Note The first start of neurodesk will take some time. The docker image needs to be downloaded.
-
Images:
- The configuration dynamically fetches all available versions of the NeuroDesktop image from Docker Hub.
-
Resource Limits:
- You can set resource limits for each user’s container by uncommenting and adjusting
mem_limit
andcpu_limit
injupyterhub_config.py
:# c.DockerSpawner.mem_limit = '8G' # c.DockerSpawner.cpu_limit = 4
- You can set resource limits for each user’s container by uncommenting and adjusting
-
Idle Culling:
- Idle containers are automatically culled after 2 weeks to free up resources.
-
Fail2Ban:
- The configuration includes
fail2ban
support to block repeated failed login attempts, enhancing security. - Failed login attempts are limited, and a cooldown period applies after consecutive failures.
- The configuration includes
-
Slack Notifications:
- Only uncomment if jupyterhub.sqlite already exists in jupyterhub_config folder
- Slack integration allows admins to receive notifications for specific events.
- Add your Slack webhook URL in the
.env
file if you want real-time alerts for server issues or login attempts.