diff --git a/bolt-sidecar/src/config/mod.rs b/bolt-sidecar/src/config/mod.rs index 806e9cead..4190da9f2 100644 --- a/bolt-sidecar/src/config/mod.rs +++ b/bolt-sidecar/src/config/mod.rs @@ -126,7 +126,7 @@ impl Opts { fn read_env_file() -> eyre::Result<()> { match dotenvy::dotenv() { // It means the .env file hasn't been found but it's okay since it's optional - Err(dotenvy::Error::Io(_)) => (), + Err(dotenvy::Error::Io(_)) => println!("No .env file found, using environment variables"), Err(err) => bail!("Failed to load .env file: {:?}", err), Ok(path) => println!("Loaded environment variables from path: {:?}", path), }; diff --git a/testnets/holesky/README.md b/testnets/holesky/README.md index 4056410f5..9d0acfe78 100644 --- a/testnets/holesky/README.md +++ b/testnets/holesky/README.md @@ -464,7 +464,7 @@ First, make sure to have [Docker](https://docs.docker.com/engine/install/), Then clone the Bolt repository by running: ```bash -git clone --branch v0.3.0-alpha htts://github.com/chainbound/bolt.git +git clone htts://github.com/chainbound/bolt.git cd bolt/testnets/holesky ``` diff --git a/testnets/holesky/docker-compose.yml b/testnets/holesky/docker-compose.yml index 9b2999da3..fa35100ef 100644 --- a/testnets/holesky/docker-compose.yml +++ b/testnets/holesky/docker-compose.yml @@ -1,18 +1,23 @@ services: bolt-sidecar-holesky: - image: ghcr.io/chainbound/bolt-sidecar:v0.3.0-alpha + image: ghcr.io/chainbound/bolt-sidecar:v0.3.1-alpha.rc1 container_name: bolt-sidecar-holesky restart: unless-stopped - env_file: ./bolt-sidecar.env ports: # NOTE: to read these envs, it is necessary to provide them via `--env-file` or having them already set. - "${BOLT_SIDECAR_PORT:-8017}:${BOLT_SIDECAR_PORT:-8017}" # This port should be opened on your firewall! - "${BOLT_SIDECAR_CONSTRAINTS_PROXY_PORT:-18550}:${BOLT_SIDECAR_CONSTRAINTS_PROXY_PORT:-18550}" entrypoint: /usr/local/bin/entrypoint.sh volumes: + # Load the entrypoint script: an hook before starting the sidecar binary + # that overrides some of envs inside .env to match the volumes paths. - ./entrypoint.sh:/usr/local/bin/entrypoint.sh + # Load the environment variables that will be sourced by the sidecar process. - ./bolt-sidecar.env:/usr/local/bin/.env # NOTE: to read these envs, it is necessary to provide them via `--env-file` or having them already set. + # This is a workaround because it is not possible to conditionally mount + # volumes. As such, if an env is not provided, we will mount `/dev/null` + # instead. - ${BOLT_SIDECAR_DELEGATIONS_PATH:-/dev/null}:/etc/delegations.json - ${BOLT_SIDECAR_KEYSTORE_PATH:-/dev/null}:/etc/keystores - ${BOLT_SIDECAR_KEYSTORE_SECRETS_PATH:-/dev/null}:/etc/secrets diff --git a/testnets/holesky/entrypoint.sh b/testnets/holesky/entrypoint.sh index 3849458c6..97d9e82d2 100755 --- a/testnets/holesky/entrypoint.sh +++ b/testnets/holesky/entrypoint.sh @@ -3,12 +3,19 @@ # Exit immediately if a command exits with a non-zero status. set -e -# Override the environment variables provided by the user. +# Make sure we're in the correct directory +cd /usr/local/bin + +# Load the environment variables from the .env file. +source .env + +# Override some of the environment variables provided by the user, even if +# provided via .env file, so that the volume mounts work as expected. # # The "+" syntax replaces the environment variable with the alternate valuee # only if set. # Reference: https://docs.docker.com/compose/how-tos/environment-variables/variable-interpolation/#interpolation-syntax - +# # Ensure these environment variables are either empty or set with the # alternative values, overriding what's provided with the `--env-file` flag in # the Docker Compose file and matching the volume mounts. @@ -16,4 +23,4 @@ export BOLT_SIDECAR_DELEGATIONS_PATH="${BOLT_SIDECAR_DELEGATIONS_PATH+/etc/deleg export BOLT_SIDECAR_KEYSTORE_PATH="${BOLT_SIDECAR_KEYSTORE_PATH+/etc/keystore}" export BOLT_SIDECAR_KEYSTORE_SECRETS_PATH="${BOLT_SIDECAR_KEYSTORE_SECRETS_PATH+/etc/secrets}" -/usr/local/bin/bolt-sidecar +./bolt-sidecar