diff --git a/nym-validator-rewarder/Cargo.toml b/nym-validator-rewarder/Cargo.toml index 58a7472c43..ab722f9459 100644 --- a/nym-validator-rewarder/Cargo.toml +++ b/nym-validator-rewarder/Cargo.toml @@ -14,7 +14,7 @@ license = "GPL-3.0" anyhow.workspace = true bip39 = { workspace = true, features = ["zeroize"] } cosmwasm-std.workspace = true -clap = { workspace = true, features = ["cargo"] } +clap = { workspace = true, features = ["cargo", "env"] } futures.workspace = true serde = { workspace = true, features = ["derive"] } sqlx = { workspace = true, features = ["runtime-tokio-rustls", "sqlite", "macros", "migrate", "time"] } diff --git a/nym-validator-rewarder/Dockerfile b/nym-validator-rewarder/Dockerfile new file mode 100644 index 0000000000..4c8e34b24f --- /dev/null +++ b/nym-validator-rewarder/Dockerfile @@ -0,0 +1,26 @@ +FROM rust:latest AS builder + +COPY ./ /usr/src/nym +WORKDIR /usr/src/nym/nym-validator-rewarder + +RUN cargo build --release + + +#------------------------------------------------------------------- +# The following environment variables are required at runtime: +# +# +# And optionally: +# +# +# see https://github.com/nymtech/nym/blob/develop/nym-validator-rewarder/src/cli/mod.rs for details +#------------------------------------------------------------------- + +FROM ubuntu:24.04 + +RUN apt-get update && apt-get install -y ca-certificates + +WORKDIR /nym + +COPY --from=builder /usr/src/nym/target/release/nym-validator-rewarder ./ +ENTRYPOINT [ "/nym/nym-validator-rewarder" ] diff --git a/nym-validator-rewarder/src/cli/init.rs b/nym-validator-rewarder/src/cli/init.rs index 2c10d18506..e1d68e1cc4 100644 --- a/nym-validator-rewarder/src/cli/init.rs +++ b/nym-validator-rewarder/src/cli/init.rs @@ -14,15 +14,15 @@ pub struct Args { config_override: ConfigOverridableArgs, /// Specifies custom location for the configuration file of nym validators rewarder. - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_INIT_CUSTOM_CONFIG_PATH")] custom_config_path: Option, /// Mnemonic used for rewarding operations - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_MNEMONIC")] mnemonic: bip39::Mnemonic, /// Overwrite existing configuration file. - #[clap(long, short)] + #[clap(long, short, env = "NYM_VALIDATOR_REWARDER_FORCE")] force: bool, } diff --git a/nym-validator-rewarder/src/cli/mod.rs b/nym-validator-rewarder/src/cli/mod.rs index e986b5f4d2..239328ed8a 100644 --- a/nym-validator-rewarder/src/cli/mod.rs +++ b/nym-validator-rewarder/src/cli/mod.rs @@ -53,43 +53,49 @@ impl Cli { #[derive(Debug, clap::Args)] pub struct ConfigOverridableArgs { - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_DISABLE_BLOCK_SIGNING_REWARDING")] pub disable_block_signing_rewarding: bool, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_BLOCK_SIGNING_MONITORING_ONLY")] pub block_signing_monitoring_only: bool, - #[clap(long)] + #[clap( + long, + env = "NYM_VALIDATOR_REWARDER_DISABLE_CREDENTIAL_ISSUANCE_REWARDING" + )] pub disable_credential_issuance_rewarding: bool, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_CREDENTIAL_MONITOR_RUN_INTERVAL")] pub credential_monitor_run_interval: Option, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_CREDENTIAL_MONITOR_MIN_VALIDATION")] pub credential_monitor_min_validation: Option, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_CREDENTIAL_MONITOR_SAMPLING_RATE")] pub credential_monitor_sampling_rate: Option, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_SCRAPER_ENDPOINT")] pub scraper_endpoint: Option, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_NYXD_ENDPOINT")] pub nyxd_endpoint: Option, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_EPOCH_BUDGET")] pub epoch_budget: Option, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_EPOCH_DURATION")] pub epoch_duration: Option, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_BLOCK_SIGNIG_REWARD_RATIO")] pub block_signing_reward_ratio: Option, - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_CREDENTIAL_ISSUANCE_REWARD_RATIO")] pub credential_issuance_reward_ratio: Option, - #[clap(long)] + #[clap( + long, + env = "NYM_VALIDATOR_REWARDER_CREDENTIAL_VERIFICATION_REWARD_RATIO" + )] pub credential_verification_reward_ratio: Option, } diff --git a/nym-validator-rewarder/src/cli/process_block.rs b/nym-validator-rewarder/src/cli/process_block.rs index 7f395bca25..b3d090cfda 100644 --- a/nym-validator-rewarder/src/cli/process_block.rs +++ b/nym-validator-rewarder/src/cli/process_block.rs @@ -12,11 +12,11 @@ pub struct Args { config_override: ConfigOverridableArgs, /// Height of the block we want to process - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_PROCESS_BLOCK_HEIGHT")] height: u32, /// Specifies custom location for the configuration file of nym validators rewarder. - #[clap(long)] + #[clap(long, env = "NYM_VALIDATOR_REWARDER_PROCESS_BLOCK_CONFIG_PATH")] custom_config_path: Option, } diff --git a/nym-validator-rewarder/src/cli/process_until.rs b/nym-validator-rewarder/src/cli/process_until.rs index f1c15470d0..3de3a3fff7 100644 --- a/nym-validator-rewarder/src/cli/process_until.rs +++ b/nym-validator-rewarder/src/cli/process_until.rs @@ -13,16 +13,16 @@ pub struct Args { /// Optional starting height for processing the blocks. /// If none is provided, the default behaviour will be applied. - #[clap(long)] + #[clap(long, env = "NYM_REWARDER_VALIDATOR_PROCESS_UNTIL_START_HEIGHT")] start_height: Option, /// Height of until we want to be processing the blocks. /// If none is provided, the currrent block height will be used - #[clap(long)] + #[clap(long, env = "NYM_REWARDER_VALIDATOR_PROCESS_UNTIL_STOP_HEIGHT")] stop_height: Option, /// Specifies custom location for the configuration file of nym validators rewarder. - #[clap(long)] + #[clap(long, env = "NYM_REWARDER_VALIDATOR_PROCESS_UNTIL_CONFIG_PATH")] custom_config_path: Option, } diff --git a/nym-validator-rewarder/src/cli/run.rs b/nym-validator-rewarder/src/cli/run.rs index 540657c618..a12ac965d8 100644 --- a/nym-validator-rewarder/src/cli/run.rs +++ b/nym-validator-rewarder/src/cli/run.rs @@ -12,7 +12,7 @@ pub struct Args { config_override: ConfigOverridableArgs, /// Specifies custom location for the configuration file of nym validators rewarder. - #[clap(long)] + #[clap(long, env = "NYM_REWARDER_VALIDATOR_RUN_CONFIG_PATH")] custom_config_path: Option, }