Skip to content

feat(config): support flexible wrapper deployment - #9

Merged
korayakpinar merged 1 commit into
developmentfrom
feat/flexible-deployment-phase-1
Aug 5, 2026
Merged

korayakpinar merged 1 commit into
developmentfrom
feat/flexible-deployment-phase-1

Conversation

@korayakpinar

@korayakpinar korayakpinar commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR introduces the configuration and transport-policy foundation required to run archive-wrapper in different deployment environments without changing the binary.

It replaces implicit local-file assumptions with an explicit configuration contract, adds deterministic CLI/environment/YAML precedence, and allows operators to choose between loopback-only and trusted private-network gRPC listeners.

This is the bottom PR in the flexible deployment stack.

Motivation

The previous runtime assumed that archive-wrapper and its client shared the same host and network namespace. That made a loopback listener appropriate for local sidecar deployments, but it prevented the same binary from being used safely in container topologies where Pulsar and archive-wrapper communicate through private service-network addresses.

Configuration was also split between relative paths, environment variables, and CLI behavior without one explicit precedence model. That made container startup dependent on the process working directory and made an explicitly empty override difficult to distinguish from an omitted value.

Configuration Resolution

Runtime configuration now follows one deterministic precedence order:

CLI override > environment variable > YAML configuration

The config path is resolved as:

--config > ARCHIVE_WRAPPER_CONFIG > error

The Pulsar chain home is resolved as:

--home > ARCHIVE_WRAPPER_CHAIN_HOME > chain_home > error

There is no implicit ./config.yaml fallback in the binary. This makes startup independent from the process working directory and requires deployments to identify their configuration explicitly.

CLI overrides preserve whether a flag was actually supplied. An explicitly empty flag or environment value is therefore validated as an explicit value rather than silently falling back to a lower-priority source.

Runtime overrides are available for:

  • Pulsar chain home
  • gRPC listen address
  • gRPC transport mode
  • LevelDB path
  • Control socket path

gRPC Transport Policy

The configuration now includes an explicit transport mode:

grpc_transport_mode: loopback

Supported modes are:

loopback

Restricts the plaintext gRPC listener to literal loopback addresses such as:

127.0.0.1:9095
[::1]:9095

This remains the default and preserves the local-sidecar security boundary.

trusted-network

Allows literal loopback, private, and unspecified bind addresses, including:

0.0.0.0:9095
[::]:9095
10.0.0.10:9095

This mode is intended for controlled private container networks. It records an explicit operator decision to expose plaintext gRPC beyond loopback, but it does not verify firewall rules, authenticate clients, or encrypt traffic.

TLS/mTLS remains required before supporting untrusted or public-network exposure.

Validation and Failure Behavior

Configuration validation rejects:

  • Missing config paths
  • Missing chain homes for runtime commands
  • Unsupported transport modes
  • Hostnames where a literal bind IP is required
  • Zoned IPv6 addresses
  • Malformed or zero ports
  • Public bind addresses in trusted-network mode
  • Non-loopback addresses in loopback mode
  • Conflicting LevelDB metadata and cursor keys
  • Missing deployment identity fields

Invalid configuration fails before LevelDB, PostgreSQL, the control socket, or the gRPC listener is opened.

Logging Safety

PostgreSQL-related runtime errors are converted to safe operational summaries before logging. Raw credential-bearing PostgreSQL errors and connection strings are not emitted through normal logs.

The implementation intentionally keeps this policy narrow and includes a follow-up security note for moving toward structured secret classification if additional secret-bearing integrations are introduced.

Tests

The new tests cover:

  • CLI, environment, and YAML precedence
  • Explicit empty override behavior
  • Missing config and chain-home errors
  • Loopback and trusted-network address matrices
  • Programmatically constructed configuration validation
  • Startup rejection before side effects
  • Safe PostgreSQL error logging
  • Control socket and supervisor behavior under the resolved configuration

Stack

@korayakpinar korayakpinar changed the title feat/flexible deployment phase 1 feat(config): support flexible wrapper deployment Aug 3, 2026
@korayakpinar
korayakpinar requested a review from yusufozmis August 3, 2026 14:48
Comment thread cmd/archive-wrapper/logging.go Resolved
Comment thread cmd/archive-wrapper/cli.go Resolved
Comment thread config/config.go Resolved
Comment thread config.yaml Resolved
@korayakpinar
korayakpinar merged commit c3f78a9 into development Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants