Skip to content

CI/CD Documentation

Overview

Lager Guru uses GitHub Actions for continuous integration and deployment.

CI Pipeline

Triggers

  • Push to main or develop branches
  • Pull requests to main or develop

Steps

  1. Checkout code - Retrieves latest code
  2. Setup Node.js - Installs Node.js 18
  3. Install dependencies - Runs npm ci
  4. TypeScript check - Validates types
  5. ESLint - Code linting
  6. Security audit - Dependency scanning
  7. Build - Creates production bundle
  8. Upload artifacts - Stores build files

Workflow File

.github/workflows/ci.yml

CD Pipeline

Triggers

  • Push of version tag (e.g., v1.0.0)

Steps

  1. Build Docker image - Multi-stage build
  2. Push to GHCR - GitHub Container Registry
  3. Deploy to server - SSH deployment
  4. Health check - Verifies deployment

Workflow File

.github/workflows/cd.yml

Required Secrets

CI Secrets

  • VITE_SUPABASE_URL (optional)
  • VITE_SUPABASE_PUBLISHABLE_KEY (optional)

CD Secrets

  • VITE_SUPABASE_URL
  • VITE_SUPABASE_PUBLISHABLE_KEY
  • VITE_WEB_PUSH_PUBLIC_KEY (optional)
  • SSH_HOST
  • SSH_USER
  • SSH_KEY

Deployment Process

Creating a Release

  1. Update version in code
  2. Create git tag:
bash
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0
  1. GitHub Actions automatically:
    • Builds Docker image
    • Pushes to GHCR
    • Deploys to production
    • Runs health checks

Monitoring Deployment

  1. Check GitHub Actions tab
  2. View workflow logs
  3. Verify health endpoint
  4. Check application logs

Docker Images

Image Tags

  • ghcr.io/<owner>/lager-guru:<git-sha> - Commit SHA
  • ghcr.io/<owner>/lager-guru:latest - Latest
  • ghcr.io/<owner>/lager-guru:<version> - Version tag

Pulling Images

bash
docker pull ghcr.io/<owner>/lager-guru:latest

Troubleshooting

CI Failures

  • Check TypeScript errors
  • Review ESLint warnings
  • Verify build process
  • Check dependency issues

CD Failures

  • Verify SSH credentials
  • Check server connectivity
  • Review deployment logs
  • Verify Docker setup on server

Best Practices

Versioning

  • Use semantic versioning (semver)
  • Tag releases consistently
  • Document breaking changes

Testing

  • Run tests before tagging
  • Test in staging environment
  • Verify health checks

Rollback

If deployment fails:

  1. Revert to previous tag
  2. Manually pull previous image
  3. Restart services

Local Testing

Test CI Locally

bash
# Install act (GitHub Actions locally)
brew install act

# Run CI workflow
act push

Test Docker Build

bash
docker build -t lager-guru:test .
docker run -p 80:80 lager-guru:test

Advanced Configuration

Custom Deployment

Modify .github/workflows/cd.yml for:

  • Multiple environments
  • Custom deployment steps
  • Additional health checks

Notifications

Add notification steps to workflows:

  • Slack notifications
  • Email alerts
  • Discord webhooks

Released under Commercial License