hyperledger / firefly-cli

FireFly Command Line Interface (CLI)
Apache License 2.0
56 stars 50 forks source link

Add environment vars cli flag to stack init #303

Open rodion-lim-partior opened 1 month ago

rodion-lim-partior commented 1 month ago

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 commented 1 week ago

@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.