9.7 KiB
GitHub Actions Setup Guide
Quick setup guide to enable GitHub Actions CI/CD for VAPORA provisioning.
5-Minute Setup
Step 1: Enable GitHub Actions
- Go to repository Settings
- Navigate to "Actions" → "General"
- Select "Allow all actions and reusable workflows"
- Set "Workflow permissions" to "Read and write permissions"
- Save changes
Step 2: Add Required Secrets
Go to Settings → Secrets and variables → Actions → New repository secret
Kubernetes Kubeconfigs (Required for K8s deployments)
# Get kubeconfig and encode as base64
cat ~/.kube/config | base64
# Create these secrets:
# KUBE_CONFIG_STAGING (for staging cluster)
# KUBE_CONFIG_PRODUCTION (for production cluster)
For CI/Test Cluster (Optional):
- Secret name:
KUBE_CONFIG_CI - Value: Base64-encoded kubeconfig
Slack Webhooks (Optional, for notifications)
SLACK_WEBHOOK # For general notifications
SLACK_WEBHOOK_ALERTS # For critical alerts
Docker Registry (Optional, for image pushes)
DOCKER_USERNAME # Docker Hub username
DOCKER_PASSWORD # Docker Hub access token
Step 3: Verify Setup
-
Go to Actions tab
-
You should see 5 workflows listed:
- ✓ Validate & Build Artifacts
- ✓ Deploy to Docker
- ✓ Deploy to Kubernetes
- ✓ Health Check & Monitoring
- ✓ Rollback Deployment
-
Click on "Validate & Build Artifacts"
-
Click "Run workflow" → "Run workflow"
-
Wait for completion (should take ~5 minutes)
Step 4: Download Artifacts
- Go to the completed workflow run
- Scroll down to "Artifacts"
- Download
deployment-artifacts - Extract and review generated files
Detailed Setup
Configure Kubernetes Access
1. Staging Cluster
# Get kubeconfig context for staging
kubectl config view --minify --flatten --context=staging-context > staging-kubeconfig.yaml
# Encode for GitHub
cat staging-kubeconfig.yaml | base64
# Create secret KUBE_CONFIG_STAGING with the base64 output
2. Production Cluster
# Get kubeconfig context for production
kubectl config view --minify --flatten --context=prod-context > prod-kubeconfig.yaml
# Encode for GitHub
cat prod-kubeconfig.yaml | base64
# Create secret KUBE_CONFIG_PRODUCTION with the base64 output
3. Verify Kubeconfig
# Test decoding
echo $KUBE_CONFIG_STAGING | base64 -d | kubectl cluster-info
# Should output cluster information if valid
Configure Slack Integration
1. Create Slack App
- Go to api.slack.com/apps
- Click "Create New App" → "From scratch"
- App Name:
vapora-deployments - Workspace: Select your workspace
- Click "Create App"
2. Enable Incoming Webhooks
- Click "Incoming Webhooks" from left menu
- Toggle "Activate Incoming Webhooks" to ON
- Click "Add New Webhook to Workspace"
- Select channel:
#deployments - Click "Allow"
- Copy the webhook URL
3. Create Alert Webhook
- Back on Incoming Webhooks page
- Click "Add New Webhook to Workspace"
- Select channel:
#alerts - Click "Allow"
- Copy the webhook URL
4. Store Webhooks in GitHub
Create these secrets:
SLACK_WEBHOOK= General notifications webhookSLACK_WEBHOOK_ALERTS= Critical alerts webhook
Configure Docker Registry (Optional)
1. Generate Docker Access Token
- Go to hub.docker.com
- Click your profile → Account settings
- Navigate to "Security" → "Access Tokens"
- Click "New Access Token"
- Name:
github-actions - Copy the token
2. Store in GitHub
Create these secrets:
DOCKER_USERNAME= Your Docker Hub usernameDOCKER_PASSWORD= The access token
Branch Protection Rules (Recommended)
Protect Main Branch
- Go to Settings → Branches
- Click "Add rule"
- Branch name pattern:
main - Enable:
- ✓ Require a pull request before merging
- ✓ Require status checks to pass
- ✓ Require branches to be up to date
- ✓ Include administrators
- Save changes
Protect Develop Branch
- Add new rule
- Branch name pattern:
develop - Enable:
- ✓ Require a pull request before merging
- ✓ Require status checks to pass
- Save changes
First Deployment Walkthrough
1. Create Feature Branch
git checkout -b feature/test-deployment
2. Make a Small Change
# Edit a configuration file
echo "# Test" >> provisioning/schemas/platform/README.md
git add provisioning/
git commit -m "test: trigger validation workflow"
git push origin feature/test-deployment
3. Watch Validation
- Go to Actions tab
- See "Validate & Build Artifacts" running
- Wait for completion (~5 minutes)
- Verify no errors
4. Download Artifacts
- Click the completed workflow
- Scroll to Artifacts
- Download
deployment-artifacts - Extract and verify contents
5. Test Docker Deployment
- Extract artifacts
- Go to Actions → Deploy to Docker
- Click "Run workflow"
- Inputs:
- mode:
multiuser - dry_run:
true - environment:
development
- mode:
- Click "Run workflow"
- Monitor the run
- Verify Docker Compose validates
6. Test Kubernetes Deployment (Dry-run)
- Go to Actions → Deploy to Kubernetes
- Click "Run workflow"
- Inputs:
- mode:
multiuser - dry_run:
true - environment:
staging
- mode:
- Click "Run workflow"
- Monitor execution
- Verify manifests are valid
7. Create Pull Request
# Push and create PR
git push origin feature/test-deployment
# Or go to GitHub and create PR from UI
Monitoring Your Deployments
Via GitHub Actions UI
- Go to Actions tab
- Select workflow to view
- Click specific run to see details
- Scroll to see jobs and logs
- Download artifacts for review
Via Slack
Messages will appear in:
#deployments- General notifications#alerts- Critical failures only
Via CLI
# View logs for a specific deployment
kubectl logs -f deployment/vapora-backend -n vapora
# Check deployment status
kubectl get deployments -n vapora
# View events
kubectl get events -n vapora --sort-by='.lastTimestamp'
Common Tasks
Validate a Configuration Change
- Make changes to provisioning/schemas/
- Push to feature branch
- Validate & Build runs automatically
- Review logs and artifacts
- No manual steps needed
Deploy to Staging
- Create PR with provisioning changes
- Get code review
- Merge to develop
- Go to Actions → Deploy to Kubernetes
- Run workflow with:
- mode: your choice
- environment: staging
- dry_run: true (first)
- Review dry-run output
- Run again with dry_run: false
Deploy to Production
- Create PR to main (from develop)
- Get required reviews
- All status checks must pass
- Merge to main
- Run Validate & Build (should pass)
- Go to Actions → Deploy to Kubernetes
- Run workflow with:
- mode: your choice
- environment: production
- dry_run: true
- Carefully review all changes
- Run again with dry_run: false
- Monitor health checks
Check System Health
- Go to Actions → Health Check & Monitoring
- Click "Run workflow"
- Select target and count
- Monitor execution
- Review health report in artifacts
Rollback a Deployment
- Go to Actions → Rollback Deployment
- Click "Run workflow"
- Select:
- target: kubernetes or docker
- environment: staging or production
- deployment: all or specific service
- revision: 0 (for previous) or number
- Click "Run workflow"
- Monitor execution
- Review rollback report
Troubleshooting
Workflow Not Appearing
Problem: Don't see workflows in Actions tab
Solution:
- Ensure .github/workflows/*.yml files are committed
- Push to main branch
- Wait 1-2 minutes
- Refresh GitHub Actions page
Secret Not Found Error
Problem: Workflow fails with "Secret not found"
Solution:
- Verify secret exists in Settings → Secrets
- Check spelling matches exactly (case-sensitive)
- Ensure secret value is not empty
- For kubeconfig, verify it's valid base64
Kubeconfig Decode Error
Problem: Kubeconfig fails to decode
Solution:
# Test decode locally first
echo $KUBE_CONFIG_VALUE | base64 -d | kubectl cluster-info
# If it fails, re-encode:
cat ~/.kube/config | base64 | pbcopy # macOS
cat ~/.kube/config | base64 # Linux
# Then update the secret with fresh base64
Health Check Fails on First Run
Problem: Health check fails when no services deployed yet
Solution:
- This is normal on first run
- Deploy with Deploy to Kubernetes or Deploy to Docker first
- Then run health check
- Health check will work after services are running
Deployment Timeout
Problem: Workflow times out waiting for pod readiness
Solution:
- Check pod logs:
kubectl logs -n vapora <pod> - Check pod description:
kubectl describe pod -n vapora <pod> - Increase
rollout_timeoutinput (default 300s) - Check resource requests/limits in deployment.yaml
- Verify cluster has sufficient resources
Next Steps
- ✅ Setup workflows (you are here)
- → Run first test deployment
- → Configure Slack notifications
- → Protect main and develop branches
- → Train team on deployment process
- → Monitor health checks
- → Create runbook for incidents
Support
- Workflow Logs: Check Actions → [Workflow] → [Run] → Logs
- Artifacts: Download from Actions → [Workflow] → [Run] → Artifacts
- Issues: Check GitHub Issues for auto-created failure reports
- Slack: Monitor #alerts channel for critical notifications
Next: Read GITHUB_ACTIONS_GUIDE.md for detailed workflow information