·

Migrating from Laravel Forge to Laravel Cloud

This site runs on Statamic with flat-file content storage—no complex database migrations, no user uploads to worry about. That made it a perfect candidate for my first Laravel Cloud migration.

The setup

This site is intentionally simple:

  • Statamic CMS with Git-backed flat-file content
  • PostgreSQL for health check history and contact form submissions
  • Redis for caching and queues
  • GitHub Actions for CI/CD

No file uploads, no complex integrations. Just content and a few Livewire components.

Creating the Laravel Cloud environment

Laravel Cloud's onboarding is straightforward. Connect your GitHub repo, select your branch, and it detects the Laravel application automatically. I provisioned a managed PostgreSQL database and Redis instance directly from the dashboard.

Environment variables

The bulk of the work was copying environment variables from Forge to Cloud. One gotcha: Laravel Cloud's managed databases aren't on localhost.

# These defaults won't work on Cloud
DB_HOST=127.0.0.1
DB_PORT=3306

# Use the Cloud-provided connection details
DB_CONNECTION=pgsql
DB_HOST=your-db.pg.laravel.cloud
DB_PORT=5432

Health check adjustments

I use Spatie's Laravel Health package with Oh Dear monitoring. A few checks needed tweaking for the cloud environment:

  • RedisMemoryUsageCheck crashed due to restricted INFO command access—I removed it
  • UsedDiskSpaceCheck needed higher thresholds since container disks report differently
  • CpuLoadCheck thresholds needed adjustment for shared infrastructure

Updating GitHub Actions

The CI workflow needed one change—swapping the Forge deploy webhook for Cloud's:

# Before
- name: Deploy to Forge
  run: curl ${{ secrets.DEPLOY_URL }}

# After
- name: Deploy to Laravel Cloud
  run: curl -X POST ${{ secrets.CLOUD_DEPLOY_URL }}

DNS cutover

Added the custom domain in Cloud's dashboard, updated DNS records, and SSL was provisioned automatically within minutes. Total downtime: effectively zero thanks to DNS propagation overlap.

The result

The entire migration took under an hour. No more server maintenance, automatic scaling if a post ever goes viral, and the pay-per-use model makes sense for a low-traffic personal site.

For simple applications like this one, Laravel Cloud is a no-brainer.

What's next

Not every project is this simple. In the next article, I'll cover migrating a more complex application where we kept Forge running as a fallback—handling database replication, file storage synchronization, and a gradual traffic cutover strategy.