Skip to main content

Deployment Workflows

Standard deployment processes for FLYPILOT projects across different platforms.

Deployment Environments

Standard Setup

EnvironmentPurposeURL Pattern
DevelopmentDeveloper testingdev.clientsite.com
StagingQA and client reviewstaging.clientsite.com
ProductionLive siteclientsite.com

Environment Parity

Ensure all environments match:

  • Same PHP/Node version
  • Same WordPress/framework version
  • Same plugin/package versions
  • Similar server configuration

WordPress Deployments

WPEngine

Git Push Deployment

# Add WPEngine remote (one-time)
git remote add production git@git.wpengine.com:production/clientsite.git
git remote add staging git@git.wpengine.com:staging/clientsite.git

# Deploy to staging
git push staging main

# Deploy to production
git push production main

Environment Variables

Set in WPEngine dashboard under "Environment Variables":

  • WP_ENVIRONMENT_TYPE
  • GOOGLE_ANALYTICS_ID
  • Custom API keys

Deploy Checklist

  • All changes tested on staging
  • Database migrations complete
  • Cache cleared after deploy
  • Verify site loads correctly
  • Check error logs

Kinsta

SSH Deployment

# Connect to Kinsta
ssh clientsite@ssh.kinsta.cloud -p 12345

# Pull latest changes
cd public
git pull origin main

# Clear cache
wp cache flush

Kinsta Deploy Hooks

Configure in Kinsta dashboard for automatic cache clearing after Git push.


Next.js Deployments

Automatic Deployments

  1. Connect GitHub repository to Vercel
  2. Configure environment variables
  3. Push to branch triggers deployment
BranchEnvironment
mainProduction
developPreview
feature/*Preview

Manual Deployment

# Install Vercel CLI
npm i -g vercel

# Deploy to preview
vercel

# Deploy to production
vercel --prod

Environment Variables

Set in Vercel dashboard:

  • NEXT_PUBLIC_* - Client-side variables
  • DATABASE_URL - Server-side secrets
  • API_KEY - Server-side secrets

Railway

For backend services and cron jobs:

# Install Railway CLI
npm i -g @railway/cli

# Login
railway login

# Deploy
railway up

Shopify Deployments

Theme Deployment

# Push theme changes
shopify theme push

# Deploy to specific theme
shopify theme push --theme-id 123456789

# Deploy only specific files
shopify theme push --only templates/*.json

Deploy Checklist

  • Preview changes in theme editor
  • Test on development theme first
  • Backup current live theme
  • Deploy during low-traffic period
  • Verify all pages render correctly

CI/CD Pipelines

GitHub Actions - WordPress

# .github/workflows/deploy.yml
name: Deploy to WPEngine

on:
push:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Deploy to WPEngine
uses: wpengine/github-action-wpe-site-deploy@v3
with:
WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
WPE_ENV: production
SRC_PATH: wp-content/themes/clientsite/
REMOTE_PATH: wp-content/themes/clientsite/

GitHub Actions - Next.js

# .github/workflows/deploy.yml
name: Deploy to Vercel

on:
push:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Deploy to Vercel
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-args: '--prod'

Pre-Deployment Checklist

Code Quality

  • All tests passing
  • Linting passes
  • Type checking passes
  • No console errors
  • Code reviewed

Content & Data

  • Database migrations ready
  • Content updates staged
  • Media files optimized
  • Redirects configured

Performance

  • Assets minified
  • Images optimized
  • Cache headers set
  • CDN configured

Security

  • No secrets in code
  • Dependencies updated
  • Security headers set
  • SSL configured

Post-Deployment Verification

Smoke Tests

  1. Homepage loads
  2. Navigation works
  3. Key pages render
  4. Forms submit
  5. Authentication works
  6. Critical user flows complete

Monitoring

  • Check error tracking (Sentry)
  • Monitor server logs
  • Verify analytics tracking
  • Check Core Web Vitals

Rollback Procedures

WordPress (Git)

# Identify last working commit
git log --oneline

# Revert to previous commit
git revert HEAD

# Or reset to specific commit (careful!)
git reset --hard abc123
git push --force-with-lease

Vercel

# List recent deployments
vercel ls

# Rollback to previous deployment
vercel rollback [deployment-url]

Emergency Contacts

Document in project README:

  • Lead developer contact
  • DevOps contact
  • Client contact
  • Hosting support

CI/CD Auto-Rollback

The deploy.yml workflow implements automatic rollback on health check failure.

How It Works

Build Image -> Deploy -> Wait 30s -> Health Check (3 retries) -> Success/Rollback
|
+-- Pass -> Notify Success
+-- Fail -> Auto Rollback -> Notify

Health Check Behavior

SettingValue
Startup wait30 seconds
Retries3
Delay between retries10 seconds
Timeout per request10 seconds
Expected responseHTTP 200

Automatic Rollback Process

When health checks fail:

  1. Previous SHA Lookup - Gets the image SHA that was running before deployment
  2. Rollback Deployment - Pulls and starts the previous image
  3. Slack Notification - Sends alert with failure details and rollback status

Manual Rollback

If automatic rollback fails or you need to rollback to a specific version:

Via GitHub Actions:

  1. Go to Actions > "Deploy with Auto-Rollback"
  2. Click "Run workflow"
  3. Select environment (staging/production)
  4. Enter the image SHA to rollback to in rollback_sha
  5. Click "Run workflow"

Slack Notifications

The workflow sends notifications for:

  • Successful deployment - Green, includes deployed SHA
  • Automatic rollback - Yellow/warning, includes both failed and restored SHAs
  • Manual intervention required - Red/danger, when no previous version exists

Production Deployments

Always deploy during low-traffic periods. Have rollback plan ready before deploying.