Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Add weave launch-proxy #652

Closed
wants to merge 17 commits into from
Closed

Add weave launch-proxy #652

wants to merge 17 commits into from

Conversation

paulbellamy
Copy link
Contributor

This adds a docker remote API proxy to the weaveexec image. The proxy is
auto-launched when running a container with weave cli.

The proxy currently has hooks for:

Hook Action
Pre Container Create Adjusts the entrypoint of a container to wait for the ethwe interface.
Post Container Start Attaches a weave interface to a container given a WEAVE_CIDR environment entry.

Other changes include:

  • weave start no longer takes CIDRs. CIDRs from run will be re-attached, but not ones attached manually. weave attach should be used to reattach those.

paulbellamy and others added 14 commits May 13, 2015 10:45
…s work

Previously, the result output would include:
Docker on: <command>
result output text

etc...
But this would cause: assert "docker_on ..." to fail
This adds a docker remote API proxy to the weaveexec image. The proxy
has hooks for (post-) container start and (pre-) container create; the
former attaches a weave interface to a container given a WEAVE_CIDR
environment entry, and the latter adjusts the entrypoint of a container
to wait for the ethwe interface.

Notes:

None of the hooks need to inspect/change large bodies. In order to avoid
a crash when handling images larger than memory we need to ensure that
the entire request body is never loaded into memory (i.e. No
ioutils.ReadAll).

When proxying a raw-stream response, we can't use http.WriteHeader. It
sets the Transfer-Encoding to chunked, which will throw off the clients.
Instead we have to hijack the socket, and write out http status code
manually.

For chunked transfer-encodings, clients (docker-py) depend on each http
chunk containing exactly one JSON object. Therefore, we cannot re-chunk
the body, and have to pass it across verbatim.
Add a /weave endpoint to it, and use curl to wait for it to boot.
This will make adding the CreateContainer hook cleaner.
Otherwise they get smashed together on the command line, and the call
fails.
If no entrypoint is specified on the container, it should use the
entrypoint of the image. Code for this is based on powerstrip-weave.
I'm not sure if it will cause issues, but seems like a sane thing to do.
The reason being, that because WEAVE_CIDR is inherited from images
(along with env vars), setting it to blank is equivalent to unsetting
it.
@rade
Copy link
Member

rade commented May 13, 2015

docs need updating

@squaremo
Copy link
Contributor

docs need updating

Off the top of my head:

  • Usage of weave start, if it appears, should be updated (in readme, possibly; in site/features.md)
  • Any examples that assume containers will run in the background will need changing

I think it'd be worth having a brief description of how weave run goes through the proxy, and how one can use docker directly to do the same thing.

@paulbellamy
Copy link
Contributor Author

As per f2f discussion with @rade, let's not change bash script commands to use proxy, or autolaunch. Just provide launch-proxy as a "beta feature" and document how to use it with the docker cli tool.

@paulbellamy
Copy link
Contributor Author

Closed in favour of #655

@rade rade modified the milestone: 0.11.0 May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants