Monorepo consolidation: workspace, shared types, transport plans, docker/swam assets
Some checks failed
ci / rust (push) Failing after 2m34s
ci / ui (push) Failing after 30s

This commit is contained in:
2026-03-30 11:40:42 +03:00
parent 7e7041cf8b
commit 1298d9a3df
246 changed files with 55434 additions and 0 deletions

33
docker/Dockerfile.rust Normal file
View File

@@ -0,0 +1,33 @@
FROM rust:1.93-bookworm AS builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends clang libclang-dev pkg-config protobuf-compiler ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . .
ARG GATEWAY_BUILD_VERSION=dev
ARG GATEWAY_BUILD_SHA=unknown
ENV GATEWAY_BUILD_VERSION=$GATEWAY_BUILD_VERSION
ENV GATEWAY_BUILD_SHA=$GATEWAY_BUILD_SHA
ARG PACKAGE
ARG BIN
RUN cargo build -p ${PACKAGE} --bin ${BIN} --release
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 10001 app
ARG BIN
COPY --from=builder /app/target/release/${BIN} /usr/local/bin/app
USER app
ENTRYPOINT ["/usr/local/bin/app"]

17
docker/Dockerfile.ui Normal file
View File

@@ -0,0 +1,17 @@
FROM node:20-alpine AS builder
WORKDIR /app
COPY control/ui/package.json control/ui/package-lock.json ./
RUN npm ci
COPY control/ui .
RUN npm run build
FROM nginx:1.29-alpine
COPY control/ui/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -0,0 +1,52 @@
#!/bin/sh
set -eu
mode="${1:-all}"
build_rust() {
image="$1"
package="$2"
bin="$3"
docker build \
-f docker/Dockerfile.rust \
--build-arg PACKAGE="$package" \
--build-arg BIN="$bin" \
--build-arg GATEWAY_BUILD_VERSION="${GATEWAY_BUILD_VERSION:-dev}" \
--build-arg GATEWAY_BUILD_SHA="${GATEWAY_BUILD_SHA:-unknown}" \
-t "$image" \
.
}
build_ui() {
image="$1"
docker build -f docker/Dockerfile.ui -t "$image" .
}
build_platform() {
build_rust cloudlysis/gateway:dev gateway gateway
build_rust cloudlysis/aggregate:dev aggregate aggregate
build_rust cloudlysis/projection:dev projection projection
build_rust cloudlysis/runner:dev runner runner
}
build_control() {
build_rust cloudlysis/control-api:dev api api
build_ui cloudlysis/control-ui:dev
}
case "$mode" in
platform)
build_platform
;;
control)
build_control
;;
all)
build_platform
build_control
;;
*)
echo "usage: sh docker/scripts/build_images.sh [platform|control|all]" 1>&2
exit 2
;;
esac

View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -eu
ensure_secret() {
name="$1"
value="$2"
if docker secret inspect "$name" >/dev/null 2>&1; then
return 0
fi
printf "%s" "$value" | docker secret create "$name" - >/dev/null
}
ensure_secret grafana_admin_password "${GRAFANA_ADMIN_PASSWORD:-admin}"

View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -e
docker build -t cloudlysis/aggregate:local -f docker/Dockerfile.rust --build-arg PACKAGE=aggregate --build-arg BIN=aggregate .
cid="$(docker run -d -p 8085:8080 -e AGGREGATE_STORAGE_PATH=/tmp/aggregate-data cloudlysis/aggregate:local)"
sleep 2
curl -fsS http://localhost:8085/health >/dev/null
curl -fsS http://localhost:8085/ready >/dev/null
curl -fsS http://localhost:8085/metrics >/dev/null
docker rm -f "$cid" >/dev/null