Skip to content

Feature Request: Proxy support #319

Closed

Description

@bmanuel

It would be great if concourse supported running behind a corporate proxy without manually baking every resource image with the proxy settings. It should be possible to set the configuration for the proxy once and have it applied throughout.

Activity

  1. concourse-bot commented on Mar 23, 2016

    @concourse-bot

    Hi there!

    We use Pivotal Tracker to provide visibility into what our team is working on. A story for this issue has been automatically created.

    The current status is as follows:

    This comment, as well as the labels on the issue, will be automatically updated as the status in Tracker changes.

  2. databus23 commented on Apr 9, 2016

    @databus23
    Contributor

    I'm seeing from the pivotal issue this has already quite progressed. \o/
    I'm hoping you are also propagating/setting the no_proxy environment variable the same way as http(s)_proxy. I'm not seeing any reference to no_proxy in the ticket and I can't find the corresponding code changes (I'm assuming they are not yet committed.)

    Really looking forward to this.

  3. vito commented on Apr 9, 2016

    @vito
    Contributor

    @databus23 Good point, we were just wondering how that should work - we haven't ever really had to use proxies before so we're kinda winging it. Midway through we were wondering exactly how that'd work (reaching internal addresses), so that answers that. I'll add it to the story.

    Here's our approach, if y'all wanna vet it:

    • Each worker will be able to advertise http_proxy, https_proxy, and (now that you mention it) no_proxy values.
    • The ATC will then forward those values along as container-level environment variables.
    • We'll go through our resources and make sure they all support these env vars (I know a few don't already), and add a note to the Implementing a Resource doc to call out that resources should respect it.

    Note that this is configuration living on the worker, not the ATC, as it's really the worker's network that determines whether it needs a proxy and can even reach the proxy.

    Also note that we're not going to just have this be an env on the worker, as that risks putting more configuration on the workers, making them stateful, which Concourse tries to avoid.

  4. databus23 commented on Apr 9, 2016

    @databus23
    Contributor

    @vito The approach seems very sound to me.
    Two remarks:

    1. I'm curious which resources you think don't support proxy environment variables. I don't think you need to change any of the existing resources. Golang picks up the proxy from the environment by default, so does docker, git, curl, ruby and all other popular cli tools on linux I know of.
      The only gotcha I can think of right now is when you use a custom http.Transport in go, then you need to make sure to add
    http.Transport{
        Proxy: http.ProxyFromEnvironment,
        ...
    
    1. I'm not sure what you mean by

    Also note that we're not going to just have this be an env on the worker

    Does that mean you don't want the worker to pick up the proxy variables it will advertise from its environment?

  5. vito commented on Apr 9, 2016

    @vito
    Contributor

    @databus23

    1. A few resources may be constructing their own http.Transports and in doing so may be missing the http.ProxyFromEnvironment. It should be a quick fix. Likely candidates for this would be the S3 or GitHub Release resources.
    2. We could have implemented this by having workers able to advertise arbitrary env values to set on containers created on them (and so you'd set "env": ["http_proxy=..."]). We opted to have proxy configuration be a first-class config instead, as having workers set arbitrary env could lead to tight coupling between the pipeline and its workers (which are supposed to be throwaway/stateless).
  6. concourse-bot commented on Apr 14, 2016

    @concourse-bot

    Hello again!

    All stories related to this issue have been accepted, so I'm going to automatically close this issue.

    At the time of writing, the following stories have been accepted:

    If you feel there is still more to be done, or if you have any questions, leave a comment and we'll reopen if necessary!

  7. jbakosi commented on Apr 22, 2016

    @jbakosi

    So what's the state of proxy support? Is there a howto on how to use it?

    Following http://www.laurivan.com/set-up-concourse-behind-a-proxy/ I still cannot use concourse behind a proxy. What is missing?

  8. codechaos commented on Jun 7, 2016

    @codechaos

    It's the same for me. I followed the instructions on the documentation, but the docker was not able to load the hello-world image behind a proxy.

  9. warroyo commented on Oct 14, 2016

    @warroyo

    this still does not seem to be working, does anyone have a fix for this?

    Edit:
    After some research the environment variables for http_proxy, etc. are not being honored by ubuntu's upstart. if you log in to the vagrant box and restart the worker as a user then the proxy will be honored.

  10. vito commented on Oct 14, 2016

    @vito
    Contributor

    This is done and shipped long ago. The binaries support the standard env vars (http_proxy, etc). If it's not working, make sure to open a new issue - this one is already closed, and this works at least for some people, so replying to this one won't really get much done. :)

  11. added a commit that references this issue on Mar 31, 2017
  12. added a commit that references this issue on Apr 10, 2017
  13. Sispheor commented on Aug 8, 2017

    @Sispheor

    For those who googled the issue. Here is the docker-compose file I used to get it working behind a proxy

    version: '3'
    
    services:
      concourse-db:
        image: postgres:9.5
        environment:
          POSTGRES_DB: concourse
          POSTGRES_USER: concourse
          POSTGRES_PASSWORD: changeme
          PGDATA: /database
    
      concourse-web:
        image: concourse/concourse
        links: [concourse-db]
        command: web
        depends_on: [concourse-db]
        ports: ["8080:8080"]
        volumes: ["./keys/web:/concourse-keys"]
        restart: unless-stopped # required so that it retries until conocurse-db comes up
        environment:
          CONCOURSE_BASIC_AUTH_USERNAME: concourse
          CONCOURSE_BASIC_AUTH_PASSWORD: changeme
          CONCOURSE_EXTERNAL_URL: "10.39.9.94"
          CONCOURSE_POSTGRES_HOST: concourse-db
          CONCOURSE_POSTGRES_USER: concourse
          CONCOURSE_POSTGRES_PASSWORD: changeme
          CONCOURSE_POSTGRES_DATABASE: concourse
          http_proxy: http://mydomain:8080
          https_proxy: http://mydomain:8080
    
      concourse-worker:
        image: concourse/concourse
        privileged: true
        links: [concourse-web]
        depends_on: [concourse-web]
        command: worker
        volumes: ["./keys/worker:/concourse-keys"]
        environment:
          CONCOURSE_TSA_HOST: concourse-web
          CONCOURSE_GARDEN_DNS_SERVER: 8.8.8.8
          http_proxy: http://mydomain.net:8080
          https_proxy: http://mydomain.net:8080
  14. added a commit that references this issue on Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions