Closed alvinhuff closed 5 years ago
So on a side note this is my first serious attempt at building something within the jupyterverse. Any recommendations on good starting point would be appreciated. This project will be for an online course teaching programing principles. I am not the instructor, but the tech support.
The problem is with this line:
c.JupyterHub.hub_ip = '0.0.0.0'
You need to bind JupyterHub to a reachable IP address from outside your computer.
Also, it's better to check this out if you haven't: https://jupyterhub.readthedocs.io/en/stable/getting-started/networking-basics.html
c.JupyterHub.hub_connect_ip
should be set to an IP visible to the docker containers.
@mohirio According to the link you provided " Added in 0.8: The c.JupyterHub.hub_connect_ip setting is the ip address or hostname that other services should use to connect to the Hub" is this feature buggy? below is from the "docker inspect" command for the juptyerhubserver container.
"Config": {
"Hostname": "jupyterhubserver",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"8000/tcp": {}
I am running jupyterhub as a docker container on a jetstream-cloud.org Ubuntu 18.04 VM. I use the hostname because the ip keeps changing.
My understanding from the link you provided '0.0.0.0' is jupyterhub standard notation to listen on all ip addresses is this just buggy?
@alvinhuff Hey, sorry for the reply. I'm not really experienced with running JupyterHub itself in a docker container. But the error shows that JupyterHub can't bind to 0.0.0.0 since it's already in use, try changing it to a different IP address,
@mohirio Hi I completed docker-compose.yml file to speed up my development now two service come up jupyterhubserver and nginx both successfully creating containers. Then I tried modifying the ip address in the jupyterhub_config.py and then exec jupyterhub
and got the same result "service jupyter-alvin" failed to launch. I can then login and upon logging in a third service starts, which I am guessing is the result of the swarmspawner
docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
alqmll5y4r3q Hub_jupyterhubserver replicated 1/1 sgsupdocker/jupyterhub-onbuild:052119.2 *:8000->8000/tcp
tcfxmfoibpil Hub_nginx replicated 1/1 linuxserver/letsencrypt:latest *:80->80/tcp, *:443->443/tcp
vfwzedtv6fy6 jupyter-alvin replicated 0/1 jupyter/datascience-notebook:latest
But the service jupyter-alvin fails to start a container, but the service task return this error:
"invalid mount target, must be an absolute path: SwarmSpawner"
Does the notebook_dir
and 'device' : ':/var/nfs/{username}/'
need to be the same?
Thanks in advance for your help
Hello, I have resolved the binding issue, but now I get I am getting this error : Unhandled error starting alvin's server: Incompatible options have been provided for the bind type mount. The browser throws and error: API request failed (500): error
from my jupyterhub_config.py file:
c.JupyterHub.spawner_class = 'dockerspawner.SwarmSpawner'
network_name = os.environ['DOCKER_NETWORK_NAME']
c.SwarmSpawner.network_name = network_name
c.SwarmSpawner.use_internal_ip = True
## Pass the network name as argument to spawned containers
c.SwarmSpawner.extra_host_config = {'network_mode': network_name}
c.SwarmSpawner.host_ip = '0.0.0.0'
notebook_dir = os.environ.get('NOTEBOOK_DIR') or '/home/joyvan/work'
c.SwarmSpawner.notebook_dir = notebook_dir
## Mount the user's notebook directory in the container
c.SwarmSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir }
## Remove containers once they are stopped
c.SwarmSpawner.remove_containers = True
## For debugging arguments passed to spawned containers
c.SwarmSpawner.debug = True
from my docker.yml file
services:
jupyterhubserver:
image: sgsupdocker/jupyterhub-onbuild:060319.2
hostname: jupyterhubserver
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /vol_b/exchange:/home/joyvan/work
networks:
jupyterhub:
aliases:
- jupyterhubserver
environment:
DOCKER_NETWORK_NAME: jupyterhub
NOTEBOOK_DIR: /home/joyvan/work
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
from the container logs:
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1699, in _execute
result = await result
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/apihandlers/users.py", line 414, in post
await self.spawn_single_user(user, server_name, options=options)
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 889, in spawn_single_user
timedelta(seconds=self.slow_spawn_timeout), finish_spawn_future
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 807, in finish_user_spawn
await spawn_future
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py", line 642, in spawn
raise e
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py", line 546, in spawn
url = await gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
File "/opt/conda/lib/python3.6/site-packages/dockerspawner/dockerspawner.py", line 983, in start
obj = yield self.create_object()
File "/opt/conda/lib/python3.6/site-packages/dockerspawner/swarmspawner.py", line 180, in create_object
mounts=self.mounts,
File "/opt/conda/lib/python3.6/site-packages/dockerspawner/swarmspawner.py", line 117, in mounts
for host_loc, vol in self.volume_binds.items()
File "/opt/conda/lib/python3.6/site-packages/dockerspawner/swarmspawner.py", line 117, in <listcomp>
for host_loc, vol in self.volume_binds.items()
File "/opt/conda/lib/python3.6/site-packages/docker/types/services.py", line 242, in __init__
'Incompatible options have been provided for the bind '
docker.errors.InvalidArgument: Incompatible options have been provided for the bind type mount.
I think I have included all the relevant information. Am I getting this error because I am NOT using a named docker volume? The reason I am not using a named docker volume is becuase I keep getting a permissions denied when the permissions for both the destination and the source are set to ugo+rw. Any insights would be greatly appreciated.
I have decided to go with TLJH. I might try dockerswarm at a later date
Hello I am running jupyterhub 1.0.0 behind a nginx/letsencrypt reverse proxy on jetstream both are docker containers on Ubuntu 18.04. I started this project initially following this guide (https://zonca.github.io/2017/10/scalable-jupyterhub-docker-swarm-mode.html ). The juypterhub container is being created by a service called jupyterhub server. The nginx proxy is a container setup to restart unless stopped using this guide (https://blog.linuxserver.io/2019/04/25/letsencrypt-nginx-starter-guide/ ).
I created a docker network called jupyterhub using the overlay and attachable switches.
I can manage to reach the server and login with a local account, but then I get the url: https://www.sgsup-jupyterhub.duckdns.org/hub/spawn-pending/alvin and the error Spawn failed.
When I run "juptyerhub --debug" from the jupyterhub container I get
when I run ps aux from the jupyterhub container I get:
This is my pip list results
This is the docker file I use to build the image that the jupyterhubserver service uses
This is my jupyterhub_config.py file