tmatilai / vagrant-proxyconf

Vagrant plugin that configures the virtual machine to use proxies
MIT License
531 stars 74 forks source link

Delete docker configration after provision #73

Closed otahi closed 10 years ago

otahi commented 10 years ago

This pull-request is for fixing the issue #72.

This pull-request makes vagrant-proxyconf do docker proxy config only once at the beginning of the provision.

The old version does docker proxy config twice at beginning of a provision and after the provision. If vagrant-proxyconf does docker proxy config after a provision, docker can fail to restart the daemon. Docker can take effect with only a configuration at the beginning of the provision.

We have checked this pull-request working well on:


There are remaining problem(s).

dduportal commented 10 years ago

Hi, tests are currently running, i'll tell you when finished

dduportal commented 10 years ago

cf. #72 : works fine, wide tests are launched (others people, other boxes, same proxy)

otahi commented 10 years ago

I am checking docker support phenomena on Ubuntu14.04 and CentOS 6.5.

I have confirmed modification 58b8b95 works fine if docker is installed at the beginning of vagrant up or vagrant reload --provision or vagrant reload.

$ vagrant ssh -c 'sudo strings /proc/`pgrep docker|head -n1`/environ | grep -i http ; sudo docker ps'
http_proxy=http://192.168.11.8:3128/
HTTP_PROXY=http://192.168.11.8:3128/
CONTAINER ID        IMAGE                      COMMAND                CREATED              STATUS              PORTS               NAMES
fbd57016fec8        otahi/lbspec-test:latest   /usr/bin/supervisord   About a minute ago   Up 11 seconds       22/tcp, 80/tcp      suspicious_pike
f5f08c606f63        otahi/lbspec-test:latest   /usr/bin/supervisord   5 minutes ago        Up 12 seconds       22/tcp, 80/tcp      compassionate_pasteur
b724fa96ad07        otahi/lbspec-test:latest   /usr/bin/supervisord   8 minutes ago        Up 11 seconds       22/tcp, 80/tcp      kickass_newton
Connection to 127.0.0.1 closed.
$

But it can not take effect if docker installation is in provision phase like this Vagrantfile.

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "ubuntu14.04"
  config.proxy.http = "http://192.168.11.8:3128/"
  config.vm.provision "shell", inline: 'which docker || curl -s https://get.docker.io/ubuntu/ | sh'
end

To support this case, vagrant-proxyconf need to configure docker proxy after provision. But there may be an issue at restarting docker.

Any ideas?

otahi commented 10 years ago

I have found some issues on docker issues about docker restarting.

They will be fixed in near future( I am not sure about boot2docker...).

Updated at 2014/06/29 21:50 UTC by otahi I have changed my mind, because the following specification makes the logic too complex. So, I will fix vagrant-proxyconf to configure docker proxy settings as follows.

vagrant-proxyconf \ docker installed? True False
run configuration before provision Yes No
run configuration after provision No Yes
otahi commented 10 years ago

I am going to close the remaining problem as a limitation.

Is it acceptable? Should I add a description of limitation to README.md? > @tmatilai

tmatilai commented 10 years ago

OK, lets take this in. Thanks again @otahi!

I really hope to find the time and energy for some refactoring, as we could maybe whitelist (with capabilities) some guest distros that handle the restart fine. But in many cases you anyway have docker already installed (boot2docker, coreos) where this is fine.

A note in the readme is of course accepted if you can fit it in. But I don't think it's a big issue.

tmatilai commented 10 years ago

@otahi I hope you don't mind that I also invited you as a collaborator for the plugin. Welcome aboard! :ship:

otahi commented 10 years ago

@tmatilai Thank you very much for inviting me! I am very excited to collaborate for this plugin. I am weak at English but please overlook that. :smile:

dduportal commented 10 years ago

Sorry for the delay, i thing the documentation option is a good start ! Anyway, is the before/after configurable by the user ? I don't need that while i'm trying to only use b2d, but i'm asking my self if it is really simple or complexity too much the content ?

Anyway, thanks a lot with the work !