Deploying JupyterHub on ECS

I am attempting to deploy JupyterHub on ECS. I have created a custom ECSTaskSpawner build over the existing Spawner. Additionally, I have a JupyterLab image that works completely fine (tested locally)
When I use the Spawner to launch a singleuser notebook via jupyter-singleuser, the logs suggest that the server is active at a path governed by JUPTERHUB_SERVICE_URL but my spawner doesn’t redirect me to the notebook.
From what I understand, the environment variable mentioned above must contain the IP and Port of the notebook launched. This variable then has to be passed to the task being launched. However, I am launching a new task via ECS so the IP is generated after task creation. This creates a loop issue - if task doesn’t exist, no URL to pass. For URL to pass, the task should exist but the variable is to be set in the task.
Is there something I am doing incorrectly?

I do not have any experience with ECS tasks but from what I understand is that you launch a task in Spawner.start() method, right?! Then ECS task will be created with a IP and eventually you will run jupyterhub-singleuser at a given port.

What you need to do is once the ECS task has been successfully launched with a IP, you need to communicate this IP (along with the port that you will use to launch single user server) back to JupyterHub. This must be done in the start() method so the method returns correct IP and port. Check how BatchSpawner does it to have an idea on how to implement it in your case.

1 Like