mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Add docs for setting up a developer environment
This commit is contained in:
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
# Systemd inside a Docker container, for CI only
|
||||
FROM ubuntu:18.04
|
||||
|
||||
RUN apt-get update --yes
|
||||
|
||||
RUN apt-get install --yes systemd curl git
|
||||
|
||||
# Kill all the things we don't need
|
||||
RUN find /etc/systemd/system \
|
||||
/lib/systemd/system \
|
||||
-path '*.wants/*' \
|
||||
-not -name '*journald*' \
|
||||
-not -name '*systemd-tmpfiles*' \
|
||||
-not -name '*systemd-user-sessions*' \
|
||||
-exec rm \{} \;
|
||||
|
||||
RUN mkdir -p /etc/sudoers.d
|
||||
|
||||
RUN systemctl set-default multi-user.target
|
||||
|
||||
STOPSIGNAL SIGRTMIN+3
|
||||
|
||||
# Set up image to be useful out of the box for development & CI
|
||||
ENV TLJH_INSTALL_PIP_FLAGS="--no-cache-dir -e"
|
||||
ENV TLJH_INSTALL_PIP_SPEC=/srv/src
|
||||
ENV PATH=/opt/tljh/hub/bin:${PATH}
|
||||
|
||||
CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"]
|
||||
65
docs/contributing/dev-setup.rst
Normal file
65
docs/contributing/dev-setup.rst
Normal file
@@ -0,0 +1,65 @@
|
||||
.. _contributing_dev_setup:
|
||||
|
||||
Setting up Development Environment
|
||||
==================================
|
||||
|
||||
The easiest & safest way to develop & test TLJH is with `Docker <https://www.docker.com/>`_.
|
||||
|
||||
#. Install Docker Community Edition by following the instructions on
|
||||
`their website <https://www.docker.com/community-edition>`_.
|
||||
|
||||
#. Clone the git repo (or your fork of it).
|
||||
#. Build a docker image that has a functional systemd in it.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo docker build -t tljh-systemd .
|
||||
|
||||
#. 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 installer! 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:: bash
|
||||
|
||||
bash /srv/src/installer/install.bash
|
||||
|
||||
The primary hub environment will also be in your PATH already for convenience.
|
||||
|
||||
#. You should be able to access the JupyterHub from your browser now at
|
||||
`http://localhost:1200 <http://localhost:12000>`_. Congratulations, you are
|
||||
set up to develop TLJH!
|
||||
|
||||
#. Make some changes to the repository. You can test easily depending on what
|
||||
you changed.
|
||||
|
||||
* If you changed the ``installer/install.bash`` script or any of its dependencies,
|
||||
you can test it by running ``bash /srv/src/installer/install.bash``.
|
||||
|
||||
* 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.yaml`` or any of their dependencies, you only need to
|
||||
restart jupyterhub for them to take effect. ``systemctl restart jupyterhub``
|
||||
should do that.
|
||||
|
||||
:ref:`troubleshoot_logs` has information on looking at various logs in the container
|
||||
to debug issues you might have.
|
||||
@@ -53,3 +53,14 @@ guides help you find what is broken & hopefully fix it.
|
||||
:titlesonly:
|
||||
|
||||
troubleshooting/logs
|
||||
|
||||
Contributing
|
||||
============
|
||||
|
||||
Whatever you think your skillsets are, your contributions to TLJH are highly
|
||||
appreciated.
|
||||
|
||||
.. toctree::
|
||||
:titlesonly:
|
||||
|
||||
contributing/dev-setup
|
||||
|
||||
@@ -13,7 +13,7 @@ function install_miniconda {
|
||||
URL="https://repo.continuum.io/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh"
|
||||
INSTALLER_PATH=/tmp/miniconda-installer.sh
|
||||
|
||||
wget $URL -O ${INSTALLER_PATH}
|
||||
curl -o ${INSTALLER_PATH} ${URL}
|
||||
chmod +x ${INSTALLER_PATH}
|
||||
|
||||
# Only MD5 checksums are available for miniconda
|
||||
|
||||
Reference in New Issue
Block a user