2023-03-27 09:31:02 +02:00
|
|
|
(contributing-dev-setup)=
|
|
|
|
|
|
|
|
|
|
# Setting up Development Environment
|
|
|
|
|
|
|
|
|
|
The easiest & safest way to develop & test TLJH is with [Docker](https://www.docker.com/).
|
|
|
|
|
|
|
|
|
|
1. Install Docker Community Edition by following the instructions on
|
|
|
|
|
[their website](https://www.docker.com/community-edition).
|
|
|
|
|
|
|
|
|
|
2. Clone the [git repo](https://github.com/jupyterhub/the-littlest-jupyterhub) (or your fork of it).
|
|
|
|
|
|
|
|
|
|
3. Build a docker image that has a functional systemd in it.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker build -t tljh-systemd . -f integration-tests/Dockerfile
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
4. Run a docker container with the image in the background, while bind mounting
|
|
|
|
|
your TLJH repository under `/srv/src`.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker run \
|
|
|
|
|
--privileged \
|
|
|
|
|
--detach \
|
|
|
|
|
--name=tljh-dev \
|
|
|
|
|
--publish 12000:80 \
|
2024-12-08 19:23:21 -08:00
|
|
|
--env TLJH_BOOTSTRAP_DEV=yes \
|
|
|
|
|
--env TLJH_BOOTSTRAP_PIP_SPEC=/srv/src \
|
2025-12-08 15:42:00 +01:00
|
|
|
--env "PATH=/opt/tljh/hub/bin:${PATH}" \
|
2023-06-06 09:40:32 -04:00
|
|
|
--mount type=bind,source="$(pwd)",target=/srv/src \
|
2023-03-27 09:31:02 +02:00
|
|
|
tljh-systemd
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
5. Get a shell inside the running docker container.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker exec -it tljh-dev /bin/bash
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
6. Run the bootstrapper from inside the container (see step above):
|
|
|
|
|
The container image is already set up to default to a `dev` install, so
|
|
|
|
|
it'll install from your local repo rather than from github.
|
|
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
python3 /srv/src/bootstrap/bootstrap.py --admin admin
|
|
|
|
|
```
|
|
|
|
|
|
2023-04-04 21:44:58 +02:00
|
|
|
Or, if you would like to setup the admin's password during install,
|
|
|
|
|
you can use this command (replace "admin" with the desired admin username
|
|
|
|
|
and "password" with the desired admin password):
|
|
|
|
|
|
|
|
|
|
```console
|
|
|
|
|
python3 /srv/src/bootstrap/bootstrap.py --admin admin:password
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The primary hub environment will also be in your PATH already for convenience.
|
|
|
|
|
|
|
|
|
|
7. You should be able to access the JupyterHub from your browser now at
|
2023-03-27 09:31:02 +02:00
|
|
|
[http://localhost:12000](http://localhost:12000). Congratulations, you are
|
|
|
|
|
set up to develop TLJH!
|
|
|
|
|
|
2023-04-04 21:44:58 +02:00
|
|
|
8. Make some changes to the repository. You can test easily depending on what
|
2023-03-27 09:31:02 +02:00
|
|
|
you changed.
|
|
|
|
|
- If you changed the `bootstrap/bootstrap.py` script or any of its dependencies,
|
|
|
|
|
you can test it by running `python3 /srv/src/bootstrap/bootstrap.py`.
|
|
|
|
|
- If you changed the `tljh/installer.py` code (or any of its dependencies),
|
|
|
|
|
you can test it by running `python3 -m tljh.installer`.
|
|
|
|
|
- If you changed `tljh/jupyterhub_config.py`, `tljh/configurer.py`,
|
|
|
|
|
`/opt/tljh/config/` or any of their dependencies, you only need to
|
|
|
|
|
restart jupyterhub for them to take effect. `tljh-config reload hub`
|
|
|
|
|
should do that.
|
|
|
|
|
|
2023-03-27 09:56:46 +02:00
|
|
|
[](/troubleshooting/logs) has information on looking at various logs in the container
|
2023-03-27 09:31:02 +02:00
|
|
|
to debug issues you might have.
|