Skip to content

Commit

Permalink
Add a stub relational data service while I explore GraphQL
Browse files Browse the repository at this point in the history
See #63
  • Loading branch information
rtyler committed Mar 4, 2021
1 parent a9adeb2 commit 60e0b82
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ members = [
"services/local-orchestrator",
"services/object-store",
"services/parser",
"services/reldata",

"stdlib/archive",
"stdlib/dir",
Expand Down
5 changes: 4 additions & 1 deletion docs/Developing_Services.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

|===

12 changes: 12 additions & 0 deletions services/reldata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "reldata"
version = "0.1.0"
authors = ["R. Tyler Croy <[email protected]>"]
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"
12 changes: 12 additions & 0 deletions services/reldata/README.adoc
Original file line number Diff line number Diff line change
@@ -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

|===
30 changes: 30 additions & 0 deletions services/reldata/src/main.rs
Original file line number Diff line number Diff line change
@@ -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 {}

0 comments on commit 60e0b82

Please sign in to comment.