New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove docker binary from weaveexec container #3110
Remove docker binary from weaveexec container #3110
Conversation
4269a75
to
06a264d
Compare
Thanks for this, @dtshepherd. It does seem a little more complicated than we need - e.g. we never call |
Ok I'll remove the extra options. I'm working on some of the Any idea how to get the CircleCI tests to pass? It complains about a missing secret key. |
The secret key is only accessible to PRs in the repo, to avoid people submitting PRs which steal the key and/or steal the resources it controls. I can push your branch to the repo and the tests will run. |
8787f50
to
6bb8afd
Compare
Finished replacing Still need to implement commands to create |
@bboreham Just committed the removal of the remaining Thoughts on the implementation? Probably need to implement a near direct pass-through of the |
OK, I tried a first cut at the @bboreham Can you please kick off a CI build and test? |
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 did an initial pass over the code; most of it looks great but I had some questions and comments.
prog/weaveutil/container.go
Outdated
return fmt.Errorf("unable to connect to docker: %s", err) | ||
} | ||
|
||
container, err := c.InspectContainer(containerID) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
return nil | ||
} | ||
|
||
func listContainers(args []string) error { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
prog/weaveutil/version.go
Outdated
docker "github.com/fsouza/go-dockerclient" | ||
) | ||
|
||
func askVersion(args []string) error { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
protect_against_docker_hang | ||
docker create -v /weavedb --name=$DB_CONTAINER_NAME \ | ||
--label=weavevolumes $WEAVEDB_IMAGE >/dev/null | ||
if ! util_op container-state $DB_CONTAINER_NAME > /dev/null 2>&1 ; then |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
prog/weaveutil/container.go
Outdated
fmt.Print(container.State.StateString()) | ||
} else { | ||
image := args[1] | ||
match1, _ := regexp.MatchString(image, container.Image) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
prog/weaveutil/image.go
Outdated
docker "github.com/fsouza/go-dockerclient" | ||
) | ||
|
||
func pullImage(args []string) error { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
ad7b122
to
9fcdce5
Compare
@bboreham I think this is ready for a 2nd pass review. I just rebased with upstream master as well, since there was some conflicts with I need to squash the commits down as well. Do you want a single commit or a few logically separated commits? |
prog/weaveutil/container.go
Outdated
fmt.Print(container.State.StateString()) | ||
} else { | ||
image := args[1] | ||
match1, _ := regexp.MatchString(image, container.Image) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
return nil | ||
} | ||
|
||
func listContainers(args []string) error { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
prog/weaveutil/container.go
Outdated
|
||
func listContainers(args []string) error { | ||
if len(args) < 1 { | ||
cmdUsage("list-containers", "[<label>]") |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
echo "DOCKER_HOST=$ORIG_DOCKER_HOST" | ||
# Handle special case $1 commands that run locally at the client end | ||
case "$1" in | ||
help|--help) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
weave
Outdated
# Note VOLUMES_CONTAINER which is for weavewait should change when you upgrade Weave | ||
VOLUMES_CONTAINER_NAME=weavevolumes-$IMAGE_VERSION | ||
VOLUMES_CONTAINER_NAME=$VOLUMES_LABEL-$IMAGE_VERSION |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
protect_against_docker_hang | ||
docker create -v /weavedb --name=$DB_CONTAINER_NAME \ | ||
--label=weavevolumes $WEAVEDB_IMAGE >/dev/null | ||
if ! util_op container-state $DB_CONTAINER_NAME > /dev/null 2>&1 ; then |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
docker create -v /weavedb --name=$DB_CONTAINER_NAME \ | ||
--label=weavevolumes $WEAVEDB_IMAGE >/dev/null | ||
if ! util_op container-state $DB_CONTAINER_NAME > /dev/null 2>&1 ; then | ||
protect_against_docker_hang |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This is great; I can see some potential further refactorings which would bring the code weight down, but happy to merge what you have and leave them for the future. Regarding squashing commits, one would be fine, but if you see a few logically separate ones then that is fine too. |
36c2351
to
f63c9fa
Compare
@bboreham I think I responded to your review comments (some of the comments weren't on lines that needed to change so github didn't dismiss). I squashed to two commits (all of my changes + commit stolen from #2952 for I think some of the code weight could be reduced if we merged some of Hopefully this next review pass looks good for merging. I know this is a risky change, so I understand if its delayed for release to master. I'd like to build upon this PR to fix #3102. |
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.
One small change in the Makefile please; then I will merge.
Makefile
Outdated
@@ -406,7 +397,6 @@ integration-tests: all testrunner | |||
# PLAYBOOK="<filename>" \ | |||
# RUNNER_ARGS="<...>" \ | |||
# TESTS="<...>" \ # Can be set to only run one or a few tests instead of the full test suite. | |||
# DOCKER_VERSION=<...> \ |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -307,10 +302,6 @@ $(NETWORKTESTER_UPTODATE): test/images/network-tester/Dockerfile $(NETWORKTESTER | |||
$(WEAVE_EXPORT): $(IMAGES_UPTODATE) $(WEAVEDB_UPTODATE) | |||
$(SUDO) DOCKER_HOST=$(DOCKER_HOST) docker save $(addsuffix :latest,$(IMAGES)) | gzip > $@ | |||
|
|||
$(DOCKER_DISTRIB): | |||
curl -o $(DOCKER_DISTRIB) $(DOCKER_DISTRIB_URL) | |||
cd $(shell dirname $@) && sha256sum -c $(shell pwd)/build/shasums/docker-tgz-$(WEAVEEXEC_DOCKER_ARCH).sha256sum |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
docker create -v /weavedb --name=$DB_CONTAINER_NAME \ | ||
--label=weavevolumes $WEAVEDB_IMAGE >/dev/null | ||
if ! util_op container-state $DB_CONTAINER_NAME > /dev/null 2>&1 ; then | ||
protect_against_docker_hang |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Fixes weaveworks#2957 - replace `docker stop` with `weaveuitl stop-container` - replace `docker kill` with `weaveutil kill-container` - replace `docker rm` with `weaveutil remove-container` - replace `docker run` with minimal `weaveutil container-run` - replace `docker inspect -f {{.ID}}` with `weaveutil container-id` - replace data-only container `docker create` with `weaveutil create-volume-container` - remove `docker inspect` dependencies from `weave` script `rewrite_etc_hosts` and `with_container_fqdn` - rework `weave` script `check_running` and `check_not_running` to use `weaveutil` - rework `weave version` to use `weaver` /report API or `weaver --version` if not running - rework `weave setup`'s `docker pull` to run locally rather than in `weaveexec` container
`weaveexec` no longer mounting '/' so we can't access the weavedb file to get persistent peer ID. If `weaver` was running, we couldn't have read the file anyway because BoltDB does not support concurrent access from two processes. Consequence is that if someone really does need the bridge creation on 'weave expose' the peer ID may change if created pre-1.9.0. We'll just live with that (per @bboreham).
f63c9fa
to
38ca0f9
Compare
Fixed the Makefile and removed those shasum files, good catch. We'll see what the CI looks like after these changes... |
Nice! Image size comes down by ~34MB |
I didn't even check that! Yeah that's a good win. |
Fixes #2957
Creating
weaveutil
commands to removedocker
binary dependency inweaveexec
.This is still a WIP... Need to port the
docker run
,docker create
,docker ps
, parts ofdocker inspect
(although probably want high-levelweaveutil
commands forcheck_running
, etc).@bboreham