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

TLJH fails to run inside a docker container #214

Closed
joergklein opened this issue Oct 28, 2018 · 5 comments
Closed

TLJH fails to run inside a docker container #214

joergklein opened this issue Oct 28, 2018 · 5 comments

Comments

@joergklein
Copy link

joergklein commented Oct 28, 2018

I want to install the littlest jupyterhub via .gitlab-ci.yml in a subdomain.
Here is my .gitlab-ci.yml. I get this error message. I need a little help to fix this error message.

$ curl https://raw.githubusercontent.com/jupyterhub/the-littlest-jupyterhub/master/bootstrap/bootstrap.py | sudo python3 - --admin klein
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2682  100  2682    0     0  24381      0 --:--:-- --:--:-- --:--:-- 24381
Checking if TLJH is already installed...
Setting up hub environment
Installed python & virtual environment
Set up hub virtual environment
Setting up TLJH installer...
Setup tljh package
Starting TLJH installer...
> /usr/bin/npm pack @jupyterlab/hub-extension
Incompatible extension:

"@jupyterlab/hub-extension@0.12.0" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab              Extension        Package
>=0.18.3 <0.19.0        >=0.19.1 <0.20.0 @jupyterlab/application
>=0.18.3 <0.19.0        >=0.19.1 <0.20.0 @jupyterlab/apputils

Found compatible version: 0.11.0
> /usr/bin/npm pack @jupyterlab/hub-extension@0.11.0
> node /opt/tljh/user/lib/python3.6/site-packages/jupyterlab/staging/yarn.js install
> node /opt/tljh/user/lib/python3.6/site-packages/jupyterlab/staging/yarn.js run build
System has not been booted with systemd as init system (PID 1). Can't operate.
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 447, in <module>
    main()
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 436, in main
    ensure_jupyterhub_service(HUB_ENV_PREFIX)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 141, in ensure_jupyterhub_service
    systemd.reload_daemon()
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/systemd.py", line 19, in reload_daemon
    ], check=True)
  File "/usr/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['systemctl', 'daemon-reload']' returned non-zero exit status 1.
Downloading traefik 1.6.5...
ERROR: Job failed: exit code 1
image: ubuntu:latest

before_script:
  - apt-get update
  - apt-get install -y curl git ssh python3 rsync sudo
  - git submodule update --init --recursive

stages:
    - test
    - deploy

test_job:
  stage: test
  script:
    - curl
    https://raw.githubusercontent.com/jupyterhub/the-littlest-jupyterhub/master/bootstrap/bootstrap.py | sudo python3 - --admin admin

deploy:
  stage: deploy
  script:
    - curl
    https://raw.githubusercontent.com/jupyterhub/the-littlest jupyterhub/master/bootstrap/bootstrap.py | sudo python3 - --admin adminn
    - mkdir .public
    - cp  -r * .public
    - mv .public public
    - mkdir "${HOME}/.ssh"
    - echo "${SSH_HOST_KEY}" > "${HOME}/.ssh/known_hosts"
    - echo "${SSH_PRIVATE_KEY}" > "${HOME}/.ssh/id_rsa"
    - chmod 700 "${HOME}/.ssh/id_rsa"
    - rsync -hrvz --delete --exclude=_ public/ user@example.com:www/jupyter/
  artifacts:
    paths:
    - public
  only:
  - master
@yuvipanda
Copy link
Collaborator

Heya! I opened #215 to fix the problem about JupyterLab extension. However, upon reading the error message more closely, it looks like the problem is systemd related - the JupyterLab error message is a red herring.

System has not been booted with systemd as init system (PID 1). Can't operate.

is the issue.

You need to run systemd inside the docker container for TLJH to work. Unfortunately this isn't as simple as it should be (see https://developers.redhat.com/blog/2016/09/13/running-systemd-in-a-non-privileged-container/). You can see how we make it work with https://github.com/jupyterhub/the-littlest-jupyterhub/blob/master/integration-tests/Dockerfile.

@yuvipanda yuvipanda changed the title jupyterlab/hub-extension@0.12.0" is not compatible with the current JupyterLab TLJH fails to run inside a docker container Oct 29, 2018
@joergklein
Copy link
Author

I changed my .gitlab-ci.ym to

image: ubuntu:latest

before_script:
  - apt-get update
  - apt-get install -y systemd curl git ssh python3 rsync sudo
  - git submodule update --init --recursive

stages:
    - test
    - deploy

test_job:
  stage: test
  script:
    - mkdir -p /etc/sudoers.d
    - curl https://raw.githubusercontent.com/jupyterhub/the-littlest-jupyterhub/master/bootstrap/bootstrap.py | sudo python3 - --admin klein

this is the error message.

System has not been booted with systemd as init system (PID 1).

I don't know how to start the sytem in my gitlab-ci.yml.

Processing triggers for systemd (237-3ubuntu10.3) ...
$ git submodule update --init --recursive
$ mkdir -p /etc/sudoers.d
$ curl https://raw.githubusercontent.com/jupyterhub/the-littlest-jupyterhub/master/bootstrap/bootstrap.py | sudo python3 - --admin klein
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2682  100  2682    0     0  16254      0 --:--:-- --:--:-- --:--:-- 16254
Checking if TLJH is already installed...
Setting up hub environment
Installed python & virtual environment
Set up hub virtual environment
Setting up TLJH installer...
Setup tljh package
Starting TLJH installer...
Node v8.12.0

> /usr/bin/npm pack @jupyterlab/hub-extension
Node v8.12.0

> node /opt/tljh/user/lib/python3.6/site-packages/jupyterlab/staging/yarn.js install
> node /opt/tljh/user/lib/python3.6/site-packages/jupyterlab/staging/yarn.js run build
System has not been booted with systemd as init system (PID 1). Can't operate.
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 447, in <module>
    main()
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 436, in main
    ensure_jupyterhub_service(HUB_ENV_PREFIX)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 141, in ensure_jupyterhub_service
    systemd.reload_daemon()
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/systemd.py", line 19, in reload_daemon
    ], check=True)
  File "/usr/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['systemctl', 'daemon-reload']' returned non-zero exit status 1.
Downloading traefik 1.6.5...
ERROR: Job failed: exit code 1

@minrk
Copy link
Member

minrk commented Oct 30, 2018

For running in docker, I wouldn't recommend using TLJH. Instead, I would do a standard install of jupyterhub, which will ultimately be simpler, I think.

Can you give some more details of your use case?

@choldgraf
Copy link
Member

friendly ping on this issue - @joergklein did you decide to install jupyterhub on your own w/o tljh?

@joergklein
Copy link
Author

I build my own docker image to work with jupyterhub. That is not TLJH. Please chaeck it out. https://hub.docker.com/r/joergklein/jupyterhub/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants