Skip to content

API Deployment

Daniel Truong edited this page Feb 28, 2026 · 4 revisions

eagle-api Deployment Guide

Status: As of February 2026, eagle-api has been fully migrated to Helm-based deployments in all environments (dev, test, prod).

For current deployment procedures, see:

Production Migration Completed: February 28, 2026

  • Migrated from DeploymentConfig to Helm-managed Deployment
  • Zero-downtime deployment with PodDisruptionBudget and rolling updates
  • Database (eagle-api-mongodb) remains on legacy DeploymentConfig (not touched)
  • All routing flows through rproxy Helm deployment
  • Latest Deployment: v2.1.1 deployed successfully to all environments (Feb 28, 2026)

Current Production Architecture

Production Resources (6cdc9e-prod)

Resource Type Status Management
eagle-api Deployment ✅ Active Helm
eagle-api-mongodb DeploymentConfig ✅ Active Legacy (protected)
rproxy Deployment ✅ Active Helm
eagle-admin DeploymentConfig ✅ Active Legacy
eagle-public DeploymentConfig ✅ Active Legacy

Production URL: https://projects.eao.gov.bc.ca/api


Legacy Deployment Documentation

The information below describes the legacy deployment approach used before the Helm migration. Retained for historical reference and troubleshooting older environments.

OpenShift Infrastructure

Namespaces (License Plate: 6cdc9e)

The platform operates across 4 OpenShift namespaces:

Namespace Purpose Trigger Image Tag
6cdc9e-tools Build configurations, ImageStreams, CI/CD - latest
6cdc9e-dev Development environment Push to develop branch dev
6cdc9e-test QA/Testing environment Manual workflow_dispatch test
6cdc9e-prod Production environment Manual workflow_dispatch prod

Cluster Information

  • Platform: OpenShift 4.14+ (Silver cluster)
  • Domain: apps.silver.devops.gov.bc.ca
  • Registry: image-registry.openshift-image-registry.svc:5000
  • Routes:
    • Dev: https://eagle-dev.apps.silver.devops.gov.bc.ca/api
    • Test: https://eagle-test.apps.silver.devops.gov.bc.ca/api
    • Prod: https://eagle.gov.bc.ca/api

Deployment Architecture

┌──────────────────────────────────────────────────────────────┐
│  GitHub Repository                                           │
│    - Source code                                             │
│    - Dockerfile                                              │
│    - GitHub Actions workflows                                │
└──────────────────────────────────────────────────────────────┘
                            │
                            │ git push to develop
                            ▼
┌──────────────────────────────────────────────────────────────┐
│  GitHub Actions (CI/CD)                                      │
│    1. Build Docker image                                     │
│    2. Tag: <sha>, dev, latest                                │
│    3. Push to OpenShift registry                             │
│    4. Deploy via oc rollout or image tag                     │
└──────────────────────────────────────────────────────────────┘
                            │
                            │ Image pushed
                            ▼
┌──────────────────────────────────────────────────────────────┐
│  OpenShift Registry (6cdc9e-tools)                           │
│    - ImageStreams for all services                           │
│    - Tags: latest, dev, test, prod, <sha>                    │
└──────────────────────────────────────────────────────────────┘
                            │
                            │ ImageStream tag updated
                            ▼
┌──────────────────────────────────────────────────────────────┐
│  OpenShift Deployment (6cdc9e-dev/test/prod)                │
│    - DeploymentConfig watches ImageStream                    │
│    - Auto-triggers on ImageStream change                     │
│    - Rolling update strategy                                 │
└──────────────────────────────────────────────────────────────┘

GitHub Actions Workflows

1. Dev Environment (Automatic)

Trigger: Push to develop branch
File: .github/workflows/build_and_promote.yaml

on:
  push:
    branches:
      - develop
  workflow_dispatch:

Process:

  1. Builds Docker image
  2. Tags image with commit SHA and dev
  3. Pushes to OpenShift image registry in 6cdc9e-tools
  4. DeploymentConfig in 6cdc9e-dev auto-triggers on dev tag update
  5. Rolling update deploys new pods

URL: https://eagle-dev.apps.silver.devops.gov.bc.ca/api

2. Test Environment (Manual)

Trigger: Manual via GitHub Actions UI
File: .github/workflows/deploy-to-test.yaml

on:
  workflow_dispatch:
    inputs:
      image_tag:
        description: 'Image tag to deploy (default: dev)'
        required: false
        default: 'dev'

Process:

  1. Go to Actions → "Deploy to Test" → "Run workflow"
  2. Enter image tag (default: dev) or specific commit SHA
  3. Workflow tags image as test in OpenShift:
    oc tag 6cdc9e-tools/eagle-api:dev 6cdc9e-tools/eagle-api:test
  4. DeploymentConfig in 6cdc9e-test auto-triggers

URL: https://eagle-test.apps.silver.devops.gov.bc.ca/api

3. Prod Environment (Manual)

Trigger: Manual via GitHub Actions UI
File: .github/workflows/deploy-to-prod.yaml

on:
  workflow_dispatch:
    inputs:
      image_tag:
        description: 'Image tag to deploy (default: test)'
        required: false
        default: 'test'

Process:

  1. Go to Actions → "Deploy to Prod" → "Run workflow"
  2. Enter image tag (default: test) or specific commit SHA
  3. Workflow tags image as prod in OpenShift:
    oc tag 6cdc9e-tools/eagle-api:test 6cdc9e-tools/eagle-api:prod
  4. DeploymentConfig in 6cdc9e-prod auto-triggers

URL: https://eagle.gov.bc.ca/api

Deployment Flow Example

# 1. Push to develop → auto-builds and tags as dev with SHA abc1234
git push origin develop

# Wait for GitHub Actions to complete (builds and deploys to dev)

# 2. Manually promote to test (via GitHub UI)
#    - Go to: https://github.com/bcgov/eagle-api/actions
#    - Select "Deploy to Test" workflow
#    - Click "Run workflow"
#    - Input: abc1234 (or leave default "dev")
#    - Click "Run workflow" button

# Wait for test deployment to complete

# 3. Manually promote to production (via GitHub UI)
#    - Go to: https://github.com/bcgov/eagle-api/actions
#    - Select "Deploy to Prod" workflow
#    - Click "Run workflow"
#    - Input: abc1234 (or leave default "test")
#    - Click "Run workflow" button

Image Tagging Strategy

eagle-api uses OpenShift image tagging for deployments:

# Dev build creates image with SHA in tools namespace
image-registry.openshift-image-registry.svc:5000/6cdc9e-tools/eagle-api:abc1234
image-registry.openshift-image-registry.svc:5000/6cdc9e-tools/eagle-api:dev

# Tag for test deployment
oc tag 6cdc9e-tools/eagle-api:dev 6cdc9e-tools/eagle-api:test

# Tag for prod deployment
oc tag 6cdc9e-tools/eagle-api:test 6cdc9e-tools/eagle-api:prod

Image Tag Purpose

Tag Purpose Mutable
<sha> Specific commit (e.g., abc1234) ❌ Immutable
dev Latest dev deployment ✅ Mutable
test Latest test deployment ✅ Mutable
prod Latest prod deployment ✅ Mutable
latest Most recent build ✅ Mutable

DeploymentConfig Configuration

eagle-api uses DeploymentConfig (OpenShift 3.x pattern, still in use):

apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  name: eagle-api
  namespace: 6cdc9e-dev
spec:
  replicas: 2
  selector:
    app: eagle-api
  strategy:
    type: Rolling
    rollingParams:
      timeoutSeconds: 600
      maxUnavailable: 1
      maxSurge: 1
  triggers:
    - type: ImageChange
      imageChangeParams:
        automatic: true
        containerNames:
          - eagle-api
        from:
          kind: ImageStreamTag
          namespace: 6cdc9e-tools
          name: 'eagle-api:dev'
  template:
    spec:
      containers:
        - name: eagle-api
          image: ' '  # Updated by trigger
          ports:
            - containerPort: 3000
          env:
            - name: MONGODB_URI
              valueFrom:
                secretKeyRef:
                  name: eagle-api-secrets
                  key: MONGODB_URI
          # ... other env vars

Key Points:

  • triggers.imageChangeParams.automatic: true enables auto-deployment
  • from.name: 'eagle-api:dev' watches the dev tag in tools namespace
  • When dev tag is updated, DeploymentConfig triggers a rolling update

Environment Variables

eagle-api requires environment variables for configuration:

Variable Description Source
MONGODB_URI MongoDB connection string Secret
KEYCLOAK_URL Keycloak SSO server URL ConfigMap
KEYCLOAK_REALM Keycloak realm name ConfigMap
KEYCLOAK_CLIENT_ID Keycloak client ID ConfigMap
KEYCLOAK_CLIENT_SECRET Keycloak client secret Secret
S3_ENDPOINT S3/Minio endpoint ConfigMap
S3_ACCESS_KEY S3 access key Secret
S3_SECRET_KEY S3 secret key Secret
ENVIRONMENT Environment name (dev/test/prod) ConfigMap
API_LOCATION Base API URL ConfigMap
ANALYTICS_API_URL Analytics service URL ConfigMap

Secrets vs ConfigMaps

Secrets (base64-encoded):

  • Database credentials
  • API keys
  • Keycloak client secrets

ConfigMaps (plain text):

  • Service URLs
  • Feature flags
  • Non-sensitive configuration

Rollback Procedures

Rollback via OpenShift CLI

# Login to OpenShift
oc login --token=<token> --server=https://api.silver.devops.gov.bc.ca:6443

# Switch to target namespace
oc project 6cdc9e-test

# View deployment history
oc rollout history dc/eagle-api

# Rollback to previous version
oc rollout undo dc/eagle-api

# Rollback to specific revision
oc rollout undo dc/eagle-api --to-revision=5

Rollback via Image Retagging

# Find the specific SHA you want to rollback to
oc describe is/eagle-api -n 6cdc9e-tools

# Retag that specific SHA as test
oc tag 6cdc9e-tools/eagle-api:abc1234 6cdc9e-tools/eagle-api:test

# DeploymentConfig will auto-trigger with the older image

Monitoring

Health Checks

eagle-api exposes health endpoints:

# Liveness probe
curl https://eagle-dev.apps.silver.devops.gov.bc.ca/api/health

# Readiness probe
curl https://eagle-dev.apps.silver.devops.gov.bc.ca/api/ready

Pod Status

# View pod status
oc get pods -n 6cdc9e-dev -l app=eagle-api

# View logs
oc logs -f deployment/eagle-api -n 6cdc9e-dev

# View events
oc get events -n 6cdc9e-dev --sort-by='.lastTimestamp'

Troubleshooting

See Troubleshooting for common issues and solutions.

Related Pages

Clone this wiki locally