Skip to content

feat: Implement Git Tag-Driven Version Management System #159

Closed

Description

@larryro

Problem Statement

Manual deployment process makes it difficult to track which version each client is running, leading to confusion when managing upgrades across multiple clients.

Current State

  • CI/CD workflows already build images to GHCR on git tags
  • Blue-green deployment script exists (scripts/deploy.sh)
  • No unified version identification system

Proposed Solution

Git Tag-Driven Version Management + Health Endpoint + One-Click Upgrade Script

Core approach:

  1. Version numbers derived entirely from Git tags (no manual file maintenance)
  2. CI automatically injects version from tag into Docker images
  3. Running services report their version via /api/health endpoint
  4. Modify existing compose.yml to support both build and pull modes via pull_policy
  5. Provide one-click upgrade script for simplified client operations

Affected Components

  • All Dockerfiles (7 services) - Add VERSION build argument
  • CI workflows (build-and-push-*.yml) - Pass VERSION to builds
  • compose.yml, compose.blue.yml, compose.green.yml - Add image and pull_policy
  • scripts/deploy.sh - Add version display functionality
  • scripts/upgrade.sh - New one-click upgrade script
  • services/platform/app/api/health/route.ts - Return version info
  • .github/workflows/release.yml - New unified release workflow

Acceptance Criteria

  • Running git tag v1.0.0 && git push origin v1.0.0 triggers CI to build all 7 service images
  • All images are tagged with the version number in GHCR
  • docker compose up defaults to local build (development mode)
  • PULL_POLICY=always VERSION=v1.0.0 docker compose up pulls from GHCR
  • /api/health endpoint returns version information
  • ./scripts/deploy.sh status displays current running version
  • ./scripts/upgrade.sh v1.0.0 performs complete upgrade workflow
  • Rollback works via ./scripts/deploy.sh rollback or ./scripts/upgrade.sh <old-version>

🤖 Generated with Claude Code

Activity

  1. larryro commented on Jan 9, 2026

    @larryro
    ContributorAuthor

    Implementation Plan

    Step 1: Inject Version into Docker Images

    Add version build argument to each service's Dockerfile:

    ARG VERSION=dev
    ENV TALE_VERSION=${VERSION}

    Files to modify:

    • services/platform/Dockerfile
    • services/rag/Dockerfile
    • services/crawler/Dockerfile
    • services/db/Dockerfile
    • services/graph-db/Dockerfile
    • services/proxy/Dockerfile
    • services/search/Dockerfile

    Step 2: Update CI Workflows to Pass Version

    Modify existing build-and-push-*.yml workflows to pass git tag as VERSION:

    - name: Build and push
      uses: docker/build-push-action@v6
      with:
        build-args: |
          VERSION=${{ github.ref_name }}

    Step 3: Version Health Endpoint

    Add/enhance /api/health endpoint in Platform service:

    {
      "status": "ok",
      "version": "v1.0.0"
    }

    Version is read from TALE_VERSION environment variable.

    Step 4: Unified Release Workflow

    Create .github/workflows/release.yml:

    • Triggers on v*.*.* tags
    • Builds all 7 service images in parallel
    • All images tagged with the same version number

    Step 5: Modify Existing compose.yml

    Add image and pull_policy to support both build and pull modes:

    services:
      platform:
        image: ghcr.io/tale-project/tale/tale-platform:${VERSION:-latest}
        pull_policy: ${PULL_POLICY:-build}
        build:
          context: .
          dockerfile: services/platform/Dockerfile

    pull_policy values:

    • build - Always build locally (dev mode default)
    • always - Always pull from registry (production mode)

    Apply same changes to compose.blue.yml and compose.green.yml.

    Step 6: Upgrade Script

    Create scripts/upgrade.sh:

    #!/bin/bash
    # Usage: ./scripts/upgrade.sh <version>
    
    set -euo pipefail
    VERSION="${1:-}"
    
    if [[ -z "$VERSION" ]]; then
        echo "Usage: ./scripts/upgrade.sh <version>"
        exit 1
    fi
    
    echo "=== Tale Upgrade to $VERSION ==="
    ./scripts/deploy.sh status
    
    echo "Pulling images and deploying..."
    PULL_POLICY=always VERSION=$VERSION ./scripts/deploy.sh deploy
    
    echo "Upgrade complete!"
    ./scripts/deploy.sh status

    Step 7: Enhance Deploy Script

    Add to scripts/deploy.sh:

    • status command displays current running version via health endpoint
    • Support VERSION and PULL_POLICY environment variables

    Files Summary

    File Action Purpose
    compose.yml Modify Add image field and pull_policy
    compose.blue.yml Modify Add image field and pull_policy
    compose.green.yml Modify Add image field and pull_policy
    .github/workflows/release.yml Create Unified release workflow
    .github/workflows/build-and-push-*.yml Modify Add VERSION build argument
    scripts/upgrade.sh Create One-click upgrade script
    scripts/deploy.sh Modify Add version display functionality
    services/*/Dockerfile Modify Add VERSION build argument
    services/platform/app/api/health/route.ts Create/Modify Return version info

    Workflow After Implementation

    Release New Version

    git tag v1.0.0
    git push origin v1.0.0

    Client Upgrade

    ./scripts/upgrade.sh v1.0.0

    Check Version

    ./scripts/deploy.sh status
    # or
    curl https://customer-domain.com/api/health

    Rollback

    ./scripts/deploy.sh rollback
    # or
    ./scripts/upgrade.sh v0.9.0

    Testing Strategy

    1. Create test tag v0.0.1-test, verify CI builds all images
    2. Verify docker compose up defaults to local build (dev mode)
    3. Verify PULL_POLICY=always VERSION=v0.0.1-test docker compose up pulls remote images
    4. Verify /api/health returns correct version
    5. Test ./scripts/upgrade.sh v0.0.1-test complete upgrade flow

    🤖 Generated with Claude Code

  2. larryro commented on Jan 9, 2026

    @larryro
    ContributorAuthor

    Additional: Private GHCR Authentication

    Since the GitHub Container Registry is private, client servers need authentication to pull images.

    One-Time Setup on Each Client Server

    1. Create a Personal Access Token (PAT) with read:packages scope:

      • GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
      • Select scope: read:packages
      • Copy the generated token
    2. Login to GHCR on the client server:

      echo $GHCR_TOKEN | docker login ghcr.io -u <github-username> --password-stdin

      Or interactively:

      docker login ghcr.io -u <github-username>
      # Enter PAT as password when prompted
    3. Verify authentication:

      docker pull ghcr.io/tale-project/tale/tale-platform:latest

    Notes

    • Credentials are stored in ~/.docker/config.json and persist across reboots
    • Use a dedicated bot account or service account for production
    • PAT only needs read:packages scope (read-only, minimal permissions)
    • Consider adding this step to client onboarding documentation

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions