Add a stub relational data service while I explore GraphQL

See #63
This commit is contained in:
R Tyler Croy 2021-03-03 10:38:33 -08:00
parent a9adeb2d8a
commit 60e0b82247
6 changed files with 70 additions and 1 deletions

11
Cargo.lock generated
View File

@ -2010,6 +2010,17 @@ version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
[[package]]
name = "reldata"
version = "0.1.0"
dependencies = [
"async-std",
"log",
"otto-models",
"pretty_env_logger 0.4.0",
"tide 0.15.1",
]
[[package]]
name = "remove_dir_all"
version = "0.5.3"

View File

@ -13,6 +13,7 @@ members = [
"services/local-orchestrator",
"services/object-store",
"services/parser",
"services/reldata",
"stdlib/archive",
"stdlib/dir",

View File

@ -9,7 +9,6 @@ This document captures some details around developing these Otto services.
|===
| Port | Service Name | Notes
| 7670
| Dashboard
| Placeholder for the web dashboard
@ -27,5 +26,9 @@ This document captures some details around developing these Otto services.
| Orchestrator
| Service which can provision environments capable of executing agents.
| 7674
| Relational Data
| Service which provides relational data services to clients.
|===

View File

@ -0,0 +1,12 @@
[package]
name = "reldata"
version = "0.1.0"
authors = ["R. Tyler Croy <rtyler@brokenco.de>"]
edition = "2018"
[dependencies]
async-std = { version = "~1.7", features = ["attributes"]}
log = "~0.4.11"
otto-models = { path = "../../crates/models" }
pretty_env_logger = "~0.4.0"
tide = "~0.15.0"

View File

@ -0,0 +1,12 @@
= Relational Data
The relational data service provides a centralized location for project,
pipeline, and more data to be stored. This is in contrast to the object store
which is expected to store large files/objects.
.Environnment Variables
|===
| Name | Default | Description
|===

View File

@ -0,0 +1,30 @@
/*
* The relational data service largely is meant to expose information from an underlying database
*/
use tide::Request;
async fn healthcheck(_req: Request<()>) -> tide::Result {
Ok(tide::Response::builder(200)
.body("{}")
.content_type("application/json")
.build())
}
#[async_std::main]
async fn main() -> std::io::Result<()> {
use std::{env, net::TcpListener, os::unix::io::FromRawFd};
pretty_env_logger::init();
let mut app = tide::new();
app.at("/health").get(healthcheck);
if let Some(fd) = env::var("LISTEN_FD").ok().and_then(|fd| fd.parse().ok()) {
app.listen(unsafe { TcpListener::from_raw_fd(fd) }).await?;
} else {
app.listen("http://localhost:7674").await?;
}
Ok(())
}
#[cfg(test)]
mod tests {}