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

Add environment vars cli flag to stack init #303

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

rodion-lim-partior
Copy link
Contributor

@rodion-lim-partior rodion-lim-partior commented May 31, 2024

This PR adds a --environment-vars flag to the init command to allow docker compose generation to include generic environment variables across all containers. When docker is started against a corporate proxy, containers are unable to resolve via the internal DNS names due to the proxy.

In this instance, users need to unset the proxy by passing in environment variables HTTP_PROXY=,http_proxy= to the containers. Depending on needs, other proxy specific environment variables can be set as well.

Resolves #302

Copy link
Contributor

@EnriqueL8 EnriqueL8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @rodion-lim-partior, I like were this is going!

I'm wondering if you have tested the behaviour when using the docker-composer.override.yml and overriding the environment variables for a specific container and how that would impact the environment variables set here. I also only see the value of this feature for things such as making all the containers use a PROXY, or networking setup? Most of the time users will want to customise specific environment variables for each service and the docker-compose.override.yml is probably the best solution.

pkg/types/stack.go Outdated Show resolved Hide resolved
cmd/init.go Show resolved Hide resolved
@rodion-lim-partior
Copy link
Contributor Author

rodion-lim-partior commented Jun 28, 2024

@EnriqueL8, I tested locally with the docker compose overrides. docker compose have precedence over CLI options overrides, which is what we expect. Also, the docker compose overrides do not wipe CLI options, it merges the difference in.

This are the EnvironmentVars that we pass into the CLI options

"HTTP_PROXY=,http_proxy="

This is the docker compose overrides used:

version: "2.1"
services:
  geth_1:
    environment:
      no_proxy: ""
      HTTP_PROXY: "abc"

In geth_0 container:

/ # env | grep -i proxy
no_proxy=127.0.0.0/8
HTTP_PROXY=
http_proxy=

In geth_1 container:

/ # env | grep -i proxy
no_proxy=
HTTP_PROXY=abc
http_proxy=

Also, you are right that in our use case, the value of this feature is for things such as making all the containers point to the same proxy variables.

Copy link
Contributor

@EnriqueL8 EnriqueL8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with this one going in

@EnriqueL8 EnriqueL8 merged commit 39028cd into hyperledger:main Jul 10, 2024
11 checks passed
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.

firefly docker compose stack through a corporate proxy having problems
2 participants