Skip to content

Commit

Permalink
WIP: ingres: webhook: use hyper instead of the ad-hoc http implementa…
Browse files Browse the repository at this point in the history
…tion

In the future we will likely want to do more things via HTTP,
namely serving prometheus metrics, providing a status page or
allowing the jobs inside of the machines to upload artifacts.

Growing a custom web server to do all of these things would be
possible, but not really a reasonable thing to do.

Instead use the hyper crate as a HTTP server implementation for the
webhook endpoint.

Using hyper as a server crate has the benefit of already being in our
dependencies via the octocrab crate.

As far as I can tell this is however the only benefit of hyper
(in our low-traffic usecase at least).
The interface seems to be designed by a committee of drunk lawyers that
are payed by the number of crates they split their completely bonkers
traits into, as a result of this it is about as ergononic as a designer
chair.

The documentation is strewn all over the place between all these crates
and the hyper doc writers have, in all their wisdom,
included `#[doc(hidden)]`s in their documentation, making it even less
navigable. Maybe what's hidden is proprietary knowledge that they can
bill extra for.

I hated any minute working with hyper so far.
We are in for a good time.
  • Loading branch information
hnez committed Aug 28, 2024
1 parent 2e80f6e commit dc6f953
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 159 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ chrono = "0.4"
fatfs = "0.3"
hex = "0.4"
hmac = "0.12"
http-body-util = "0.1"
jsonwebtoken = "9.3"
log = "0.4"
octocrab = "0.39"
Expand All @@ -25,6 +26,14 @@ serde_json = "1.0"
serde_yml = "0.0.12"
sha2 = "0.10"

[dependencies.hyper]
version = "1.4"
features = ["http1", "server"]

[dependencies.hyper-util]
version = "0.1"
features = ["tokio"]

[dependencies.tokio]
version = "1.38"
features = ["io-util", "process", "rt", "macros"]
Loading

0 comments on commit dc6f953

Please sign in to comment.