mirror of
https://github.com/Noratrieb/cargo-bisect-rustc-service.git
synced 2026-01-15 16:45:02 +01:00
Compare commits
No commits in common. "main" and "v0.2" have entirely different histories.
8 changed files with 270 additions and 741 deletions
1
.envrc
1
.envrc
|
|
@ -1 +0,0 @@
|
||||||
use nix
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,2 +1,2 @@
|
||||||
/target
|
/target
|
||||||
bisect.sqlite
|
bisect.sqlite
|
||||||
953
Cargo.lock
generated
953
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -9,9 +9,6 @@ edition = "2021"
|
||||||
axum = "0.5.16"
|
axum = "0.5.16"
|
||||||
chrono = { version = "0.4.22", features = ["serde", "clock"] }
|
chrono = { version = "0.4.22", features = ["serde", "clock"] }
|
||||||
color-eyre = "0.6.2"
|
color-eyre = "0.6.2"
|
||||||
metrics = "0.22.3"
|
|
||||||
metrics-exporter-prometheus = { version = "0.14.0", default-features = false, features = ["http-listener"] }
|
|
||||||
once_cell = "1.19.0"
|
|
||||||
rusqlite = { version = "0.28.0", features = ["bundled", "uuid", "chrono"] }
|
rusqlite = { version = "0.28.0", features = ["bundled", "uuid", "chrono"] }
|
||||||
serde = { version = "1.0.145", features = ["derive"] }
|
serde = { version = "1.0.145", features = ["derive"] }
|
||||||
tempdir = "0.3.7"
|
tempdir = "0.3.7"
|
||||||
|
|
|
||||||
16
Dockerfile
16
Dockerfile
|
|
@ -1,4 +1,4 @@
|
||||||
FROM rust:1.77 as build
|
FROM rust as build
|
||||||
|
|
||||||
RUN rustup toolchain install nightly
|
RUN rustup toolchain install nightly
|
||||||
RUN rustup default nightly
|
RUN rustup default nightly
|
||||||
|
|
@ -12,30 +12,22 @@ COPY Cargo.toml Cargo.lock ./
|
||||||
RUN mkdir src
|
RUN mkdir src
|
||||||
RUN echo "fn main() {}" > src/main.rs
|
RUN echo "fn main() {}" > src/main.rs
|
||||||
|
|
||||||
RUN cargo build --release
|
RUN cargo build --release -Zsparse-registry
|
||||||
|
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
COPY index.html index.html
|
COPY index.html index.html
|
||||||
|
|
||||||
# now rebuild with the proper main
|
# now rebuild with the proper main
|
||||||
RUN touch src/main.rs
|
RUN touch src/main.rs
|
||||||
RUN cargo build --release
|
RUN cargo build --release -Zsparse-registry
|
||||||
|
|
||||||
### RUN
|
### RUN
|
||||||
FROM rust:1.77
|
FROM rust
|
||||||
|
|
||||||
RUN cargo install cargo-bisect-rustc
|
RUN cargo install cargo-bisect-rustc
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# random user
|
|
||||||
RUN useradd --create-home bisector
|
|
||||||
USER bisector
|
|
||||||
|
|
||||||
# this server listens on port 4000 and 4001 (metrics)
|
|
||||||
EXPOSE 4000
|
|
||||||
EXPOSE 4001
|
|
||||||
|
|
||||||
COPY --from=build /app/target/release/cargo-bisect-rustc-service cargo-bisect-rustc-service
|
COPY --from=build /app/target/release/cargo-bisect-rustc-service cargo-bisect-rustc-service
|
||||||
|
|
||||||
CMD ["/app/cargo-bisect-rustc-service"]
|
CMD ["/app/cargo-bisect-rustc-service"]
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,4 @@
|
||||||
# cargo-bisect-rustc-service
|
# cargo-bisect-rustc-service
|
||||||
|
|
||||||
**⚠️ this service has been turned off due to lack of usage ⚠️**
|
|
||||||
|
|
||||||
if you think it's useful you should tell me so i can turn it on again
|
|
||||||
|
|
||||||
a small web service that bisects rustc for you
|
a small web service that bisects rustc for you
|
||||||
|
|
||||||
https://bisect-rustc.noratrieb.dev
|
https://nilstrieb.dev/bisect-rustc
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
{ pkgs ? import <nixpkgs> { } }: pkgs.mkShell {
|
|
||||||
packages = with pkgs; [ rustup ];
|
|
||||||
}
|
|
||||||
26
src/main.rs
26
src/main.rs
|
|
@ -4,10 +4,7 @@ mod bisect;
|
||||||
mod db;
|
mod db;
|
||||||
mod toolchain;
|
mod toolchain;
|
||||||
|
|
||||||
use std::{
|
use std::sync::{mpsc, Arc, Mutex};
|
||||||
future,
|
|
||||||
sync::{mpsc, Arc, Mutex},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::bisect::Job;
|
use crate::bisect::Job;
|
||||||
use axum::{
|
use axum::{
|
||||||
|
|
@ -18,7 +15,6 @@ use axum::{
|
||||||
Extension, Json,
|
Extension, Json,
|
||||||
};
|
};
|
||||||
use color_eyre::eyre::Context;
|
use color_eyre::eyre::Context;
|
||||||
use metrics_exporter_prometheus::{PrometheusBuilder, PrometheusHandle};
|
|
||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
@ -42,22 +38,6 @@ async fn main() -> color_eyre::Result<()> {
|
||||||
)
|
)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
let metrics_app = async {
|
|
||||||
let prom_handle = setup_metrics();
|
|
||||||
let router: Router =
|
|
||||||
Router::new().route("/metrics", get(move || future::ready(prom_handle.render())));
|
|
||||||
info!("Starting up metrics server on port 4001");
|
|
||||||
axum::Server::bind(&"0.0.0.0:4001".parse().unwrap())
|
|
||||||
.serve(router.into_make_service())
|
|
||||||
.await
|
|
||||||
.wrap_err("failed to start server")
|
|
||||||
};
|
|
||||||
|
|
||||||
tokio::try_join!(metrics_app, main_server())?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn main_server() -> color_eyre::Result<()> {
|
|
||||||
let (job_queue_send, job_queue_recv) = mpsc::sync_channel(10);
|
let (job_queue_send, job_queue_recv) = mpsc::sync_channel(10);
|
||||||
|
|
||||||
let sqlite_db = env::var("SQLITE_DB").unwrap_or_else(|_| "bisect.sqlite".to_string());
|
let sqlite_db = env::var("SQLITE_DB").unwrap_or_else(|_| "bisect.sqlite".to_string());
|
||||||
|
|
@ -135,7 +115,6 @@ async fn do_bisection(
|
||||||
body: String,
|
body: String,
|
||||||
send_channel: Extension<SendChannel>,
|
send_channel: Extension<SendChannel>,
|
||||||
) -> impl IntoResponse {
|
) -> impl IntoResponse {
|
||||||
metrics::counter!("bisections").increment(1);
|
|
||||||
let job_id = Uuid::new_v4();
|
let job_id = Uuid::new_v4();
|
||||||
|
|
||||||
let job = Job::new(job_id, body, options.0);
|
let job = Job::new(job_id, body, options.0);
|
||||||
|
|
@ -151,6 +130,3 @@ async fn do_bisection(
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn setup_metrics() -> PrometheusHandle {
|
|
||||||
PrometheusBuilder::new().install_recorder().unwrap()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue