open-web3-stack / parachain-launch

Tool to generate docker-compose.yml to launch a full relaychain - parachain testnet.
Apache License 2.0
72 stars 36 forks source link

Support for env variables in image name #104

Closed 5tan-enj closed 4 months ago

5tan-enj commented 1 year ago

Currently facing the following issue:

This is the config.yaml file

# Relaychain Configuration
relaychain:
  image: parity/polkadot:v0.9.28
  chain: rococo-local
  runtimeGenesisConfig:
    configuration:
      config:
        validation_upgrade_cooldown: 10
        validation_upgrade_delay: 10
  env:
    RUST_LOG: parachain::candidate-backing=trace,parachain::candidate-selection=trace,parachain::pvf=trace,parachain::collator-protocol=trace,parachain::provisioner=trace
  flags:
    - --rpc-methods=unsafe
  nodes:
    - name: alice
      wsPort: 9944
      rpcPort: 9933
      port: 30333
      flags:
        - --force-authoring
      env:
        RUST_LOG: babe=debug
    - name: bob
    - name: charlie

# Parachain Configuration
parachains:
- image: ${DOCKER_IMAGE_PATH}:${DOCKER_IMAGE_TAG}  ## <-- The env for image ##
  chain:
    base: rocfinity-local
  id: 2021
  parachain: true
  flags:
    - --force-authoring
    - --rpc-methods=unsafe
    - --execution=wasm
  relaychainFlags:
    - --execution=wasm
    - --port=30343
    - --rpc-methods=Auto
  env:
    RUST_LOG: runtime=debug,sc_basic_authorship=trace,cumulus-consensus=trace,cumulus-collator=trace,collator_protocol=trace,collation_generation=trace,aura=debug,pallet-collator-staking=trace,xcm=trace,pallet-xcm=trace
  volumePath: /data
  nodes:
  - wsPort: 10010
    rpcPort: 10011
    port: 40334
    flags:
      - --alice
  - wsPort: 10012
    rpcPort: 10013
    port: 40335
    flags:
      - --bob

When running ./node_modules/@open-web3/parachain-launch/bin/parachain-launch generate -y configs/config.yaml, it produces the following file

FROM ${DOCKER_IMAGE_PATH}:${DOCKER_IMAGE_TAG}
COPY . /app

and this results in an error since the ARGS are not added to the dockerfile from here

Is it possible to do this any other way? Or is this possible only with a change in the code to support passing ARGS?

xlc commented 1 year ago

it should be relatively easy to use _.template or something similar to implement env expand on the yaml config file. PR are welcome!