-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add internal api monolith (#641)
<!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. -->
- Loading branch information
1 parent
66e49dd
commit f25ffe4
Showing
28 changed files
with
228 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
# Router Priorities | ||
|
||
| Priority | Router | Notes | | ||
| -------- | ------------------------- | ------------------------------------------------------------------------ | | ||
| 50 | api-monolith | Lives at the root, so anything that wants a path needs a higher priority | | ||
| 51 | _Other Bolt API services_ | | | ||
| 60 | Media fallback (imagor) | Anything without a query will route here | | ||
| 61 | Media with config | Anything with a query will route here | | ||
| Priority | Router | Notes | | ||
| -------- | ----------------------- | ---------------------------------------- | | ||
| 50 | _Bolt API services_ | | | ||
| 60 | Media fallback (imagor) | Anything without a query will route here | | ||
| 61 | Media with config | Anything with a query will route here | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[package] | ||
name = "api-internal-monolith" | ||
version = "0.0.1" | ||
authors = ["Rivet Gaming, LLC <developer@rivet.gg>"] | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
|
||
[dependencies] | ||
api-helper = { path = "../../../lib/api-helper/build" } | ||
async-trait = "0.1" | ||
chirp-client = { path = "../../../lib/chirp/client" } | ||
http = "0.2" | ||
hyper = { version = "0.14", features = ["server", "http1", "tcp"] } | ||
rivet-operation = { path = "../../../lib/operation/core" } | ||
tokio = { version = "1.29" } | ||
tracing = "0.1" | ||
tracing-subscriber = { version = "0.3", default-features = false, features = [ | ||
"fmt", | ||
"json", | ||
"ansi", | ||
] } | ||
url = "2.2.2" | ||
|
||
api-route = { path = "../route" } | ||
api-provision = { path = "../provision" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[service] | ||
name = "api-internal-monolith" | ||
essential = true | ||
priority = 70 | ||
|
||
[runtime] | ||
kind = "rust" | ||
|
||
# Has no mounts, internal only | ||
[api] | ||
|
||
[resources.single-node] | ||
cpu = 50 | ||
memory = 64 | ||
|
||
[resources.distributed] | ||
cpu = 1000 | ||
memory = 512 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod route; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use api_helper::start; | ||
|
||
fn main() { | ||
start(api_internal_monolith::route::handle); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use api_helper::define_router; | ||
use hyper::{Body, Request, Response}; | ||
use rivet_operation::prelude::*; | ||
|
||
pub async fn handle( | ||
shared_client: chirp_client::SharedClientHandle, | ||
pools: rivet_pools::Pools, | ||
cache: rivet_cache::Cache, | ||
ray_id: uuid::Uuid, | ||
request: Request<Body>, | ||
) -> Result<Response<Body>, http::Error> { | ||
let response = Response::builder(); | ||
|
||
// Handle route | ||
Router::handle(shared_client, pools, cache, ray_id, request, response).await | ||
} | ||
|
||
define_router! { | ||
routes: {}, | ||
mounts: [ | ||
{ | ||
path: api_route::route::Router, | ||
prefix: "route", | ||
}, | ||
{ | ||
path: api_provision::route::Router, | ||
prefix: "provision", | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// TODO: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.