Skip to content
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

make proxy attach network on docker start event #1210

Merged
merged 5 commits into from Sep 15, 2015

Conversation

bboreham
Copy link
Contributor

Do network attach on docker event rather than intercepting start and restart commands.

This means it also works when the docker daemon restarts a container. Fixes #401 and #1258.

@bboreham bboreham changed the title In proxy, attach network on docker start event make proxy attach network on docker start event Jul 23, 2015
@bboreham bboreham self-assigned this Jul 23, 2015
@bboreham bboreham removed their assignment Jul 23, 2015
@bboreham
Copy link
Contributor Author

This change has a side-effect that docker run -d via the proxy now returns before the network is set up and the container is running.

@rade
Copy link
Member

rade commented Jul 23, 2015

Presumably the container is running; just not the application process. Still i can imagine that might trip up some users. And the same is true of docker start.

@rade
Copy link
Member

rade commented Jul 23, 2015

...and docker restart. i.e. it is probably not unreasonable to expect that when these command return successfully that the container is fully up and running.

The question is what might break for users.

@bboreham
Copy link
Contributor Author

It sometimes breaks smoke-tests like 680. I made a fix.

@bboreham bboreham self-assigned this Jul 23, 2015
@bboreham bboreham force-pushed the 401-proxy-start-events branch 2 times, most recently from 427e5e1 to e9818d5 Compare July 23, 2015 18:34
@bboreham bboreham removed their assignment Jul 23, 2015
@bboreham bboreham force-pushed the 401-proxy-start-events branch 2 times, most recently from 90b61c8 to a4b0186 Compare August 12, 2015 17:15
@@ -26,6 +26,11 @@ func main() {
args = args[1:]
}

if len(args) > 0 && args[0] == "-c" { // tell pid 1 to continue
checkErr(syscall.Kill(1, syscall.SIGUSR2))

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

if err != nil {
return nil, err
}
p.client = client
p.client = client.Client
client.AddObserver(p)

This comment was marked as abuse.

This comment was marked as abuse.

@errordeveloper
Copy link
Contributor

@paulbellamy if you have a minute, may be you could cherry-pick --rewrite-inspect changes on top of this? I got pretty confused last time I tried cherry-picking it myself 😕

@bboreham bboreham force-pushed the 401-proxy-start-events branch 2 times, most recently from c3c669e to 79b40ce Compare August 14, 2015 15:14
HOSTS_PATH=$(docker $DOCKER_CLIENT_ARGS run --rm --net=none \
-v /var/run/docker.sock:/var/run/docker.sock \
--entrypoint /bin/sh \
$EXEC_IMAGE -c 'docker inspect -f {{.HostsPath}} $(hostname)')

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@bboreham
Copy link
Contributor Author

OK, I think the coding is done; I'm going to rebase from latest master and take a look at splitting into two PRs: one for (#401 and #1258) and one for (#1209 and #1300).

@bboreham bboreham force-pushed the 401-proxy-start-events branch 4 times, most recently from f814287 to 5427bdd Compare August 17, 2015 13:00
# Restart docker itself
# - disabled since the commands are different between our Vagrant VMs and GCE
#run_on $HOST1 sudo systemctl restart docker # for systemd
#run_on $HOST1 sudo service docker restart # for upstart

This comment was marked as abuse.

This comment was marked as abuse.

@bboreham bboreham force-pushed the 401-proxy-start-events branch 4 times, most recently from 2f1216b to 165373d Compare August 18, 2015 15:24
@bboreham
Copy link
Contributor Author

I have addressed the two most recent review comments, rebased, and commented out the part of the test that will fail until #1209 is addressed.

@paulbellamy
Copy link
Contributor

LGTM

@awh
Copy link
Contributor

awh commented Aug 21, 2015

The plan of record is that we're waiting for #1314 before merging this.

@bboreham
Copy link
Contributor Author

bboreham commented Sep 1, 2015

Have rebased and adjusted following merge of #1314

@bboreham bboreham removed their assignment Sep 1, 2015

func (proxy *Proxy) waitForStart(r *http.Request) {
var ch chan struct{}
proxy.Lock()

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

paulbellamy added a commit that referenced this pull request Sep 15, 2015
make proxy attach network on docker start event
@paulbellamy paulbellamy merged commit e39974e into master Sep 15, 2015
@rade rade modified the milestone: 1.2.0 Sep 18, 2015
@awh awh deleted the 401-proxy-start-events branch November 9, 2015 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants