Skip to content

Commit

Permalink
chore: Lakefront service stub (#3329)
Browse files Browse the repository at this point in the history
  • Loading branch information
scsmithr authored Dec 2, 2024
1 parent da63904 commit 55dc814
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Cargo target directories.
/*target

# Submodules
/submodules

# Temp dir for slts
/slt_tmp

Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
args: ./*.whl

docker:
name: Build, push, and deploy docker image
name: Build, push, and deploy docker images
runs-on: ubuntu-latest

steps:
Expand All @@ -155,11 +155,18 @@ jobs:
- name: Configure gcloud docker
run: gcloud auth configure-docker -q

- name: Build and push docker image
- name: Build and push server docker image
run: |
docker build . -t gcr.io/glaredb-artifacts/rayexec-dev
docker build . -f Dockerfile.server -t gcr.io/glaredb-artifacts/rayexec-dev
docker push gcr.io/glaredb-artifacts/rayexec-dev
- name: Build and push lakefront docker image
run: |
docker build . -f Dockerfile.lakefront -t gcr.io/glaredb-artifacts/lakefront
docker push gcr.io/glaredb-artifacts/lakefront
# TODO: Remove deploy stuff, move to mono

- name: GKE Credentials
uses: 'google-github-actions/get-gke-credentials@v2'
with:
Expand Down
15 changes: 15 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rand = "0.8.5"
smallvec = "1.13.2"
rayon = "1.10.0"
num_cpus = "1.16.0"
tokio = { version = "1.38.0", default-features = false, features = ["rt", "time"] }
tokio = { version = "1.38.0", default-features = false }
tracing = { version = "0.1.40", default-features = false }
regex = "1.10.5"
url = "2.5.1"
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile.lakefront
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM rust AS builder

WORKDIR /usr/src
COPY . .

RUN cargo build --release --bin lakefront

FROM debian:bookworm-slim

COPY --from=builder /usr/src/target/release/lakefront /usr/local/bin/lakefront

CMD ["lakefront"]
4 changes: 2 additions & 2 deletions Dockerfile → Dockerfile.server
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM rust AS builder

WORKDIR /usr/src/rayexec
WORKDIR /usr/src
COPY . .

RUN ./scripts/install_protoc_linux.sh
RUN cargo build --release --bin rayexec_server

FROM debian:bookworm-slim

COPY --from=builder /usr/src/rayexec/target/release/rayexec_server /usr/local/bin/rayexec_server
COPY --from=builder /usr/src/target/release/rayexec_server /usr/local/bin/rayexec_server

CMD ["rayexec_server"]
11 changes: 0 additions & 11 deletions Dockerfile.test

This file was deleted.

22 changes: 22 additions & 0 deletions crates/lakefront/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "lakefront"
version.workspace = true
edition.workspace = true

[lib]
path = "src/lib.rs"

[[bin]]
name = "lakefront"
path = "src/main.rs"

[dependencies]
rayexec_error = { path = '../rayexec_error' }
logutil = { path = '../logutil' }
serde = { workspace = true }
serde_json = "1.0"
tracing = { workspace = true }
tokio = { workspace = true, features = ["full"] }
axum = "0.7.5"
clap = { version = "4.5.9", features = ["derive"] }
tower-http = { version = "0.5.2", default-features = false, features = ["cors", "trace"] }
3 changes: 3 additions & 0 deletions crates/lakefront/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! Lakefront lib.
pub fn serve() {}
36 changes: 36 additions & 0 deletions crates/lakefront/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use clap::{Parser, ValueEnum};
use tracing::info;

#[derive(Parser)]
#[clap(name = "lakefront")]
struct Arguments {
/// Port to start the server on.
#[clap(short, long, default_value_t = 8081)]
port: u16,
/// Log format.
#[arg(value_enum, long, value_parser, default_value_t = LogFormat::Json)]
log_format: LogFormat,
}

#[derive(Debug, Clone, Copy, Default, ValueEnum)]
enum LogFormat {
#[default]
Json,
Pretty,
}

impl From<LogFormat> for logutil::LogFormat {
fn from(value: LogFormat) -> Self {
match value {
LogFormat::Json => logutil::LogFormat::Json,
LogFormat::Pretty => logutil::LogFormat::HumanReadable,
}
}
}

fn main() {
let args = Arguments::parse();
logutil::configure_global_logger(tracing::Level::DEBUG, args.log_format.into());

info!("lakefront main")
}
2 changes: 1 addition & 1 deletion crates/rayexec_bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ async fn inner(

let shell = Shell::new(stdout);
shell.set_cols(cols as usize);
shell.attach(engine, "Rayexec Shell")?;
shell.attach(engine, "GlareDB Shell")?;

let inner_loop = || async move {
loop {
Expand Down
2 changes: 1 addition & 1 deletion crates/rayexec_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tracing-subscriber = {version = "0.3", default-features = false, features = ["st
wasm-bindgen = "0.2.92"
wasm-bindgen-futures = "0.4.42"
getrandom = { version = "0.2", features = ["js"] }
tokio = { workspace = true, default-features = false }
tokio = { workspace = true, default-features = false, features = [ "rt" ] } # TODO: Remove tokio from runtime interface
console_error_panic_hook = "0.1.7"
url = { workspace = true }
bytes = { version = "1.1", default-features = false, features = ["std"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/rayexec_wasm/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl WasmShell {
let terminal = TerminalWrapper::new(terminal);
let shell = Rc::new(Shell::new(BufWriter::new(terminal)));

shell.attach(engine, "Rayexec WASM Shell")?;
shell.attach(engine, "GlareDB WASM Shell")?;

Ok(WasmShell { shell })
}
Expand Down

0 comments on commit 55dc814

Please sign in to comment.