{"action":"created","issue":{"url":"https://api.github.com/repos/jupyter/tmpnb/issues/198","labels_url":"https://api.github.com/repos/jupyter/tmpnb/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/jupyter/tmpnb/issues/198/comments","events_url":"https://api.github.com/repos/jupyter/tmpnb/issues/198/events","html_url":"https://github.com/jupyter/tmpnb/pull/198","id":123959100,"number":198,"title":"Admin server with DELETE /api/pool handler","user":{"login":"parente","id":153745,"avatar_url":"https://avatars.githubusercontent.com/u/153745?v=3","gravatar_id":"","url":"https://api.github.com/users/parente","html_url":"https://github.com/parente","followers_url":"https://api.github.com/users/parente/followers","following_url":"https://api.github.com/users/parente/following{/other_user}","gists_url":"https://api.github.com/users/parente/gists{/gist_id}","starred_url":"https://api.github.com/users/parente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parente/subscriptions","organizations_url":"https://api.github.com/users/parente/orgs","repos_url":"https://api.github.com/users/parente/repos","events_url":"https://api.github.com/users/parente/events{/privacy}","received_events_url":"https://api.github.com/users/parente/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-27T04:14:12Z","updated_at":"2015-12-28T15:38:11Z","closed_at":"2015-12-28T14:05:49Z","pull_request":{"url":"https://api.github.com/repos/jupyter/tmpnb/pulls/198","html_url":"https://github.com/jupyter/tmpnb/pull/198","diff_url":"https://github.com/jupyter/tmpnb/pull/198.diff","patch_url":"https://github.com/jupyter/tmpnb/pull/198.patch"},"body":"Use case: I want to `docker pull` or `docker build` a new container image on the tmpnb box. I don't want containers already in the pool based on the old image to linger indefinitely until they are used up. I want to immediately drain the pool of idle, available containers and replenish the pool with containers from the new image. While doing so, I do not want to disturb containers that are currently in-use. In practice, I should be able to do something as simple as:\r\n\r\n```\r\neval `docker-machine env my-tmpnb-host`\r\ndocker build -t my-notebook-image .\r\ndocker exec -i tmpnb-pool curl -X \"DELETE\" http://127.0.0.1:10000/api/pool\r\n```\r\n\r\nto get the desired effect.\r\n\r\nSince pool draining is a costly operation, this PR adds a new \"admin\" server that listens on a port separate from the main tmpnb server. The admin server only listens on localhost by default and supports an optional `ADMIN_AUTH_TOKEN` env var as a shared-secret client authorization mechanism. \r\n\r\nThe admin server currently implements a single handler for `DELETE /api/pool` that implements the behavior described above. However, it can grow to support other admin operations in the future (e.g., PUT to change config settings like total number containers in the pool).\r\n\r\nI'm open to other verbs and resource names. `DELETE /api/pool` was the first thing that came to mind."},"comment":{"url":"https://api.github.com/repos/jupyter/tmpnb/issues/comments/167590280","html_url":"https://github.com/jupyter/tmpnb/pull/198#issuecomment-167590280","issue_url":"https://api.github.com/repos/jupyter/tmpnb/issues/198","id":167590280,"user":{"login":"parente","id":153745,"avatar_url":"https://avatars.githubusercontent.com/u/153745?v=3","gravatar_id":"","url":"https://api.github.com/users/parente","html_url":"https://github.com/parente","followers_url":"https://api.github.com/users/parente/followers","following_url":"https://api.github.com/users/parente/following{/other_user}","gists_url":"https://api.github.com/users/parente/gists{/gist_id}","starred_url":"https://api.github.com/users/parente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parente/subscriptions","organizations_url":"https://api.github.com/users/parente/orgs","repos_url":"https://api.github.com/users/parente/repos","events_url":"https://api.github.com/users/parente/events{/privacy}","received_events_url":"https://api.github.com/users/parente/received_events","type":"User","site_admin":false},"created_at":"2015-12-28T15:38:11Z","updated_at":"2015-12-28T15:38:11Z","body":"DH build is failing. So either I broke it by de-duping the requirements install step in the Dockerfile or DH is just having issues.\r\n\r\nRunning make tmpnb-image again locally works fine so I'm guessing it's the latter. Will keep an eye on it."}}