Skip to content

Add environment vars cli flag to stack init#303

Merged
EnriqueL8 merged 2 commits intohyperledger:mainfrom
partior-3p:feature/set515_add_env_vars
Jul 10, 2024
Merged

Add environment vars cli flag to stack init#303
EnriqueL8 merged 2 commits intohyperledger:mainfrom
partior-3p:feature/set515_add_env_vars

Conversation

@rodion-lim-partior
Copy link
Copy Markdown
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

@rodion-lim-partior rodion-lim-partior force-pushed the feature/set515_add_env_vars branch from 9b112ab to 5026180 Compare May 31, 2024 02:43
Copy link
Copy Markdown
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.

@rodion-lim-partior
Copy link
Copy Markdown
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.

@rodion-lim-partior rodion-lim-partior force-pushed the feature/set515_add_env_vars branch from 5026180 to ae7f806 Compare June 28, 2024 06:15
Signed-off-by: rodion <rodion.lim@partior.com>
Signed-off-by: rodion <rodion.lim@partior.com>
@rodion-lim-partior rodion-lim-partior force-pushed the feature/set515_add_env_vars branch from ae7f806 to 6c69867 Compare June 28, 2024 06:36
Copy link
Copy Markdown
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
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