Skip to content

Migrate from Trillium [part 8]: remove Trillium server, serve Axum directly#2249

Closed
jcjones wants to merge 2 commits intomainfrom
jcj/axum-migration-part8
Closed

Migrate from Trillium [part 8]: remove Trillium server, serve Axum directly#2249
jcjones wants to merge 2 commits intomainfrom
jcj/axum-migration-part8

Conversation

@jcjones
Copy link
Copy Markdown
Contributor

@jcjones jcjones commented May 8, 2026

Axum is now the primary HTTP listener. The Trillium server, which was a pure pass-through proxy since Part 7C, is removed from the request path.

Production changes:

  • build_app(Config) -> BuiltApp replaces DivviupApi for production use
  • bin.rs rewritten: Axum serves directly, monitoring server is a separate Axum router, graceful shutdown via tokio signals + CancellationToken
  • Queue uses CancellationToken instead of Trillium's Stopper/CloneCounterObserver
  • telemetry.rs and trace.rs handlers converted from Trillium to Axum
  • Config gains listen_address field (from HOST/PORT env vars, default [::]:8080)

Dead code removal:

  • Deleted: handler/logger.rs, handler/opentelemetry.rs, axum_proxy test
  • Removed FromConn impls from: Db, User, PermissionsActor, AccountBearerToken
  • Removed Trillium Handler impls from: Db, ErrorHandler, CorsHeaders, ReplaceMimeTypes, SessionStore
  • Unified PermissionsActor::is_allowed/if_allowed to use http::Method
  • Removed deps: trillium-compression, trillium-conn-id, trillium-forwarding, trillium-opentelemetry, trillium-prometheus, trillium-redirect, trillium-sessions, trillium-cookies, async-session
  • Added deps: cookie (key-expansion feature, for session key derivation)

DivviupApi is kept as a thin test-only shim that spawns Axum on IPv6 Localhost and proxies via the existing AxumProxy, preserving test-support compatibility. Full test-support rewrite is deferred to Part 9.

…rectly

Axum is now the primary HTTP listener. The Trillium server, which was a
pure pass-through proxy since Part 7C, is removed from the request path.

Production changes:
- `build_app(Config) -> BuiltApp` replaces `DivviupApi` for production use
- `bin.rs` rewritten: Axum serves directly, monitoring server is a separate
  Axum router, graceful shutdown via tokio signals + CancellationToken
- `Queue` uses `CancellationToken` instead of Trillium's `Stopper`/`CloneCounterObserver`
- `telemetry.rs` and `trace.rs` handlers converted from Trillium to Axum
- `Config` gains `listen_address` field (from HOST/PORT env vars, default [::]:8080)

Dead code removal:
- Deleted: `handler/logger.rs`, `handler/opentelemetry.rs`, `axum_proxy` test
- Removed `FromConn` impls from: `Db`, `User`, `PermissionsActor`,
  `AccountBearerToken`
- Removed Trillium `Handler` impls from: `Db`, `ErrorHandler`, `CorsHeaders`,
  `ReplaceMimeTypes`, `SessionStore`
- Unified `PermissionsActor::is_allowed`/`if_allowed` to use `http::Method`
- Removed deps: `trillium-compression`, `trillium-conn-id`, `trillium-forwarding`,
  `trillium-opentelemetry`, `trillium-prometheus`, `trillium-redirect`,
  `trillium-sessions`, `trillium-cookies`, `async-session`
- Added deps: `cookie` (key-expansion feature, for session key derivation)

`DivviupApi` is kept as a thin test-only shim that spawns Axum on [::1]:0
and proxies via the existing `AxumProxy`, preserving test-support compatibility.
Full test-support rewrite is deferred to Part 9.
Comment thread src/handler.rs

// TODO(Part 9): add OpenTelemetry HTTP metrics middleware. The deleted
// trillium-opentelemetry handler provided http.server.* histograms and
// optional OTLP per-request spans; TraceLayer only emits tracing events.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note here that the http.server.* histograms are currently missing, but the application-level metrics using global::meter are emitted. Fixing in Part 9.

@jcjones
Copy link
Copy Markdown
Contributor Author

jcjones commented May 8, 2026

Splitting this out from the assets change is proving to be more headache than it's worth.

@jcjones jcjones closed this May 8, 2026
@jcjones jcjones deleted the jcj/axum-migration-part8 branch May 8, 2026 22:01
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.

1 participant