-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove settings.rs and refactor configuration handling Deleted settings.rs and moved configuration logic into config.rs, introducing ForesterConfig::new_for_start and ForesterConfig::new_for_status. Updated Docker commands and enhanced Dockerfile to reflect these changes. Adjusted WS URL handling and metrics push logic for better functional separation. * Standardize CLI argument environment variable names Updated environment variable names in CLI arguments to use the 'FORESTER_' prefix for consistency. This change ensures better readability and maintainability by following a uniform naming convention. * Rename `length` to `processing_length` in queue handlers. This change clarifies the purpose of the length parameters, specifying that they pertain to the processing length of queues rather than their total length. Updates have been made across `queue_helpers.rs`, `config.rs`, and `cli.rs` for consistency. * Add GitHub Actions workflow for Docker build and push. * Refactor Dockerfile to add custom startup script * Enhance logging for start script in Dockerfile * Simplify Dockerfile entrypoint * Make `payer` and `rpc_url` optional in CLI args Convert `rpc_url` and `payer` to `Option` types to handle scenarios where they might be missing and ensure appropriate error handling. Updated configuration initializations to account for these optional fields, thereby improving robustness and flexibility. * Update forester CI workflow configuration Switched the branch trigger to 'main' and pull request paths to 'forester/**'. Upgraded Docker GitHub Actions to newer versions for better compatibility and performance. * Refactor config and CLI for better readability * Fix tests * Update pushgateway URL in test utils configuration This change sets the `pushgateway_url` to `None` in the test configuration. This will prevent attempts to push metrics to Pushgateway during test runs, ensuring tests do not interact with external services.
- Loading branch information
1 parent
24b2337
commit 09d605a
Showing
14 changed files
with
410 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Docker Build and Push to DOCR | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- "**" | ||
paths: | ||
- "forester/**" | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to DigitalOcean Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: registry.digitalocean.com | ||
username: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | ||
password: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ./forester/Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: registry.digitalocean.com/v3-relayer/forester:latest | ||
|
||
- name: Inspect image | ||
run: | | ||
docker buildx imagetools inspect registry.digitalocean.com/v3-relayer/forester:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,129 @@ | ||
use clap::{Parser, Subcommand}; | ||
|
||
#[derive(Parser)] | ||
#[clap(author, version, about, long_about=None)] | ||
#[clap(author, version, about, long_about = None)] | ||
pub struct Cli { | ||
#[arg(long, default_value_t = false, global = true)] | ||
pub enable_metrics: bool, | ||
|
||
#[command(subcommand)] | ||
pub command: Option<Commands>, | ||
pub command: Commands, | ||
} | ||
|
||
#[allow(clippy::large_enum_variant)] | ||
#[derive(Subcommand)] | ||
pub enum Commands { | ||
Start, | ||
Status, | ||
Start(StartArgs), | ||
Status(StatusArgs), | ||
} | ||
|
||
#[derive(Parser, Clone, Debug)] | ||
pub struct StartArgs { | ||
#[arg(long, env = "FORESTER_RPC_URL")] | ||
pub rpc_url: Option<String>, | ||
|
||
#[arg(long, env = "FORESTER_PUSH_GATEWAY_URL")] | ||
pub push_gateway_url: Option<String>, | ||
|
||
#[arg(long, env = "FORESTER_WS_RPC_URL")] | ||
pub ws_rpc_url: Option<String>, | ||
|
||
#[arg(long, env = "FORESTER_INDEXER_URL")] | ||
pub indexer_url: Option<String>, | ||
|
||
#[arg(long, env = "FORESTER_PROVER_URL")] | ||
pub prover_url: Option<String>, | ||
|
||
#[arg(long, env = "FORESTER_PAYER")] | ||
pub payer: Option<String>, | ||
|
||
#[arg(long, env = "FORESTER_PHOTON_API_KEY")] | ||
pub photon_api_key: Option<String>, | ||
|
||
#[arg(long, env = "FORESTER_INDEXER_BATCH_SIZE", default_value = "50")] | ||
pub indexer_batch_size: usize, | ||
|
||
#[arg( | ||
long, | ||
env = "FORESTER_INDEXER_MAX_CONCURRENT_BATCHES", | ||
default_value = "10" | ||
)] | ||
pub indexer_max_concurrent_batches: usize, | ||
|
||
#[arg(long, env = "FORESTER_TRANSACTION_BATCH_SIZE", default_value = "1")] | ||
pub transaction_batch_size: usize, | ||
|
||
#[arg( | ||
long, | ||
env = "FORESTER_TRANSACTION_MAX_CONCURRENT_BATCHES", | ||
default_value = "20" | ||
)] | ||
pub transaction_max_concurrent_batches: usize, | ||
|
||
#[arg(long, env = "FORESTER_CU_LIMIT", default_value = "1000000")] | ||
pub cu_limit: u32, | ||
|
||
#[arg(long, env = "FORESTER_RPC_POOL_SIZE", default_value = "20")] | ||
pub rpc_pool_size: usize, | ||
|
||
#[arg( | ||
long, | ||
env = "FORESTER_SLOT_UPDATE_INTERVAL_SECONDS", | ||
default_value = "10" | ||
)] | ||
pub slot_update_interval_seconds: u64, | ||
|
||
#[arg( | ||
long, | ||
env = "FORESTER_TREE_DISCOVERY_INTERVAL_SECONDS", | ||
default_value = "5" | ||
)] | ||
pub tree_discovery_interval_seconds: u64, | ||
|
||
#[arg(long, env = "FORESTER_MAX_RETRIES", default_value = "3")] | ||
pub max_retries: u32, | ||
|
||
#[arg(long, env = "FORESTER_RETRY_DELAY", default_value = "1000")] | ||
pub retry_delay: u64, | ||
|
||
#[arg(long, env = "FORESTER_RETRY_TIMEOUT", default_value = "30000")] | ||
pub retry_timeout: u64, | ||
|
||
#[arg(long, env = "FORESTER_STATE_QUEUE_START_INDEX", default_value = "0")] | ||
pub state_queue_start_index: u16, | ||
|
||
#[arg( | ||
long, | ||
env = "FORESTER_STATE_PROCESSING_LENGTH", | ||
default_value = "28807" | ||
)] | ||
pub state_queue_processing_length: u16, | ||
|
||
#[arg(long, env = "FORESTER_ADDRESS_QUEUE_START_INDEX", default_value = "0")] | ||
pub address_queue_start_index: u16, | ||
|
||
#[arg( | ||
long, | ||
env = "FORESTER_ADDRESS_PROCESSING_LENGTH", | ||
default_value = "28807" | ||
)] | ||
pub address_queue_processing_length: u16, | ||
} | ||
|
||
#[derive(Parser, Clone, Debug)] | ||
pub struct StatusArgs { | ||
#[arg(long, env = "FORESTER_RPC_URL")] | ||
pub rpc_url: Option<String>, | ||
|
||
#[arg(long, env = "FORESTER_PUSH_GATEWAY_URL")] | ||
pub push_gateway_url: Option<String>, | ||
} | ||
|
||
impl StartArgs { | ||
pub fn enable_metrics(&self) -> bool { | ||
self.push_gateway_url.is_some() | ||
} | ||
} | ||
|
||
impl StatusArgs { | ||
pub fn enable_metrics(&self) -> bool { | ||
self.push_gateway_url.is_some() | ||
} | ||
} |
Oops, something went wrong.