Skip to content

Deployment Guide

This guide covers the deployment process for the Grit Web SDK.

Overview

The Grit Web SDK uses a continuous deployment workflow triggered by Git pushes to the repository. The deployment pipeline automatically builds and deploys the application when changes are pushed to the configured branches.

Prerequisites

  • Git repository with deployment workflow configured
  • Access to the deployment environment
  • Node.js and npm/yarn installed locally for testing

Deployment Process

1. Code Preparation

Before deploying, ensure your code is production-ready:

# Run tests
npm test

# Build locally to verify no build errors
npm run build

# Run linting
npm run lint

2. Deploy to Production

To trigger a deployment:

# Add and commit your changes
git add .
git commit -m "feat: your descriptive commit message"

# Push to the deployment branch
git push origin main

3. Deployment Workflow

The deployment process follows these steps:

  1. Trigger: Push to the configured branch initiates the deployment
  2. Build: The CI/CD pipeline builds the Next.js application
  3. Test: Automated tests run to ensure code quality
  4. Deploy: Application is deployed to the hosting environment
  5. Verify: Health checks confirm successful deployment

Configuration

GitHub Actions Setup

The repository must have a deployment workflow configured. Typical configuration includes:

  • Trigger branches: Usually main or production
  • Build environment: Node.js version specification
  • Environment variables: API keys, database URLs, etc.
  • Deployment target: Hosting platform credentials

Environment Variables

Ensure the following environment variables are configured in your deployment environment:

NODE_ENV=production
NEXT_PUBLIC_API_URL=<your-api-url>
# Add other required environment variables

Monitoring Deployment

Deployment Status

Monitor the deployment progress through:

  • GitHub Actions tab for workflow status
  • Deployment platform dashboard
  • Application logs

Post-Deployment Verification

After deployment:

  1. Check the deployment URL for application availability
  2. Verify key functionality is working
  3. Monitor error logs for any issues
  4. Check performance metrics

Rollback Procedure

If issues arise after deployment:

# Revert to previous commit
git revert HEAD
git push origin main

# Or checkout previous stable version
git checkout <previous-commit-hash>
git push origin main --force

Troubleshooting

Common Issues

  1. Build Failures
  2. Check Node.js version compatibility
  3. Verify all dependencies are properly installed
  4. Review build logs for specific errors

  5. Deployment Timeouts

  6. Check deployment platform resource limits
  7. Optimize build process
  8. Review deployment configuration

  9. Environment Variable Issues

  10. Ensure all required variables are set
  11. Check for typos in variable names
  12. Verify secrets are properly configured

Best Practices

  • Always test locally before pushing
  • Use descriptive commit messages
  • Tag releases for easy rollback
  • Monitor deployment logs
  • Keep deployment documentation updated
  • Use staging environment for testing