Skip to content

Deployment

Document deployment configurations, infrastructure discoveries, and operational insights.

Date: 2025-08-28

Production Configuration:

  • Site URL: https://bigissue.pages.dev
  • Build Command: npm run build
  • Output Directory: dist
  • Node Version: 18 (configured in GitHub Actions)

GitHub Secrets:

CLOUDFLARE_API_TOKEN: Custom token with Pages:Edit permissions
CLOUDFLARE_ACCOUNT_ID: f9c3aafb7c048170d5bdb5f0f6737e5b
CLOUDFLARE_PROJECT_NAME: bigissue

Deployment Triggers:

  • Production: Push to main branch
  • Preview: Pull request creation/updates
  • Manual: Via npx wrangler pages deploy ./dist

Date: 2025-08-28

Asset Path Resolution:

// astro.config.mjs - Working configuration
export default defineConfig({
site: 'https://bigissue.pages.dev', // No base path needed
integrations: [starlight({ /* config */ })],
});

Previously Problematic:

// This caused CSS loading issues
export default defineConfig({
site: 'https://poramateminsiri.github.io',
base: '/bigissue', // Caused asset path problems
});

Learning: Cloudflare Pages works best with root-level paths, unlike GitHub Pages

Date: 2025-08-28

Deployment Workflow (.github/workflows/deploy-cloudflare.yml):

  • Trigger: Push to main, PR to main
  • Environment: ubuntu-latest, Node 18
  • Steps: Checkout → Setup Node → Install → Build → Deploy
  • Permissions: contents:read, deployments:write, pull-requests:write

Key Features:

- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
id: cloudflare-deploy
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
directory: dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

Automated PR Comments:

  • Preview URL automatically posted to PR
  • Deployment status updates
  • Easy access to test changes before merge

Date: 2025-08-28

Build Validation (.github/workflows/ci.yml):

  • TypeScript checking with npx tsc --noEmit
  • Build validation and output verification
  • Preview server testing
  • Artifact upload on failure for debugging

Pipeline Flow:

Push → CI Build Check → Deployment → Preview Comment → Manual Review → Merge → Production

Failure Handling:

  • CI failures prevent deployment
  • Build artifacts uploaded for debugging
  • Clear error messages in GitHub interface

Date: 2025-08-28

Deployment Times:

  • Build phase: ~30-45 seconds (install + build + upload)
  • Propagation: Near-instant (edge cache distribution)
  • Total time: ~1-2 minutes from push to live URL

Preview Deployments:

  • Creation: ~30-45 seconds
  • Update: ~30-45 seconds for subsequent pushes
  • URL format: https://[commit-hash].bigissue.pages.dev

Performance Comparison:

  • Faster than GitHub Pages (no Jekyll processing)
  • Faster global distribution than traditional hosting
  • Built-in CDN and optimization

Date: 2025-08-28

Success Rate: 100% successful deployments in testing Error Recovery: Failed deployments don’t affect live site Rollback: Previous deployment remains active during build failures

Monitoring:

  • GitHub Actions provides detailed deployment logs
  • Cloudflare dashboard shows deployment history
  • Automatic health checks for deployment success

Date: 2025-08-28

Automatic Optimizations:

  • Asset compression (gzip/brotli)
  • Image optimization and format conversion
  • CSS/JS minification and bundling
  • HTTP/2 and HTTP/3 support

Global Distribution:

  • 200+ edge locations worldwide
  • Automatic geographic routing
  • Built-in DDoS protection
  • SSL certificate management

Developer Experience:

  • Branch-based preview deployments
  • Integration with popular frameworks
  • Custom domain support
  • Analytics and performance monitoring

Date: 2025-08-28

Direct Deployment Option:

Terminal window
npm install wrangler@latest --save-dev
npm run build
npx wrangler pages deploy ./dist --project-name bigissue

Use Cases:

  • Emergency deployments bypassing GitHub Actions
  • Local testing of deployment process
  • Deployment from different branches
  • Troubleshooting deployment issues

Configuration: Uses same Cloudflare credentials, simpler authentication

Date: 2025-08-28

Common Issues & Solutions:

Build Failures:

  1. Check GitHub Actions logs for specific errors
  2. Test build locally with npm run build
  3. Verify all dependencies are in package.json
  4. Check for environment-specific issues

CSS/Asset Loading Problems:

  1. Verify site configuration in astro.config.mjs
  2. Check asset paths in build output
  3. Clear Cloudflare cache if needed
  4. Test with preview deployment first

API Token Issues:

  1. Regenerate token with correct permissions
  2. Update GitHub secrets immediately
  3. Verify account ID matches Cloudflare dashboard
  4. Check token hasn’t expired

Date: 2025-08-28

Broken Production Deployment:

  1. Immediate: Previous deployment remains active
  2. Investigation: Check GitHub Actions logs for failure details
  3. Rollback: If needed, revert last commit and redeploy
  4. Hotfix: Use Wrangler CLI for emergency fixes
  5. Prevention: Always test with preview deployments

Service Outages:

  • Cloudflare Status: Check https://cloudflarestatus.com
  • GitHub Status: Check https://status.github.com
  • Alternative: Manual deployment via Cloudflare dashboard
  • Communication: Update team about service impacts

Date: 2025-08-28

API Token Management:

  • Minimum required permissions (Cloudflare Pages:Edit)
  • Regular rotation schedule (quarterly)
  • Secure storage in GitHub secrets
  • No tokens in code or logs

Access Control:

  • Repository write access controls deployment
  • Branch protection prevents unauthorized changes
  • Required reviews for production changes
  • Audit logging via GitHub and Cloudflare

  1. Local Testing: Build and preview work correctly
  2. CI Validation: All automated checks pass
  3. Preview Testing: Use PR preview deployment for validation
  4. Performance Check: No significant performance regressions
  5. Security Review: No sensitive information in deployment
  1. Regular Health Checks: Monitor deployment success rates
  2. Performance Tracking: Watch build times and site performance
  3. Security Updates: Keep dependencies and tokens current
  4. Documentation: Update deployment procedures as needed
  5. Team Communication: Share operational knowledge and changes
  1. Build Cache: Optimize CI cache strategy for faster builds
  2. Parallel Processing: Explore build parallelization options
  3. Asset Optimization: Fine-tune image and asset processing
  4. CDN Configuration: Optimize cache headers and strategies
  5. Monitoring: Implement advanced performance and error monitoring