diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index a30f51cf..17498818 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -68,4 +68,12 @@ jobs: push: true tags: fluxxu/flo-observer:${{ github.sha }},fluxxu/flo-observer:latest file: './build/observer.Dockerfile' + context: './build' + + - name: Build and push - flo-stats + uses: docker/build-push-action@v2 + with: + push: true + tags: fluxxu/flo-stats:${{ github.sha }},fluxxu/flo-stats:latest + file: './build/stats.Dockerfile' context: './build' \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 770de369..8aea07a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1678,21 +1678,6 @@ dependencies = [ "tracing-futures", ] -[[package]] -name = "flo-live-service" -version = "0.1.0" -dependencies = [ - "async-graphql", - "async-graphql-axum", - "axum", - "dotenv", - "flo-log-subscriber", - "flo-observer-edge", - "tokio", - "tokio-stream", - "tracing", -] - [[package]] name = "flo-log" version = "0.1.0" @@ -1937,6 +1922,22 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "flo-stats-service" +version = "0.1.0" +dependencies = [ + "async-graphql", + "async-graphql-axum", + "axum", + "dotenv", + "flo-constants", + "flo-log-subscriber", + "flo-observer-edge", + "tokio", + "tokio-stream", + "tracing", +] + [[package]] name = "flo-task" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 698698f8..3daf7bf8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ members = [ "binaries/flo-worker", "binaries/flo-worker-ui", "binaries/flo-ping", - "binaries/flo-live-service", + "binaries/flo-stats-service", "deps/flo-grpc" ] diff --git a/binaries/flo-live-service/Cargo.toml b/binaries/flo-stats-service/Cargo.toml similarity index 84% rename from binaries/flo-live-service/Cargo.toml rename to binaries/flo-stats-service/Cargo.toml index 326bfac6..2cb43653 100644 --- a/binaries/flo-live-service/Cargo.toml +++ b/binaries/flo-stats-service/Cargo.toml @@ -1,9 +1,10 @@ [package] -name = "flo-live-service" +name = "flo-stats-service" version = "0.1.0" edition = "2021" [dependencies] +flo-constants = { path = "../../crates/constants" } flo-observer-edge = { path = "../../crates/observer-edge" } flo-log-subscriber = { path = "../../crates/log-subscriber" } diff --git a/binaries/flo-live-service/src/graphql/mod.rs b/binaries/flo-stats-service/src/graphql/mod.rs similarity index 100% rename from binaries/flo-live-service/src/graphql/mod.rs rename to binaries/flo-stats-service/src/graphql/mod.rs diff --git a/binaries/flo-live-service/src/main.rs b/binaries/flo-stats-service/src/main.rs similarity index 86% rename from binaries/flo-live-service/src/main.rs rename to binaries/flo-stats-service/src/main.rs index 5b933ea0..d4868328 100644 --- a/binaries/flo-live-service/src/main.rs +++ b/binaries/flo-stats-service/src/main.rs @@ -28,7 +28,7 @@ async fn main() -> Result<(), Box> { { dotenv::dotenv()?; flo_log_subscriber::init_env_override( - "flo_live_service=debug,flo_observer_edge=debug,flo_observer=debug", + "flo_stats_service=debug,flo_observer_edge=debug,flo_observer=debug", ); } @@ -48,9 +48,11 @@ async fn main() -> Result<(), Box> { .route("/ws", GraphQLSubscription::new(schema.clone())) .layer(AddExtensionLayer::new(schema)); - println!("Playground: http://localhost:8080"); + let bind = format!("0.0.0.0:{}", flo_constants::OBSERVER_GRAPHQL_PORT); + + tracing::info!("running at {}", bind); - Server::bind(&"0.0.0.0:8080".parse().unwrap()) + Server::bind(&bind.parse().unwrap()) .serve(app.into_make_service()) .await?; Ok(()) diff --git a/build/stats.Dockerfile b/build/stats.Dockerfile new file mode 100644 index 00000000..47f841ef --- /dev/null +++ b/build/stats.Dockerfile @@ -0,0 +1,23 @@ +FROM debian:stable + +WORKDIR /flo + +RUN apt-get update && \ + apt-get install \ + ca-certificates \ + libssl-dev \ + -qqy \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* + +ARG IMAGE_BUILD_DATE=2016-01-01 +ENV IMAGE_BUILD_DATE $IMAGE_BUILD_DATE + +ENV RUST_BACKTRACE 1 + +EXPOSE 3557/tcp +EXPOSE 3558/tcp + +COPY release/flo-stats-service flo-stats-service + +CMD ["/flo/flo-obsestatsrver-service"] diff --git a/crates/constants/src/lib.rs b/crates/constants/src/lib.rs index 3d16da33..3d7b1dff 100644 --- a/crates/constants/src/lib.rs +++ b/crates/constants/src/lib.rs @@ -27,3 +27,4 @@ pub const MIN_FLO_VERSION: version::Version = Version { }; pub const OBSERVER_GRPC_PORT: u16 = 3556; pub const OBSERVER_SOCKET_PORT: u16 = 3557; +pub const OBSERVER_GRAPHQL_PORT: u16 = 3558;