CHT 5.0 is here! 🎉 Discover what’s new!
Helm Charts 4.x to 5.x

CHT 4.x to 5.x Helm Charts Migration Guide

Guide to migrate Helm Charts from 4.x to 5.x

Overview

This guide covers the migration of Kubernetes based CHT 4.x deployments using the legacy Helm charts to the updated charts introduced in CHT 5.x. The new Helm chart requires updates to your values.yaml file.

Before starting be sure you have a git clone of the CHT Core repository and that you have updated it with git pull origin to ensure you have the latest changes locally.

Migration Steps

Step 1: Prepare Migration Values File

  1. Export the values from your existing 4.x deployment into the migration-5x-values.yaml file:

    helm get values <your-release-name> --namespace <your-namespace> > migration-5x-values.yaml
  2. Be sure all booleans are unquoted by running these two sed commands which will correct them in the migration-5x-values.yaml file:

    sed -i 's/: "false"/: false/g' migration-5x-values.yaml
    sed -i 's/: "true"/: true/g' migration-5x-values.yaml
  3. Update the migration-5x-values.yaml file to be compliant with 5.x deployment requirements:

    # Change field names - keep the same true/false value from your 4.x deployment
    # Use true for multi-node deployments, false for single-node deployments
    couchdb:
      clusteredCouchEnabled: false  # was: clusteredCouch_enabled: false
    
    # For most migrations, use "preExistingDataAvailable" false. Use true for pre-created volumes for provisioning
    # For most migrations, use "dataPathOnDiskForCouchDB": "data". Double-check this is the correct path.  
    couchdb_data:
      preExistingDataAvailable: false  # Keep using dynamic storage provisioning  
      dataPathOnDiskForCouchDB: "data" # This is the path where couchdb data will be stored. Leave it as data if you don't have pre-existing data.
     # To mount to a specific subpath (If data is from an old 3.x instance for example): dataPathOnDiskForCouchDB: "storage/medic-core/couchdb/data"
     # To mount to the root of the volume: dataPathOnDiskForCouchDB: ""
     # To use the default "data" subpath, remove the subPath line entirely from values.yaml or name it "data" or use null.
    
    # Add required API service configuration
    api:
      service:
        type: ClusterIP
    
    # Upstream server configuration
    upstream_servers:
      docker_registry: "public.ecr.aws/medic" # DEFAULT: Good default
      builds_url: "https://staging.dev.medicmobile.org/_couch/builds_4" # DEFAULT: Good default
    
    # Update image versions to 5.x
    chtversion: 5.0.1
    cht_image_tag: 5.0.1
  4. Depending on the hosting environment, make a final edit to migration-5x-values.yaml file:

couchdb:
  persistent_disk:
    size: <size>  # Set appropriate size for your needs
ebs:
  preExistingEBSVolumeSize: <size>  # Set appropriate size for your needs
couchdb:
  storage_class: local-path  # was: "local-storage"

Step 2: Perform the Migration

  1. Upgrade the helm deployment from the same directory as migration-5x-values.yaml. As well, update /path/to/cht-core to be the location where the CHT Core repo is checked out:

    helm upgrade <your-release-name> /path/to/cht-core/scripts/build/helm \
      -f migration-5x-values.yaml \
      --namespace <your-namespace>
  2. Monitor the upgrade:

    helm status <your-release-name> --namespace <your-namespace>
    kubectl get pods--namespace <your-namespace>

Step 3: Verify Migration Success

  1. Check pod status:

    kubectl get pods -n <your-namespace>
  2. Verify new 5.x components:

    # Look for the new couchdb-nouveau component
    kubectl get pods --namespace <your-namespace> | grep nouveau
  3. Test data integrity

  4. Test application access

Best Practices

  1. Test First: Always test migrations in a non-production environment
  2. Backup Data: Ensure complete data backup before migration
  3. Monitor Closely: Watch deployment logs and metrics during migration
  4. Document Changes: Keep track of any custom configurations
  5. Plan Downtime: Schedule migrations during maintenance windows

Breaking Changes Reference

Change TypeOld (4.x)New (5.x)PlatformImpact
Field RenameclusteredCouch_enabledcouchdb.clusteredCouchEnabledAllCritical
Field Renamelocal.diskPathlocal_storage.preExistingDiskPath-1AllCritical
New Field-api.service.type: ClusterIPAllCritical
Storage ConfigDefault sizescouchdb.couchdb_node_storage_size requiredAllCritical
Storage ConfigDefault sizescouchdb.persistent_disk.size requiredGKECritical
Storage ConfigDefault sizesebs.preExistingEBSVolumeSize requiredEKSCritical
Storage Classlocal-storagelocal-pathK3s-K3dMinor
StructureFlat configNested couchdb configurationAllMedium
Last updated on

Did this documentation help you ?