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

Update the jupyterhub/repo2docker image #217

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
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
5 changes: 3 additions & 2 deletions ansible/tljh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# Pull the repo2docker image to build user images
- name: Pull the repo2docker Docker image
docker_image:
name: quay.io/jupyterhub/repo2docker
tag: main
name: "{{ repo2docker_docker_name }}"
tag: "{{ repo2docker_docker_tag }}"
source: pull
force_source: yes
3 changes: 3 additions & 0 deletions ansible/vars/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ tljh_prefix: /opt/tljh
tljh_bootstrap_pip_spec: git+https://github.com/jtpio/the-littlest-jupyterhub.git@skip-install#"egg=the_littlest_jupyterhub"
tljh_installer_url: https://raw.githubusercontent.com/jtpio/the-littlest-jupyterhub/skip-install/bootstrap/bootstrap.py

repo2docker_docker_name: quay.io/jupyterhub/repo2docker
repo2docker_docker_tag: 2023.06.0-41.g57d229e

...
15 changes: 15 additions & 0 deletions docs/install/ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,21 @@ tagged as `v0.1`:
tljh_plasma: git+https://github.com/plasmabio/[email protected]#"egg=tljh-plasma&subdirectory=tljh-plasma"
```

## Using a specific version of `repo2docker`

`repo2docker` is used to build the user environments from the Git repositories.

By default the Ansible playbooks use a pinned version of the `jupyterhub/repo2docker`, which is defined in the
`ansible/vars/default.yml` file.

Like other Ansible variables, it is possible to use a different version of `repo2docker` by overriding the variable
via the command line:

```bash
# use an older version of the repo2docker image
ansible-playbook tljh.yml -i hosts -u ubuntu -e "repo2docker_docker_tag=2022.10.0-232.g0ea6f7d"
```

## List of available playbooks

The Ansible playbooks are located in the `ansible/` directory:
Expand Down
2 changes: 2 additions & 0 deletions tljh-plasma/tljh_plasma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def tljh_custom_jupyterhub_config(c, tljh_config_file=CONFIG_FILE):
c.PlasmaSpawner.cmd = ["/srv/conda/envs/notebook/bin/jupyterhub-singleuser"]
# set the default cpu and memory limits
c.PlasmaSpawner.args = ["--ResourceUseDisplay.track_cpu_percent=True"]
# explicitely opt-in to enable the custom entrypoint logic
c.PlasmaSpawner.run_as_root = True
Copy link
Member Author

@jtpio jtpio Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now opt-in in dockerspawner>=12.0: https://jupyterhub-dockerspawner.readthedocs.io/en/latest/changelog.html#id3

Not sure why we didn't have to set it explicitly before, as it was updated in #193.


# prevent PID 1 running in the Docker container to stop when child processes are killed
# see https://github.com/plasmabio/plasma/issues/191 for more info
Expand Down
2 changes: 1 addition & 1 deletion tljh-plasma/tljh_plasma/entrypoint/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ export JUPYTER_PATH=${IMAGE_DIR}/.local/share/jupyter
cd ${IMAGE_DIR}

# execute the notebook process as the given user
exec su - $NB_USER -m -c '"$0" "$@"' -- "$@"
exec su $NB_USER -m -c '"$0" "$@"' -- "$@"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK this seems to be doing the trick for being able able to launch the server.

If I understand correctly, specifying - would be equivalent to starting the process with --login, which conflicts with -m / --preserve-environment.

As hinted by the the error logs:

su: ignoring --preserve-environment, it's mutually exclusive with --login
--root-prefix: 1 required TEXT missing
Run with --help for more information.
/srv/conda/envs/notebook/bin/jupyterhub-singleuser: 7: /etc/profile.d/activate-conda.sh: [[: not found
/srv/conda/envs/notebook/bin/jupyterhub-singleuser: 20: /etc/profile.d/activate-conda.sh: mamba: not found
JUPYTERHUB_API_TOKEN env is required to run jupyterhub-singleuser. Did you launch it manually?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is related to recent update of the mamba activation scripts in repo2docker. Removing the - seems to be working fine locally so we should be able to do without now:

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to do a bit more testing on a test VM, but this change might break compatibility with existing environments built with an older version of repo2docker.

Loading