Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Docker Compose for the development environment #649

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3.9"
services:
hub:
build: ./integration-tests
privileged: true
volumes:
- type: bind
source: .
target: /srv/src
ports:
- "12000:80"
52 changes: 22 additions & 30 deletions docs/contributing/dev-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,27 @@ The easiest & safest way to develop & test TLJH is with `Docker <https://www.doc
`their website <https://www.docker.com/community-edition>`_.

#. Clone the `git repo <https://github.com/jupyterhub/the-littlest-jupyterhub>`_ (or your fork of it).
#. Build a docker image that has a functional systemd in it.
#. Build the Docker image and start the container.

.. code-block:: bash

docker build -t tljh-systemd . -f integration-tests/Dockerfile
docker-compose up --build

#. Run a docker container with the image in the background, while bind mounting
your TLJH repository under ``/srv/src``.

.. code-block:: bash

docker run \
--privileged \
--detach \
--name=tljh-dev \
--publish 12000:80 \
--mount type=bind,source=$(pwd),target=/srv/src \
tljh-systemd

#. Get a shell inside the running docker container.

.. code-block:: bash

docker exec -it tljh-dev /bin/bash

#. Run the bootstrapper from inside the container (see step above):
#. From another terminal, run the bootstrapper:
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.

.. code-block:: console
.. code-block:: bash

python3 /srv/src/bootstrap/bootstrap.py --admin admin
docker-compose exec hub python3 /srv/src/bootstrap/bootstrap.py --admin admin

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):

.. code-block:: console
.. code-block:: bash

python3 /srv/src/bootstrap/bootstrap.py --admin admin:password
docker-compose exec hub python3 /srv/src/bootstrap/bootstrap.py --admin admin:password

The primary hub environment will also be in your PATH already for convenience.

Expand All @@ -61,15 +42,26 @@ The easiest & safest way to develop & test TLJH is with `Docker <https://www.doc
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``.
you can test it by running:

.. code-block:: bash

docker-compose exec hub 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``.
you can test it by running:

.. code-block:: bash

docker-compose exec hub 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.
restart jupyterhub for them to take effect:

.. code-block:: bash

docker-compose exec hub tljh-config reload hub

:ref:`troubleshooting/logs` has information on looking at various logs in the container
to debug issues you might have.