Skip to content

Multi-service repositories

Hive supports multiple services in one repository. Each service is a directory with its own .hive.yml.

Structure

my-repo/
  .gitlab-ci.yml              # CI for the entire repo
  frontend/
    .hive.yml                  # name: frontend, port: 3000
    src/
      ...
  backend/
    .hive.yml                  # name: backend, port: 8080
    src/
      ...
  worker/
    .hive.yml                  # name: worker, port: 8080
    src/
      ...

Each .hive.yml describes one service. Hive automatically discovers all .hive.yml files from the repository root.

Service discovery

The CLI command hive list shows all discovered services:

$ hive list
Discovered services:
  frontend   (port: 3000, path: frontend)
  backend    (port: 8080, path: backend)
  worker     (port: 8080, path: worker)

Search is recursive from the git repository root. All .hive.yml files are discovered automatically.

Working with services

All services (--all)

# Build all
hive build --all

# Test all
hive test --all

# Deploy all
hive deploy --all

Specific service (--service)

# Build only backend
hive build --service backend

# Deploy only frontend
hive deploy --service frontend

Current service (no flags)

Without flags, Hive works with the .hive.yml in the current directory:

cd backend/
hive build    # builds only backend

If .hive.yml is not found in the current directory, the CLI searches upward to the repository root.

Container Registry

In a multi-service repository, each service gets its own registry path:

CI_REGISTRY_IMAGE/frontend    → lab.xmonetize.net:5050/group/project/frontend
CI_REGISTRY_IMAGE/backend     → lab.xmonetize.net:5050/group/project/backend
CI_REGISTRY_IMAGE/worker      → lab.xmonetize.net:5050/group/project/worker

For a single-service repository, no suffix is added:

CI_REGISTRY_IMAGE             → lab.xmonetize.net:5050/group/project

CI Pipeline

For multi-service, use hive ci --global:

hive ci --global

This generates a pipeline with separate build/test/deploy jobs for each service:

build-frontend → test-frontend → deploy-frontend
build-backend  → test-backend  → deploy-backend
build-worker   → test-worker   → deploy-worker

More details in CI/CD Integration.

Example: hive-examples

The hive-examples repository contains three services:

hive-examples/
  .gitlab-ci.yml
  helloworld-go/
    .hive.yml              # name: helloworld-go
    main.go
  helloworld-python/
    .hive.yml              # name: helloworld-python
    app.py
  helloworld-dotnet/
    .hive.yml              # name: helloworld-dotnet
    Program.cs
    helloworld-dotnet.csproj

Each deploys independently and gets its own URL:

  • https://helloworld-go.hive-examples.knative-staging.svcik.org
  • https://helloworld-python.hive-examples.knative-staging.svcik.org
  • https://helloworld-dotnet.hive-examples.knative-staging.svcik.org