# Batch 3 Implementation Checklist

Use this checklist to track the migration of tbi-acc-cron-service and tbi-acc-package-cron.

## Pre-Migration Verification

- [ ] Verify source repositories exist and are accessible
  - [ ] ~/Desktop/git-code/tbi-code/tbi-acc-cron-service
  - [ ] ~/Desktop/git-code/tbi-code/tbi-acc-package-cron
- [ ] Verify tbi-environments repository is accessible
- [ ] Verify CircleCI organization access
- [ ] Verify AWS credentials for dev and prod accounts
- [ ] Review existing Jenkins pipelines to understand current deployment

## Service 1: tbi-acc-cron-service

### Phase 1: Copy Files to Service Repository
- [ ] Navigate to service repository
- [ ] Create circleci-migration branch
- [ ] Copy .circleci/ directory
- [ ] Copy docker/ directory
- [ ] Copy scripts/ directory
- [ ] Copy charts/ directory
- [ ] Set executable permissions on scripts
- [ ] Review copied files
- [ ] Commit changes
- [ ] Push to GitHub

### Phase 2: Configure tbi-environments (dev)
- [ ] Create dev/values/tbi-acc-cron-service.yaml
- [ ] Set ingress_enabled: false
- [ ] Set group: access
- [ ] Set port: 80, targetPort: 8000
- [ ] Configure resource limits
- [ ] Configure autoscaling
- [ ] Create dev/secrets/secrets.tbi-acc-cron-service.yaml
- [ ] Add APP_ENV, APP_DEBUG
- [ ] Add database credentials (if needed)
- [ ] Add API keys and secrets
- [ ] Encrypt secrets with SOPS
- [ ] Update dev/requirements.yaml
- [ ] Commit and push to tbi-environments

### Phase 3: Configure tbi-environments (uat)
- [ ] Create uat/values/tbi-acc-cron-service.yaml
- [ ] Update node_env to uat
- [ ] Create uat/secrets/secrets.tbi-acc-cron-service.yaml
- [ ] Update secrets for UAT environment
- [ ] Encrypt secrets with SOPS
- [ ] Update uat/requirements.yaml
- [ ] Commit and push to tbi-environments

### Phase 4: Test dev Deployment
- [ ] Merge circleci-migration to dev branch
- [ ] Push to GitHub
- [ ] Monitor CircleCI pipeline
- [ ] Verify lint-and-test job passes
- [ ] Verify build-and-push job completes
- [ ] Verify deploy-to-k8s job succeeds
- [ ] Check pod status: `kubectl get pods -n access -l app=tbi-acc-cron-service`
- [ ] Check pod logs: `kubectl logs -n access -l app=tbi-acc-cron-service`
- [ ] Verify application functionality
- [ ] Check resource usage
- [ ] Verify autoscaling configuration

### Phase 5: Deploy to UAT
- [ ] Merge dev to uat branch
- [ ] Push to GitHub
- [ ] Monitor CircleCI pipeline
- [ ] Verify deployment to UAT cluster
- [ ] Check pod status in UAT
- [ ] Check pod logs in UAT
- [ ] Verify application functionality in UAT
- [ ] Perform UAT testing

### Phase 6: Cleanup
- [ ] Disable Jenkins pipeline for tbi-acc-cron-service
- [ ] Archive Jenkins configuration
- [ ] Update team documentation
- [ ] Notify team of migration completion

## Service 2: tbi-acc-package-cron

### Phase 1: Copy Files to Service Repository
- [ ] Navigate to service repository
- [ ] Create circleci-migration branch
- [ ] Copy .circleci/ directory
- [ ] Copy docker/ directory
- [ ] Copy scripts/ directory
- [ ] Copy charts/ directory
- [ ] Set executable permissions on scripts
- [ ] Review copied files
- [ ] Commit changes
- [ ] Push to GitHub

### Phase 2: Configure tbi-environments (dev)
- [ ] Create dev/values/tbi-acc-package-cron.yaml
- [ ] Set ingress_enabled: false
- [ ] Set group: access
- [ ] Set port: 80, targetPort: 80
- [ ] Configure resource limits (higher for Oracle)
- [ ] Configure autoscaling
- [ ] Create dev/secrets/secrets.tbi-acc-package-cron.yaml
- [ ] Add ORACLE_HOST, ORACLE_PORT, ORACLE_SID
- [ ] Add ORACLE_USER, ORACLE_PASSWORD
- [ ] Add MySQL credentials (if needed)
- [ ] Encrypt secrets with SOPS
- [ ] Update dev/requirements.yaml
- [ ] Commit and push to tbi-environments

### Phase 3: Configure tbi-environments (prod)
- [ ] Create prod/values/tbi-acc-package-cron.yaml
- [ ] Update node_env to production
- [ ] Adjust resource limits for production
- [ ] Create prod/secrets/secrets.tbi-acc-package-cron.yaml
- [ ] Update Oracle credentials for production
- [ ] Update MySQL credentials for production
- [ ] Encrypt secrets with SOPS (use prod KMS key)
- [ ] Update prod/requirements.yaml
- [ ] Commit and push to tbi-environments

### Phase 4: Test dev Deployment
- [ ] Merge circleci-migration to dev branch
- [ ] Push to GitHub
- [ ] Monitor CircleCI pipeline
- [ ] Verify build-and-push job completes (Oracle client build)
- [ ] Verify deploy-to-k8s job succeeds
- [ ] Check pod status: `kubectl get pods -n access -l app=tbi-acc-package-cron`
- [ ] Check pod logs: `kubectl logs -n access -l app=tbi-acc-package-cron`
- [ ] Verify Oracle connectivity
- [ ] Test cron scripts functionality
- [ ] Check resource usage
- [ ] Verify autoscaling configuration

### Phase 5: Deploy to Production
- [ ] Review production deployment plan
- [ ] Schedule maintenance window (if needed)
- [ ] Merge dev to prod branch
- [ ] Push to GitHub
- [ ] Monitor CircleCI pipeline
- [ ] Verify deployment to prod cluster
- [ ] Check pod status in production
- [ ] Check pod logs in production
- [ ] Verify Oracle connectivity in production
- [ ] Test cron scripts in production
- [ ] Monitor for errors
- [ ] Verify scheduled jobs run correctly

### Phase 6: Cleanup
- [ ] Disable Jenkins pipeline for tbi-acc-package-cron
- [ ] Archive Jenkins configuration
- [ ] Update team documentation
- [ ] Notify team of migration completion

## Post-Migration Verification

### Both Services
- [ ] Verify all pods are running and healthy
- [ ] Verify no CrashLoopBackOff errors
- [ ] Check application logs for errors
- [ ] Verify resource usage is within limits
- [ ] Test rollback procedure
- [ ] Verify autoscaling works correctly
- [ ] Check Helm release status
- [ ] Verify secrets are properly encrypted
- [ ] Test manual deployment procedure

### Monitoring
- [ ] Set up alerts for pod failures
- [ ] Set up alerts for high resource usage
- [ ] Monitor application logs
- [ ] Monitor CircleCI pipeline success rate
- [ ] Track deployment frequency

### Documentation
- [ ] Update team wiki with new deployment process
- [ ] Document CircleCI pipeline structure
- [ ] Document rollback procedures
- [ ] Document troubleshooting steps
- [ ] Share migration summary with team

## Rollback Plan

### If Issues Occur in Dev/UAT
- [ ] Identify the issue
- [ ] Check pod logs
- [ ] Check CircleCI logs
- [ ] Rollback Helm release: `helm rollback <service> -n access`
- [ ] Or revert git commit and redeploy
- [ ] Fix issue in circleci-migration branch
- [ ] Retest

### If Issues Occur in Production
- [ ] Immediately rollback Helm release
- [ ] Verify old version is running
- [ ] Notify team of rollback
- [ ] Investigate issue in dev environment
- [ ] Fix and retest before redeploying to prod

## Success Criteria

### Technical
- [ ] CircleCI pipelines run successfully
- [ ] Docker images build without errors
- [ ] Helm charts deploy successfully
- [ ] Pods are running and healthy
- [ ] Application logs show no errors
- [ ] Health checks pass
- [ ] Resource usage is acceptable
- [ ] Autoscaling works correctly

### Operational
- [ ] Deployments are faster than Jenkins
- [ ] Team can deploy independently
- [ ] Rollback procedure works
- [ ] Documentation is complete
- [ ] Team is trained on new process

### Business
- [ ] No downtime during migration
- [ ] Application functionality unchanged
- [ ] Cron jobs run on schedule
- [ ] Data integrity maintained
- [ ] Performance is acceptable

## Timeline

| Phase | Service 1 | Service 2 | Total |
|-------|-----------|-----------|-------|
| Copy files | 5 min | 5 min | 10 min |
| Configure dev | 10 min | 10 min | 20 min |
| Test dev | 10 min | 10 min | 20 min |
| Configure uat/prod | 10 min | 10 min | 20 min |
| Deploy uat/prod | 5 min | 5 min | 10 min |
| **Total** | **40 min** | **40 min** | **80 min** |

## Notes

- Use `docs/CRON-SERVICES-QUICK-START.md` for detailed commands
- Use `scripts/migrate-cron-services.sh` to automate file copying
- Test in dev/uat before deploying to production
- Keep Jenkins pipelines active until CircleCI is proven stable
- Monitor closely for first 24 hours after migration

## Contacts

- DevOps Team: [contact info]
- CircleCI Support: [contact info]
- AWS Support: [contact info]

## Sign-off

- [ ] Migration completed by: _________________ Date: _______
- [ ] Verified by: _________________ Date: _______
- [ ] Approved by: _________________ Date: _______

---

**Document Version**: 1.0
**Last Updated**: March 6, 2026
**Services**: tbi-acc-cron-service, tbi-acc-package-cron
