-
Notifications
You must be signed in to change notification settings - Fork 123
Conversation
@@ -89,9 +135,11 @@ def create_notebook_server(self, base_path): | |||
env = {"RAND_BASE": base_path} | |||
container_id = docker_client.create_container(image="jupyter/tmpnb", | |||
environment=env) | |||
docker_client.start(container_id, port_bindings={8888: ('127.0.0.1',)}) | |||
docker_client.start(container_id, port_bindings={8888: ('0.0.0.0',)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to change this to 0.0.0.0
? I'd rather not have these notebooks be public by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I didn't. Without this, I can't run the server under boot2docker. The containers never become accessible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, maybe we make this configurable, leave the default as 127.0.0.1
.
LOL - upon seeing this Olivier said "great, I am glad you implemented it this way, that was I can write some javascipt that keeps it alive..." |
for base_path in data: | ||
container_id = containers.pop(base_path.lstrip('/'), None) | ||
if container_id: | ||
app_log.info("shutting down container %s at %s", container_id, base_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something we could do in the future here is also dump the logs of the container before we obliterate it.
use the proxy's inactive_since REST API
and kill the proxy if the server exits
also changes default cull timeout to 1 hr
now configurable, with a default of one hour. |
port = docker_client.port(container_id, 8888)[0]['HostPort'] | ||
|
||
self.settings['containers'][base_path] = container_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're tracking which paths map to which containers!
Maybe I should just close #13 then and make use of the container IDs elsewhere.
This PR closes all containers created by this process. Upon a hot reload of tornado (change of the python script), does it keep the old values? If we restart the process through other means, I take it we'll have to do maintenance to clean out old containers. |
like it says on the tin.
every hour (configurable), it checks for idle containers and brings them down, removing the proxy route.