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

Configure Proxy Before not After Omnibus #52

Closed
wants to merge 1 commit into from
Closed

Configure Proxy Before not After Omnibus #52

wants to merge 1 commit into from

Conversation

sgarlick987
Copy link

Was trying to get the vagrant-omnibus plugin working behind a corporate proxy today and it was working fine for everything else but timing out for the omnibus plugin. I'm very new to ruby/vagrant/etc but I'm thinking this is the reason.

Thanks for all your work, this plugin has cured almost all my proxy headaches.

Was trying to get the vagrant-omnibus plugin working behind a corporate proxy today and it was working fine for everything else but timing out for the omnibus plugin.  I'm very new to ruby/vagrant/etc but I'm thinking this is the reason.

Thanks for all your work, this plugin has cured almost all my proxy headaches.
@tmatilai
Copy link
Owner

Thanks! But we actually have to hook after the omnibus action in middleware stack as the order is practically reverse due to the Provision action waiting for the VM to boot.

Did you set https proxy too?
Could you please run with --debug and gist all the output? There must be something else...

@sgarlick987
Copy link
Author

Ah my bad, I really shouldn't be randomly guessing at fixes.

Here's a the gist of the debug output and my vagrantfile.

https://gist.github.com/sgarlick987/9128306

Some additional info about my setup
Windows 7 64 bit
ruby 1.9.3
Vagrant 1.3.5
VirutalBox 4.3.6
plugins vagrant-berkshelf, vagrant-omnibus, vagrant-proxyconf

Also if I leave the proxy config on, but change to a different network it gets past the "
Failed connect to www.opscode.com:443; No error" part at the end of the debug output but then hangs when fetching the metadata files which makes sense.

Let me know if there's anything else I can provide you.

@tmatilai
Copy link
Owner

Thanks for all the information. The log shows that the environment variables on the guest are indeed configured before trying to download the omnibus installer.

But I think I know what's the problem here. vagrant-omnibus uses Vagrant's internal downloader to fetch the "install.sh" on the host (and then uploads and runs it on the guest). The downloader actually uses embedded curl, which then fails as it is not configured to use the proxy server.

As curl uses the standard environment variables, you should be able to:

set HTTP_PROXY=http://56.192.106.27:8080/
set HTTPS_PROXY=http://56.192.106.27:8080/

You'll need to set the same variables for downloading boxes or installing plugins too.

vagrant-proxyconf can't unconditionally configure those, as the config reflects the guest side. And guests can be e.g. on AWS with very different settings than the host. We could maybe add a config switch for setting the env vars on the host, especially if I ever manage to finnish the auto-detection of the proxy server. Only catch is that for vagrant plugin commands the plugins are not loaded, but it would still help with other commands. I'll file another issue for this.

@sgarlick987
Copy link
Author

Great, that worked perfectly. I had originally had the HTTP_PROXY set, but not HTTPS_PROXY, and was getting past that initial ruby gem call that the host does before starting up and was assuming that that point on was all on the guest side.

Thanks again for the time you put into this, its saved me and a few coworkers a lot of hassle configuring proxies for each component,.

@tmatilai
Copy link
Owner

Yeah, originally it was on the guest side, but moved to the host in v1.1.2 so that curl/wget is not required on the guest. install.sh can now download the package with e.g. perl too. Easier to use Vagrant's curl than include all that logic into vagrant-omnibus too.

Nice to hear that this plugin is useful! My own use case was (and is) to use a caching proxy locally to speed up provisioning, but I totally understand the pain of corporate proxies. Please file issues if you have ideas how to make things better.

Closing this issue, but hope to get into #53 on some point.

@tmatilai tmatilai closed this Feb 21, 2014
@tmatilai tmatilai reopened this Feb 21, 2014
@tmatilai
Copy link
Owner

Eh, buttons. How do they work?

@tmatilai tmatilai closed this Feb 21, 2014
@sgarlick987 sgarlick987 deleted the patch-1 branch February 21, 2014 18:27
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.

2 participants