Merge pull request #5118 from nymtech/feat/add-dockerfile-add-env-vars

feat: add Dockerfile and add env vars for clap arguments
This commit is contained in:
Tommy Verrall
2024-11-12 15:57:07 +00:00
committed by GitHub
7 changed files with 55 additions and 23 deletions
+1 -1
View File
@@ -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"] }
+26
View File
@@ -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" ]
+3 -3
View File
@@ -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<PathBuf>,
/// 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,
}
+19 -13
View File
@@ -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<humantime::Duration>,
#[clap(long)]
#[clap(long, env = "NYM_VALIDATOR_REWARDER_CREDENTIAL_MONITOR_MIN_VALIDATION")]
pub credential_monitor_min_validation: Option<usize>,
#[clap(long)]
#[clap(long, env = "NYM_VALIDATOR_REWARDER_CREDENTIAL_MONITOR_SAMPLING_RATE")]
pub credential_monitor_sampling_rate: Option<f64>,
#[clap(long)]
#[clap(long, env = "NYM_VALIDATOR_REWARDER_SCRAPER_ENDPOINT")]
pub scraper_endpoint: Option<Url>,
#[clap(long)]
#[clap(long, env = "NYM_VALIDATOR_REWARDER_NYXD_ENDPOINT")]
pub nyxd_endpoint: Option<Url>,
#[clap(long)]
#[clap(long, env = "NYM_VALIDATOR_REWARDER_EPOCH_BUDGET")]
pub epoch_budget: Option<Coin>,
#[clap(long)]
#[clap(long, env = "NYM_VALIDATOR_REWARDER_EPOCH_DURATION")]
pub epoch_duration: Option<humantime::Duration>,
#[clap(long)]
#[clap(long, env = "NYM_VALIDATOR_REWARDER_BLOCK_SIGNIG_REWARD_RATIO")]
pub block_signing_reward_ratio: Option<f64>,
#[clap(long)]
#[clap(long, env = "NYM_VALIDATOR_REWARDER_CREDENTIAL_ISSUANCE_REWARD_RATIO")]
pub credential_issuance_reward_ratio: Option<f64>,
#[clap(long)]
#[clap(
long,
env = "NYM_VALIDATOR_REWARDER_CREDENTIAL_VERIFICATION_REWARD_RATIO"
)]
pub credential_verification_reward_ratio: Option<f64>,
}
@@ -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<PathBuf>,
}
@@ -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<u32>,
/// 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<u32>,
/// 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<PathBuf>,
}
+1 -1
View File
@@ -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<PathBuf>,
}