diff --git a/.github/workflows/release.devnet.all.daily.yml b/.github/workflows/release.devnet.all.daily.yml index 691f2c0579..f8644dddd7 100644 --- a/.github/workflows/release.devnet.all.daily.yml +++ b/.github/workflows/release.devnet.all.daily.yml @@ -42,8 +42,6 @@ jobs: playbook: playbooks/geoprobe_agents.yml - component: geoprobe-target playbook: playbooks/geoprobe_targets.yml - - component: geolocation-cli - playbook: playbooks/noop.yml with: component: ${{ matrix.component }} playbook: ${{ matrix.playbook }} diff --git a/.github/workflows/release.geolocation-cli.yml b/.github/workflows/release.geolocation-cli.yml deleted file mode 100644 index dbe553e190..0000000000 --- a/.github/workflows/release.geolocation-cli.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: releaser.geolocation-cli - -on: - push: - tags: - - "geolocation-cli/v*.*.*" - -permissions: - contents: write - -jobs: - goreleaser: - runs-on: ubuntu-24.04-16c-64gb - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: Swatinem/rust-cache@v2 - with: - cache-targets: | - target - target/x86_64-unknown-linux-gnu/release - - name: Install rust for cli - uses: dtolnay/rust-toolchain@1.90.0 - - name: Install dependencies for rpm packaging - run: | - sudo apt update - sudo apt-get install squashfs-tools rpm -y - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser-pro - args: release -f release/.goreleaser.testnet.geolocation-cli.yaml --clean - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_BOTS_WEBHOOK }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - CLOUDSMITH_TOKEN: ${{ secrets.CLOUDSMITH_TOKEN }} diff --git a/.github/workflows/release.testnet.push.tags.components.yml b/.github/workflows/release.testnet.push.tags.components.yml index 215cc11927..ede9f1974c 100644 --- a/.github/workflows/release.testnet.push.tags.components.yml +++ b/.github/workflows/release.testnet.push.tags.components.yml @@ -23,7 +23,6 @@ jobs: - device-telemetry-agent - geoprobe-agent - geoprobe-target - - geolocation-cli - funder - monitor - client diff --git a/CHANGELOG.md b/CHANGELOG.md index 620a764ad5..35e4c2dd60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ All notable changes to this project will be documented in this file. - Drop the activator-only pollers from `doublezero` (user and multicastgroup activation waits). The `--wait` flag on `user create`, `user create-subscribe`, `user subscribe`, `multicastgroup create`, and `multicastgroup update` now fetches the post-create state once instead of polling — creates are atomic to `Activated` post-RFC-11, so the wait loop was watching a transition that no longer happens ([#3614](https://github.com/malbeclabs/doublezero/issues/3614)) - Trim the `Rejected` status arm from the device and link activation pollers; `Rejected` was itself an activator-driven transition ([#3614](https://github.com/malbeclabs/doublezero/issues/3614)) - `doublezero user get` and `doublezero user list` surface BGP RTT as an `rtt` column (e.g. `5.50 ms`, or `-` when no sample has been observed). JSON output includes raw `bgp_rtt_ns` alongside the pretty `bgp_rtt` string. + - Remove standalone `doublezero-geolocation` binary; use `doublezero geolocation ...` instead. - Client - Simplify `doublezero connect`'s post-create user fetch to a fixed retry-on-RPC-lag get instead of waiting for `UserStatus::Activated`; the activator-driven transition is gone, so the fetch only needs to ride out replica lag ([#3614](https://github.com/malbeclabs/doublezero/issues/3614)) - E2E diff --git a/Cargo.lock b/Cargo.lock index b158ec2bbf..e90f3d5908 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1598,21 +1598,6 @@ dependencies = [ "thiserror 2.0.17", ] -[[package]] -name = "doublezero-geolocation-cli" -version = "0.24.0" -dependencies = [ - "clap", - "doublezero-config", - "doublezero-geolocation", - "doublezero-serviceability", - "doublezero-serviceability-cli", - "doublezero_sdk", - "eyre", - "libc", - "solana-sdk", -] - [[package]] name = "doublezero-program-common" version = "0.24.0" diff --git a/Cargo.toml b/Cargo.toml index fe8086e441..7c1a50bf96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,6 @@ [workspace] members = [ "client/doublezero", - "client/doublezero-geolocation-cli", "config", "controlplane/doublezero-admin", "smartcontract/cli", diff --git a/client/doublezero-geolocation-cli/Cargo.toml b/client/doublezero-geolocation-cli/Cargo.toml deleted file mode 100644 index 653e57fe80..0000000000 --- a/client/doublezero-geolocation-cli/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "doublezero-geolocation-cli" - -# Workspace inherited keys -version.workspace = true -authors.workspace = true -edition.workspace = true -homepage.workspace = true -license.workspace = true -repository.workspace = true - -[[bin]] -name = "doublezero-geolocation" -path = "src/main.rs" - -[dependencies] -clap.workspace = true -eyre.workspace = true -libc.workspace = true -solana-sdk.workspace = true - -doublezero-config.workspace = true -doublezero-geolocation.workspace = true -doublezero-serviceability.workspace = true -doublezero-serviceability-cli.workspace = true -doublezero_sdk.workspace = true diff --git a/client/doublezero-geolocation-cli/src/cli/command.rs b/client/doublezero-geolocation-cli/src/cli/command.rs deleted file mode 100644 index b3ce23b1ac..0000000000 --- a/client/doublezero-geolocation-cli/src/cli/command.rs +++ /dev/null @@ -1,15 +0,0 @@ -use super::{config::ConfigCliCommand, probe::ProbeCliCommand, user::UserCliCommand}; -use clap::Subcommand; -use doublezero_serviceability_cli::geolocation::programconfig::init::InitProgramConfigCliCommand; - -#[derive(Subcommand, Debug)] -pub enum Command { - /// Display or update CLI configuration - Config(ConfigCliCommand), - /// Manage geolocation probes - Probe(ProbeCliCommand), - /// Manage geolocation users and targets - User(UserCliCommand), - /// Initialize the geolocation program config (one-time setup) - InitConfig(InitProgramConfigCliCommand), -} diff --git a/client/doublezero-geolocation-cli/src/cli/config.rs b/client/doublezero-geolocation-cli/src/cli/config.rs deleted file mode 100644 index 9e49f4c6d8..0000000000 --- a/client/doublezero-geolocation-cli/src/cli/config.rs +++ /dev/null @@ -1,18 +0,0 @@ -use clap::{Args, Subcommand}; -use doublezero_serviceability_cli::geolocation::config::{ - get::GetGeoConfigCliCommand, set::SetGeoConfigCliCommand, -}; - -#[derive(Args, Debug)] -pub struct ConfigCliCommand { - #[command(subcommand)] - pub command: ConfigCommands, -} - -#[derive(Subcommand, Debug)] -pub enum ConfigCommands { - /// Display current configuration - Get(GetGeoConfigCliCommand), - /// Update configuration values - Set(SetGeoConfigCliCommand), -} diff --git a/client/doublezero-geolocation-cli/src/cli/mod.rs b/client/doublezero-geolocation-cli/src/cli/mod.rs deleted file mode 100644 index c3492d0710..0000000000 --- a/client/doublezero-geolocation-cli/src/cli/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod command; -pub mod config; -pub mod probe; -pub mod user; diff --git a/client/doublezero-geolocation-cli/src/cli/probe.rs b/client/doublezero-geolocation-cli/src/cli/probe.rs deleted file mode 100644 index 353b001982..0000000000 --- a/client/doublezero-geolocation-cli/src/cli/probe.rs +++ /dev/null @@ -1,30 +0,0 @@ -use clap::{Args, Subcommand}; -use doublezero_serviceability_cli::geolocation::probe::{ - add_parent::AddParentGeoProbeCliCommand, create::CreateGeoProbeCliCommand, - delete::DeleteGeoProbeCliCommand, get::GetGeoProbeCliCommand, list::ListGeoProbeCliCommand, - remove_parent::RemoveParentGeoProbeCliCommand, update::UpdateGeoProbeCliCommand, -}; - -#[derive(Args, Debug)] -pub struct ProbeCliCommand { - #[command(subcommand)] - pub command: ProbeCommands, -} - -#[derive(Subcommand, Debug)] -pub enum ProbeCommands { - /// Create a new geolocation probe - Create(CreateGeoProbeCliCommand), - /// Update an existing probe - Update(UpdateGeoProbeCliCommand), - /// Delete a probe - Delete(DeleteGeoProbeCliCommand), - /// Get details of a specific probe - Get(GetGeoProbeCliCommand), - /// List all probes - List(ListGeoProbeCliCommand), - /// Add a parent device to a probe - AddParent(AddParentGeoProbeCliCommand), - /// Remove a parent device from a probe - RemoveParent(RemoveParentGeoProbeCliCommand), -} diff --git a/client/doublezero-geolocation-cli/src/cli/user.rs b/client/doublezero-geolocation-cli/src/cli/user.rs deleted file mode 100644 index d4010a2bfd..0000000000 --- a/client/doublezero-geolocation-cli/src/cli/user.rs +++ /dev/null @@ -1,36 +0,0 @@ -use clap::{Args, Subcommand}; -use doublezero_serviceability_cli::geolocation::user::{ - add_target::AddTargetCliCommand, create::CreateGeolocationUserCliCommand, - delete::DeleteGeolocationUserCliCommand, get::GetGeolocationUserCliCommand, - list::ListGeolocationUserCliCommand, remove_target::RemoveTargetCliCommand, - set_result_destination::SetResultDestinationCliCommand, - update::UpdateGeolocationUserCliCommand, update_payment_status::UpdatePaymentStatusCliCommand, -}; - -#[derive(Args, Debug)] -pub struct UserCliCommand { - #[command(subcommand)] - pub command: UserCommands, -} - -#[derive(Subcommand, Debug)] -pub enum UserCommands { - /// Create a new geolocation user - Create(CreateGeolocationUserCliCommand), - /// Delete a geolocation user - Delete(DeleteGeolocationUserCliCommand), - /// Update a geolocation user's payment token account - Update(UpdateGeolocationUserCliCommand), - /// Get details of a specific user - Get(GetGeolocationUserCliCommand), - /// List all geolocation users - List(ListGeolocationUserCliCommand), - /// Add a target to a user - AddTarget(AddTargetCliCommand), - /// Remove a target from a user - RemoveTarget(RemoveTargetCliCommand), - /// Set result destination for geolocation results - SetResultDestination(SetResultDestinationCliCommand), - /// Update payment status (foundation-only) - UpdatePayment(UpdatePaymentStatusCliCommand), -} diff --git a/client/doublezero-geolocation-cli/src/main.rs b/client/doublezero-geolocation-cli/src/main.rs deleted file mode 100644 index 527ba779ba..0000000000 --- a/client/doublezero-geolocation-cli/src/main.rs +++ /dev/null @@ -1,132 +0,0 @@ -use clap::Parser; -use std::path::PathBuf; - -mod cli; -use cli::{command::Command, config::ConfigCommands, probe::ProbeCommands, user::UserCommands}; -use doublezero_config::Environment; -use doublezero_sdk::{geolocation::client::GeoClient, DZClient}; -use doublezero_serviceability::pda::get_globalstate_pda; -use doublezero_serviceability_cli::geoclicommand::GeoCliCommandImpl; - -#[derive(Parser, Debug)] -#[command(term_width = 0)] -#[command(name = "doublezero-geolocation")] -#[command(version = option_env!("BUILD_VERSION").unwrap_or(env!("CARGO_PKG_VERSION")))] -#[command(about = "DoubleZero Geolocation management tool")] -struct App { - #[command(subcommand)] - command: Command, - /// DZ env (testnet, devnet, or mainnet-beta) - #[arg(short, long, value_name = "ENV", global = true)] - env: Option, - /// DZ ledger RPC URL - #[arg(long, value_name = "RPC_URL", global = true)] - url: Option, - /// Geolocation program ID - #[arg(long, value_name = "PROGRAM_ID", global = true)] - geo_program_id: Option, - /// Serviceability program ID (for GlobalState PDA derivation) - #[arg(long, value_name = "PROGRAM_ID", global = true)] - serviceability_program_id: Option, - /// Path to the keypair file - #[arg(long, value_name = "KEYPAIR", global = true)] - keypair: Option, -} - -fn main() -> eyre::Result<()> { - unsafe { - libc::signal(libc::SIGPIPE, libc::SIG_DFL); - } - - let app = App::parse(); - - let stdout = std::io::stdout(); - let mut handle = stdout.lock(); - - // Config commands don't need an RPC connection - if let Command::Config(cmd) = app.command { - return match cmd.command { - ConfigCommands::Get(args) => args.execute(&mut handle), - ConfigCommands::Set(args) => args.execute(&mut handle), - }; - } - - let (url, geo_program_id, svc_program_id) = if let Some(env) = app.env { - let config = env.parse::()?.config()?; - ( - Some(config.ledger_public_rpc_url), - Some(config.geolocation_program_id.to_string()), - config.serviceability_program_id, - ) - } else { - let svc_pid = match &app.serviceability_program_id { - Some(id) => id.parse::()?, - None => { - let (_, cfg) = doublezero_sdk::read_doublezero_config()?; - match cfg.program_id { - Some(id) => id.parse()?, - None => doublezero_sdk::default_program_id(), - } - } - }; - (app.url, app.geo_program_id, svc_pid) - }; - - // Write commands require a valid keypair; check early for a clear error. - let needs_keypair = matches!( - &app.command, - Command::Probe(cmd) if !matches!(cmd.command, ProbeCommands::Get(_) | ProbeCommands::List(_)) - ) || matches!( - &app.command, - Command::User(cmd) if !matches!(cmd.command, UserCommands::Get(_) | UserCommands::List(_)) - ) || matches!(&app.command, Command::InitConfig(_)); - - if needs_keypair { - let keypair_path = match &app.keypair { - Some(p) => p.clone(), - None => { - let (_, cfg) = doublezero_sdk::read_doublezero_config()?; - cfg.keypair_path - } - }; - if !keypair_path.exists() { - eyre::bail!("keypair file not found: {}", keypair_path.display()); - } - } - - let svc_client = DZClient::new( - url.clone(), - None, - Some(svc_program_id.to_string()), - app.keypair.clone(), - )?; - let geoclient = GeoClient::new(url, geo_program_id, app.keypair)?; - let (globalstate_pk, _) = get_globalstate_pda(&svc_program_id); - let client = GeoCliCommandImpl::new(&geoclient, &svc_client, globalstate_pk); - - match app.command { - Command::Probe(cmd) => match cmd.command { - ProbeCommands::Create(args) => args.execute(&client, &mut handle), - ProbeCommands::Update(args) => args.execute(&client, &mut handle), - ProbeCommands::Delete(args) => args.execute(&client, &mut handle), - ProbeCommands::Get(args) => args.execute(&client, &mut handle), - ProbeCommands::List(args) => args.execute(&client, &mut handle), - ProbeCommands::AddParent(args) => args.execute(&client, &mut handle), - ProbeCommands::RemoveParent(args) => args.execute(&client, &mut handle), - }, - Command::User(cmd) => match cmd.command { - UserCommands::Create(args) => args.execute(&client, &mut handle), - UserCommands::Delete(args) => args.execute(&client, &mut handle), - UserCommands::Update(args) => args.execute(&client, &mut handle), - UserCommands::Get(args) => args.execute(&client, &mut handle), - UserCommands::List(args) => args.execute(&client, &mut handle), - UserCommands::AddTarget(args) => args.execute(&client, &mut handle), - UserCommands::RemoveTarget(args) => args.execute(&client, &mut handle), - UserCommands::SetResultDestination(args) => args.execute(&client, &mut handle), - UserCommands::UpdatePayment(args) => args.execute(&client, &mut handle), - }, - Command::InitConfig(args) => args.execute(&client, &mut handle), - // Config commands are handled by the early return above. - Command::Config(_) => eyre::bail!("unexpected: config commands should be handled earlier"), - } -} diff --git a/e2e/docker/base.dockerfile b/e2e/docker/base.dockerfile index 5ceea59366..f7b3e98574 100644 --- a/e2e/docker/base.dockerfile +++ b/e2e/docker/base.dockerfile @@ -92,7 +92,6 @@ RUN --mount=type=cache,id=cargo-${CARGO_LOCK_HASH},target=/cargo \ RUSTFLAGS="-C link-arg=-fuse-ld=mold" cargo build --workspace --release --exclude doublezero-serviceability --exclude doublezero-telemetry && \ cp /target/release/doublezero ${BIN_DIR}/ && \ cp /target/release/doublezero-admin ${BIN_DIR}/ && \ - cp /target/release/doublezero-geolocation ${BIN_DIR}/ && \ cp /target/release/doublezero-sentinel ${BIN_DIR}/ && \ cp /target/release/fork-accounts ${BIN_DIR}/ diff --git a/e2e/docker/manager/Dockerfile b/e2e/docker/manager/Dockerfile index 3efb51038b..dcf0bf041b 100644 --- a/e2e/docker/manager/Dockerfile +++ b/e2e/docker/manager/Dockerfile @@ -13,7 +13,6 @@ COPY --from=base /doublezero/bin/doublezero-admin /doublezero/bin/. COPY --from=base /doublezero/bin/doublezero_serviceability.so /doublezero/bin/. COPY --from=base /doublezero/bin/doublezero_telemetry.so /doublezero/bin/. COPY --from=base /doublezero/bin/doublezero_geolocation.so /doublezero/bin/. -COPY --from=base /doublezero/bin/doublezero-geolocation /doublezero/bin/. COPY --from=base /usr/local/bin/solana /usr/local/bin/. COPY --from=base /usr/local/bin/solana-keygen /usr/local/bin/. diff --git a/release/.goreleaser.base.geolocation-cli.yaml b/release/.goreleaser.base.geolocation-cli.yaml deleted file mode 100644 index 3ce3ee3fb1..0000000000 --- a/release/.goreleaser.base.geolocation-cli.yaml +++ /dev/null @@ -1,85 +0,0 @@ -# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj - -version: 2 - -project_name: doublezero-geolocation - -monorepo: - tag_prefix: geolocation-cli/ - -builds: - - id: doublezero-geolocation - binary: doublezero-geolocation - builder: rust - tool: cargo - command: build - flags: - - --package=doublezero-geolocation-cli - - --release - targets: - - x86_64-unknown-linux-gnu - env: - - RUSTFLAGS=-C linker=x86_64-linux-gnu-gcc - - BUILD_VERSION={{.Version}} - - BUILD_COMMIT={{.ShortCommit}} - - BUILD_DATE={{.Date}} - -archives: - - id: geolocation_cli_archive - formats: ['tar.gz'] - ids: [doublezero-geolocation] - # this name template makes the OS and Arch compatible with the results of `uname`. - name_template: >- - {{ .ProjectName }}_ - {{- title .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 - {{- else if eq .Arch "386" }}i386 - {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}v{{ .Arm }}{{ end }} - -nfpms: - - id: doublezero-geolocation - package_name: doublezero-geolocation - ids: [doublezero-geolocation] - vendor: doublezero - homepage: doublezero.xyz - maintainer: steve - description: |- - DoubleZero geolocation CLI - license: Apache 2.0 - formats: - - deb - bindir: /usr/bin - release: 1 - section: default - -changelog: - sort: asc - filters: - exclude: - - "^docs:" - - "^test:" - -release: - github: - owner: malbeclabs - name: doublezero - draft: false - replace_existing_artifacts: true - -announce: - slack: - enabled: true - message_template: "DoubleZero Geolocation CLI {{.Tag}} has been released! Check it out at {{ .ReleaseURL }}" - channel: "#bots" - -git: - ignore_tags: - - geolocation-cli/daily - -nightly: - publish_release: true - keep_single_release: true - version_template: '{{ incpatch .Version }}~git{{ .Env.BUILD_DATE }}.{{ .ShortCommit }}' - tag_name: 'geolocation-cli/daily' diff --git a/release/.goreleaser.devnet.geolocation-cli.yaml b/release/.goreleaser.devnet.geolocation-cli.yaml deleted file mode 100644 index dbc2043b4b..0000000000 --- a/release/.goreleaser.devnet.geolocation-cli.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj - -includes: - - from_file: - path: release/.goreleaser.base.geolocation-cli.yaml - -cloudsmiths: - - organization: malbeclabs - repository: doublezero-devnet - distributions: - deb: "any-distro/any-version" - rpm: "any-distro/any-version" diff --git a/release/.goreleaser.testnet.geolocation-cli.yaml b/release/.goreleaser.testnet.geolocation-cli.yaml deleted file mode 100644 index aead4fb7f3..0000000000 --- a/release/.goreleaser.testnet.geolocation-cli.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj - -includes: - - from_file: - path: release/.goreleaser.base.geolocation-cli.yaml - -cloudsmiths: - - organization: malbeclabs - repository: doublezero-testnet - distributions: - deb: "any-distro/any-version" - rpm: "any-distro/any-version"