adb-atomic-developer-bundle icon indicating copy to clipboard operation
adb-atomic-developer-bundle copied to clipboard

Support proxies

Open bexelbie opened this issue 9 years ago • 13 comments

SEE: https://bugzilla.redhat.com/show_bug.cgi?id=1313218

Description of problem: In an enterprise environment is typical to have a proxy that limits internet connection. It would be nice to have a proper documentation and even include something like vagrant-proxyconf in the CDK.

How reproduce: Try to get some docker image from outside the CDK with a proxy limiting internet connectivity.

bexelbie avatar Apr 04 '16 11:04 bexelbie

Initial thoughts after reading https://docs.docker.com/engine/admin/systemd/#http-proxy

  if ENV.has_key?('HTTP_PROXY')
   HTTP_PROXY = ENV['HTTP_PROXY']
   config.vm.provision "shell", inline: <<-SHELL
      mkdir /etc/systemd/system/docker.service.d
      echo '[Service]' > /etc/systemd/system/docker.service.d/http-proxy.conf
      echo 'Environment="HTTP_PROXY=#{HTTP_PROXY}"' >> /etc/systemd/system/docker.service.d/http-proxy.conf
      sudo systemctl daemon-reload
      sudo systemctl restart docker
    SHELL
  end

brennv avatar May 07 '16 08:05 brennv

Watching https://github.com/tmatilai/vagrant-proxyconf/issues/138

brennv avatar May 08 '16 15:05 brennv

If we have a proxy server in play, why don't we do the following?

Collect it via a variable in the Vagrantfile and pass that to sccli (or something similar).

Inside the box, set all of the environment variables for proxies in /etc/environment:

export http_proxy="http://proxysrv:8080/"
export https_proxy="https://proxysrv:8080/"
export ftp_proxy="ftp://proxysrv:8080/"
export no_proxy=".mylan.local,.domain1.com,host1,host2"

Also set up a yum proxy in /etc/yum.conf proxy=http://proxysrv:8080/

This way the user just sets one variable and we do all the work. We can even add a set of vagrant service-manager proxy * commands.

bexelbie avatar May 12 '16 08:05 bexelbie

Note that setting environment variables for the VM is not enough: OpenShift is running inside a container, and the proxy settings will not be propagated there.

There needs to be some code change (possibly in /opt/adb/openshift/openshift, the script that launches the container) for this to work properly.

codificat avatar May 18 '16 16:05 codificat

@codificat good point. We could have sccli which launches openshift and other ADB services pass this environment variable.

bexelbie avatar May 19 '16 09:05 bexelbie

@praveenkumar ^^

bexelbie avatar May 19 '16 09:05 bexelbie

@bexelbie @codificat Sounds good, will try to work on this issue soon.

praveenkumar avatar May 19 '16 10:05 praveenkumar

This is blocking users to do download docker images in OpenShift if they are behind corporate proxy. Hence marking it as blocker.

LalatenduMohanty avatar Jun 02 '16 06:06 LalatenduMohanty

Any proxy configurations would need to include /etc/sysconfig/atomic-openshift-master and /etc/sysconfig/atomic-openshift-node otherwise any build attempted in that installation will fail. Also note, that once PROXY servers are added to /etc/sysconfig/docker you'll need to add NO_PROXY for the service IP for the internal docker registry container service.

bit4man avatar Jun 02 '16 20:06 bit4man

What's about added a service-manager enable proxy proxy-url bla -proxy-user bla -proxy-user bla. We then encapsulate all required steps to enable a proxy (Docker and OpenShift conf + whatever else we discover) into a script which we place in adb-utils. _service-manager- can then call this script to do all the provisioning.

hferentschik avatar Jun 03 '16 15:06 hferentschik

@hferentschik Your suggestion looks like a step after vagrant up.

I would rather go with configuration options which will be part of vagrant up process to avoid unnecessary using of an extra command. Then, Vagrantfile will look like as below:

Vagrant.configure("2") do |config|
    config.vm.box = "projectatomic/adb"

    # Proxy Settings
    config.servicemanager.http     = "http://proxy_url:port/"
    config.servicemanager.https    = "https://proxy_url:port"
    config.servicemanager.no_proxy = "localhost,127.0.0.1,.example.com"

end

brgnepal avatar Jun 24 '16 14:06 brgnepal

This is fixed by https://github.com/projectatomic/adb-atomic-developer-bundle/pull/482 , but only for OpenShift Vagrantfile. We need to fix Docker, K8s and Mesos similarly

LalatenduMohanty avatar Aug 10 '16 07:08 LalatenduMohanty

The issue is fixed for Kubernetes and OpenShift Vagrantfile

LalatenduMohanty avatar Sep 14 '16 21:09 LalatenduMohanty