Skip to content

Conversation

@sprutton1
Copy link
Contributor

@sprutton1 sprutton1 commented Oct 15, 2025

How does this PR change the system?

  • adds a crate to hang a simple webserver off of a service
  • currently provides a simple /health endpoint and a /config endpoint that dumps the service's computed config
  • ensures we don't serialize protected values (secrets in configs and all SensitiveString types
  • adds implementations to edda, forklift, pinga, rebaser, and veritech

Screenshots:

On service startup

2025-10-15T19:11:55.873147Z  INFO ThreadId(43) rebaser: ready to receive messages
2025-10-15T19:11:55.873230Z  INFO ThreadId(54) si_service_endpoints::server: service endpoints listening service="rebaser" address=127.0.0.1:33665 health_endpoint="/health" config_endpoint="/config"

Testing:

❯ curl -s localhost:33665/{health,config} | jq
{
  "status": "healthy"
}
{
  "service": "rebaser",
  "config": {
    "pg_pool": {
      "user": "si",
      "password": "...",
      "dbname": "si",
      "application_name": "rebaser",
      "hostname": "localhost",
      "port": 5432,
      "pool_max_size": 128,
      "pool_timeout_wait_secs": null,
      "pool_timeout_create_secs": null,
      "pool_timeout_recycle_secs": null,
      "pool_total_connection_lifetime_secs": 72000,
      "pool_idle_connection_lifetime_secs": 21600,
      "pool_lifetime_check_interval_secs": null,
      "recycling_method": null
    },
    "nats": {
      "connection_name": "rebaser",
      "creds": null,
      "creds_file": null,
      "subject_prefix": null,
      "url": "localhost"
    },
    "crypto": {},
    "symmetric_crypto_service": {},
    "layer_db_config": {
      "pg_pool_config": {
        "user": "si",
        "password": "...",
        "dbname": "si_layer_db",
        "application_name": "rebaser",
        "hostname": "localhost",
        "port": 5432,
        "pool_max_size": 128,
        "pool_timeout_wait_secs": null,
        "pool_timeout_create_secs": null,
        "pool_timeout_recycle_secs": null,
        "pool_total_connection_lifetime_secs": 72000,
        "pool_idle_connection_lifetime_secs": 21600,
        "pool_lifetime_check_interval_secs": null,
        "recycling_method": null
      },
      "nats_config": {
        "connection_name": "rebaser",
        "creds": null,
        "creds_file": null,
        "subject_prefix": null,
        "url": "localhost"
      },
      "cache_config": {
        "name": "default",
        "memory_reserved_percent": 40,
        "memory_usable_max_percent": 100,
        "disk_layer": true,
        "disk_reserved_percent": 5,
        "disk_usable_max_percent": 100,
        "disk_admission_rate_limit": 1073741824,
        "disk_buffer_size": 134217728,
        "disk_buffer_flushers": 2,
        "disk_indexer_shards": 64,
        "disk_path": "/tmp/nix-shell.EHJBad/default-cache-2MGVoF",
        "disk_reclaimers": 2,
        "disk_recover_concurrency": 8
      }
    },
    "instance_id": "01K7MMJFQHSXD23B5MMXTEJN04",
    "concurrency_limit": null,
    "quiescent_period": {
      "secs": 300,
      "nanos": 0
    },
    "features": {
      "generate_mvs": true
    },
    "snapshot_eviction_grace_period": {
      "secs": 0,
      "nanos": 0
    },
    "service_endpoints": {
      "enabled": true,
      "bind_address": "127.0.0.1:0",
      "health_endpoint": "/health",
      "config_endpoint": "/config"
    }
  }
}

Out of Scope:

I want to extend this to allow services that already have an axum stack to just use it there, but it's a but more complicated, so I'm punting for sdf and luminork for now.

How was it tested?

Locally it works! Try passes!

  • Integration tests pass
  • Manual test: new functionality works in UI

In short: 🔗

@github-actions
Copy link

github-actions bot commented Oct 15, 2025

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

Scanned Files

None

@sprutton1 sprutton1 changed the title Scott/health feat: health and config endpoint service Oct 15, 2025
@sprutton1
Copy link
Contributor Author

/try

@github-actions
Copy link

github-actions bot commented Oct 15, 2025

Okay, starting a try! I'll update this comment once it's running...
🚀 Try running here! 🚀

@sprutton1 sprutton1 requested a review from Copilot October 15, 2025 18:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a reusable HTTP service for health and config endpoints and integrates it across services. Also introduces secure serialization/redaction for sensitive config fields to make /config dumps safe.

  • New si-service-endpoints crate (Axum router + server + config)
  • Integrates ServiceEndpointsConfig into multiple servers with sensible defaults
  • Redacts sensitive fields (e.g., passwords/keys) in serialized configs

Reviewed Changes

Copilot reviewed 26 out of 32 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/si-service-endpoints/src/lib.rs Defines DefaultServiceEndpoints, ServiceEndpointsConfig, and error types to back health/config endpoints.
lib/si-service-endpoints/src/server.rs Implements an HTTP server wrapper with graceful shutdown for the endpoints.
lib/si-service-endpoints/src/axum_integration.rs Axum router and handlers for /health and /config.
lib/si-service-endpoints/Cargo.toml New crate manifest for si-service-endpoints.
lib/si-service-endpoints/BUCK Buck target for the new crate.
lib/si-std/src/string.rs SensitiveString now serializes as "..." and updates tests accordingly.
lib/si-data-pg/src/lib.rs Prevents certificate from being serialized in config dumps.
lib/si-crypto/src/veritech/config.rs Skips serializing crypto key material in configs.
lib/si-crypto/src/symmetric.rs Skips serializing symmetric key material in configs.
lib/pinga-server/* Re-exports endpoint types, adds ServiceEndpointsConfig to runtime config and defaults.
lib/rebaser-server/* Re-exports endpoint types, adds ServiceEndpointsConfig to runtime config and defaults.
lib/forklift-server/* Re-exports endpoint types, adds ServiceEndpointsConfig to runtime config and defaults.
lib/edda-server/* Re-exports endpoint types, adds ServiceEndpointsConfig to runtime config and defaults.
lib/veritech-server/* Re-exports endpoint types, adds ServiceEndpointsConfig to runtime config and defaults.
BUCK/Cargo updates Adds si-service-endpoints dependency to relevant crates.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sprutton1 sprutton1 marked this pull request as ready for review October 15, 2025 19:53
@sprutton1
Copy link
Contributor Author

/try

@github-actions
Copy link

github-actions bot commented Oct 22, 2025

Okay, starting a try! I'll update this comment once it's running...
🚀 Try running here! 🚀

Comment on lines +75 to +84
let endpoints_server = if config.service_endpoints().enabled {
let endpoints = edda_server::DefaultServiceEndpoints::from_config("edda", &config)?;
Some(edda_server::EndpointsServer::new(
std::sync::Arc::new(endpoints),
config.service_endpoints().clone(),
endpoints_token.clone(),
))
} else {
None
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this pattern!

@@ -44,7 +45,7 @@ impl ConfigError {
type Result<T> = std::result::Result<T, ConfigError>;

/// The config for the forklift server.
#[derive(Debug, Builder)]
#[derive(Debug, Builder, Serialize)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah... we must serialize these for the config endpoint... took me a moment. This is a great idea.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants