diff --git a/.gitlab/ci/container-boot.gitlab-ci.yml b/.gitlab/ci/container-boot.gitlab-ci.yml index 38d62c0..7e84924 100644 --- a/.gitlab/ci/container-boot.gitlab-ci.yml +++ b/.gitlab/ci/container-boot.gitlab-ci.yml @@ -150,3 +150,38 @@ container:boot:sculptor: - docker ps --all - docker compose logs sculptor -f & - docker compose run curl-sculptor + +container:boot:velorum: + extends: + - .container:boot + needs: + - generate-environment + - manifest:velorum + script: + - bundle install + - docker compose up velorum -d + - docker compose logs velorum -f & + - support/grpc_check_health --host docker:50052 --service liveness --retries 20 + - support/grpc_check_health --host docker:50052 --service readiness --retries 20 + +container:boot:velorum:offline: + extends: + - .container:boot + needs: + - generate-environment + - manifest:velorum + script: + - docker compose up velorum-offline -d + - docker compose logs velorum-offline -f & + - | + for i in $(seq 1 30); do + STATUS=$(docker inspect --format='{{.State.Health.Status}}' $(docker compose ps -q velorum-offline) 2>/dev/null || echo "starting") + echo "Attempt $i/30: $STATUS" + if [ "$STATUS" = "healthy" ]; then + echo "Velorum booted successfully without network access" + exit 0 + fi + sleep 1 + done + echo "Timed out waiting for healthy status" + exit 1 diff --git a/.gitlab/ci/container-build.gitlab-ci.yml b/.gitlab/ci/container-build.gitlab-ci.yml index e44110a..843aabb 100644 --- a/.gitlab/ci/container-build.gitlab-ci.yml +++ b/.gitlab/ci/container-build.gitlab-ci.yml @@ -326,3 +326,18 @@ manifest:sculptor: PLATFORM: - amd64 - arm64 + +container:velorum: + extends: + - .single-image-build-base + needs: + - generate-environment + variables: + NEED_PROJECT_DOWNLOAD: 'true' + +manifest:velorum: + extends: + - .manifest-create-base + needs: + - generate-environment + - container:velorum diff --git a/container/velorum/Dockerfile b/container/velorum/Dockerfile new file mode 100644 index 0000000..35e6110 --- /dev/null +++ b/container/velorum/Dockerfile @@ -0,0 +1,27 @@ +ARG PYTHON_VERSION=3.12 +ARG UV_VERSION=0.11.16 + +FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv +FROM python:${PYTHON_VERSION}-slim + +COPY --from=uv /uv /uvx /usr/local/bin/ + +WORKDIR /velorum + +COPY projects/velorum/pyproject.toml projects/velorum/uv.lock ./ +RUN uv sync --frozen +COPY projects/velorum/src/model.py ./src/model.py +RUN uv run python -c "from src.model import load_vector_model; load_vector_model()" + +COPY projects/velorum/cli ./cli +COPY projects/velorum/src ./src +COPY projects/velorum/main.py ./main.py + +ENV HF_HUB_OFFLINE=1 +ENV PYTHONUNBUFFERED=1 + +HEALTHCHECK --interval=5s --timeout=3s --retries=3 \ + CMD uv run python -c "import grpc; from grpc_health.v1 import health_pb2, health_pb2_grpc; ch = grpc.insecure_channel('localhost:50051'); stub = health_pb2_grpc.HealthStub(ch); stub.Check(health_pb2.HealthCheckRequest(service='liveness'))" || exit 1 + +EXPOSE 50051 +CMD ["uv", "run", "main.py"] diff --git a/support/config/velorum.models.configuration.json b/support/config/velorum.models.configuration.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/support/config/velorum.models.configuration.json @@ -0,0 +1 @@ +[] diff --git a/support/docker-compose.yml b/support/docker-compose.yml index 7ba2a56..9887a5d 100644 --- a/support/docker-compose.yml +++ b/support/docker-compose.yml @@ -118,5 +118,20 @@ services: - --retry-connrefused - http://sculptor:3000/ + velorum: + image: ghcr.io/code0-tech/reticulum/ci-builds/velorum:${RETICULUM_CONTAINER_VERSION} + networks: + - boot + volumes: + - ./config/velorum.models.configuration.json:/velorum/models.configuration.json + ports: + - "50052:50051" + + velorum-offline: + image: ghcr.io/code0-tech/reticulum/ci-builds/velorum:${RETICULUM_CONTAINER_VERSION} + network_mode: "none" + volumes: + - ./config/velorum.models.configuration.json:/velorum/models.configuration.json + networks: boot: diff --git a/versions/velorum b/versions/velorum new file mode 100644 index 0000000..83a4271 --- /dev/null +++ b/versions/velorum @@ -0,0 +1 @@ +6f34f272aa434826459b76f315f9f33c70d969f4 \ No newline at end of file