Skip to content

API Deployment Guide


Current Deployment Process

Deployment is currently a manual process using Visual Studio build and file copy.

Deployment Flow

graph TB
    subgraph DEV["Development"]
        CODE["Source Code<br/>Visual Studio"]
        BUILD["Build Process<br/>Visual Studio Release Build"]
    end

    subgraph DEPLOY["Manual Deployment (One by One)"]
        COPY["Copy Build Files<br/>Manual Copy via RDP/Network Share"]
        API1["API-1: 10.32.8.134"]
        API2["API-2: 10.32.8.135"]
        API3["API-3: 10.32.8.139"]
        API4["API-4: 10.32.8.137"]
        API5["API-5: 10.32.8.35"]
        API6["API-6: 10.32.8.166"]
        API7["API-7: 10.32.8.167"]
    end

    subgraph POOLS["IIS Application Pools"]
        P["43 Pools per Server<br/>301 Total Pools<br/>All use same build"]
    end

    CODE --> BUILD
    BUILD --> COPY
    COPY --> API1 --> P
    COPY --> API2 --> P
    COPY --> API3 --> P
    COPY --> API4 --> P
    COPY --> API5 --> P
    COPY --> API6 --> P
    COPY --> API7 --> P

    style BUILD fill:#FF9800,color:#fff
    style COPY fill:#f44336,color:#fff

Current Process Steps

Step Action Details
1 Build Open solution in Visual Studio, build in Release mode
2 Publish Publish to local folder
3 Copy to Server 1 RDP to API-1 (10.32.8.134), copy files to IIS folder
4 Recycle Pools Recycle all 43 application pools on API-1
5 Verify Test API-1 is working correctly
6 Repeat Repeat steps 3-5 for API-2 through API-7
7 Complete All 7 servers updated (one by one)

Current Limitations

Manual Process Limitations

  • Time Consuming: ~30-45 minutes to deploy to all 7 servers
  • Error Prone: Manual file copying can lead to mistakes
  • No Rollback: No automated way to revert to previous version
  • No Testing: No automated testing before deployment
  • Downtime Risk: Pools recycled during business hours
  • Single Point: One person deploys, no review process

Deployment Checklist

  • Build solution in Release mode
  • Verify build completed without errors
  • Backup current deployment on first server
  • Copy new build to API-1
  • Recycle application pools on API-1
  • Verify API-1 health check passes
  • Repeat for remaining 6 servers
  • Verify all servers in HAProxy are healthy
  • Monitor for errors in logs

Server Details

Server IP IIS Pools Port Range
API-1 10.32.8.134 43 19169-19211
API-2 10.32.8.135 43 19212-19254
API-3 10.32.8.139 43 19255-19297
API-4 10.32.8.137 43 19298-19340
API-5 10.32.8.35 43 19341-19383
API-6 10.32.8.166 43 19384-19426
API-7 10.32.8.167 209 19427-19635

Total Application Pools: 301


Future Plan: CI/CD Pipeline

Planned Implementation

We are planning to implement a fully automated CI/CD pipeline using Jenkins and GitLab to eliminate manual deployment and enable continuous delivery.

Planned CI/CD Architecture

graph LR
    subgraph SOURCE["Source Control"]
        GIT["GitLab Repository"]
    end

    subgraph CI["Continuous Integration"]
        JENKINS["Jenkins Server"]
        BUILD["Automated Build"]
        TEST["Automated Testing<br/>Unit Tests<br/>Integration Tests"]
    end

    subgraph CD["Continuous Deployment"]
        STAGE["Staging Environment"]
        APPROVE["Approval Gate"]
        DEPLOY["Automated Deployment<br/>Rolling Update"]
    end

    subgraph PROD["Production (7 Servers)"]
        API["API Servers<br/>Zero-Downtime Deploy"]
    end

    subgraph ROLLBACK["Safety"]
        REVERT["Automatic Revert<br/>On Failure"]
        MONITOR["Health Monitoring"]
    end

    GIT -->|Push/Merge| JENKINS
    JENKINS --> BUILD
    BUILD --> TEST
    TEST -->|Pass| STAGE
    STAGE --> APPROVE
    APPROVE -->|Approved| DEPLOY
    DEPLOY --> API
    API --> MONITOR
    MONITOR -->|Failure| REVERT
    REVERT --> API

    style JENKINS fill:#D24939,color:#fff
    style GIT fill:#FC6D26,color:#fff
    style TEST fill:#4CAF50,color:#fff
    style REVERT fill:#2196F3,color:#fff

Planned Features

Feature Description Benefit
GitLab Integration Source control with merge requests Code review before deployment
Jenkins Pipeline Automated build on every commit Consistent builds
Automated Testing Unit tests, integration tests Catch bugs before production
Staging Environment Test in staging before production Validate changes safely
Rolling Deployment Deploy to servers one by one Zero-downtime updates
Automatic Revert Rollback on health check failure Quick recovery from bad deploys
Deployment Approval Manual approval gate for production Control over releases
Notifications Slack/Email on deploy status Team awareness

Planned Pipeline Stages

1. CODE COMMIT
   └── Developer pushes to GitLab

2. BUILD
   └── Jenkins pulls code
   └── Restore NuGet packages
   └── Build in Release mode
   └── Create deployment artifact

3. TEST
   └── Run unit tests
   └── Run integration tests
   └── Code quality analysis
   └── Security scanning

4. STAGING
   └── Deploy to staging server
   └── Run smoke tests
   └── Performance testing

5. APPROVAL
   └── Manual approval required
   └── Review test results

6. PRODUCTION DEPLOY
   └── Rolling update to API-1
   └── Health check API-1
   └── Rolling update to API-2
   └── ... continue for all servers
   └── Health check all servers

7. MONITOR
   └── Watch error rates
   └── Watch response times
   └── Auto-revert if issues detected

Rollback Strategy

Trigger Action Time
Health check fails Automatic revert to previous version < 2 min
Error rate > 1% Alert + manual decision Immediate alert
Response time > 5s Alert + investigation Immediate alert
Manual trigger One-click rollback < 5 min

Implementation Timeline

Phase Tasks Status
Phase 1 Setup GitLab repository, migrate code Planned
Phase 2 Setup Jenkins server, create build pipeline Planned
Phase 3 Add automated testing (unit tests) Planned
Phase 4 Setup staging environment Planned
Phase 5 Implement rolling deployment Planned
Phase 6 Add auto-revert capability Planned
Phase 7 Full production CI/CD Planned

Quick Reference

Current Deployment Commands

# On each API server (via RDP)

# 1. Stop all pools (optional - for clean deploy)
Get-IISAppPool | Stop-WebAppPool

# 2. Copy new files
Copy-Item -Path "\\build-server\deploy\*" -Destination "C:\inetpub\wwwroot\XConnect" -Recurse -Force

# 3. Start all pools
Get-IISAppPool | Start-WebAppPool

# 4. Verify health
Invoke-WebRequest -Uri "http://localhost:19169/api/xconnect/healthcheck"

Verify Deployment

# From monitoring server - check all API servers
for ip in 134 135 139 137 35 166 167; do
  echo "Checking 10.32.8.$ip..."
  curl -s "http://10.32.8.$ip:19169/api/xconnect/healthcheck" | head -1
done

Last Updated: 2025-12-02