Migrate from Laravel Cloud to fortrabbit

Published

Updated

🌥️

From Laravel Cloud to fortrabbit.

How to move a Laravel app from Laravel Cloud to a fortrabbit app. The code moves through Git, the settings with the Cloud CLI, the database as a dump, the files stay in the bucket or move to the storage component.

Migrate from Laravel Cloud with a coding agent

Claude Code, Codex, Cursor and other coding agents can run this migration. Paste this prompt into the agent, in the project folder:

Read https://www.fortrabbit.com/agents.md and set up fortrabbit. Then move this site from Laravel Cloud to fortrabbit, following https://www.fortrabbit.com/raw/migrate/from-laravel-cloud.md
txt

Sign-in happens in the browser, see agent setup. The agent needs the Laravel Cloud CLI to export the settings and the database credentials. The steps below are what the agent follows, and what to do by hand without one. The agent changes nothing on the old host: a person deletes the old setup once the site runs on fortrabbit.

Laravel Cloud settings and where they go

On Laravel CloudOn fortrabbit
Repository connected to the environmentSame repository, deployed by the GitHub integration
Environment variables and Secrets ManagerEnvironment variables
Build commands and deploy commandsBuild commands and post-deploy commands
Scheduler toggleOne cron job for schedule:run
Background processes, managed queuesWorkers with the database queue driver
Laravel MySQLMySQL component
Serverless PostgresMySQL component, after a conversion
Laravel Object Storage (Cloudflare R2)Keep the bucket, or the storage component

1. Create the app

Create an app in the dashboard with the Laravel software template. Its default domain works with HTTPS right away, so the whole move can be tested before DNS changes. Lower the TTL of the domain's DNS records now, see migrate to fortrabbit.

2. Export the settings

Install the Laravel Cloud CLI with composer global require laravel/cloud-cli and export the environment:

cloud environment:get --json --show-sensitive
shell

Copy every variable into the environment variables of the fortrabbit environment, except the ones Laravel Cloud injects for its database, cache and storage resources. Copy the values from the Secrets Manager too.

Copy the build commands and deploy commands from the Deployments settings. Build commands stay build commands, deploy commands become post-deploy commands.

3. Replace the managed services

  • Scheduler: add one cron job running php artisan schedule:run every minute.
  • Queues: fortrabbit has no Redis and no managed queue. Set QUEUE_CONNECTION=database and add a worker running php artisan queue:work, see Laravel queues and scheduler. Set CACHE_STORE and SESSION_DRIVER to database or file.
  • Background processes: each one becomes a worker.

4. Deploy the code

Connect the same GitHub repository to the environment and push. The first deployment runs the build commands.

5. Move the database

Laravel MySQL backups are snapshots, not dump files. Dump the live database instead: switch on the public endpoint of the database cluster, open View credentials, and run mysqldump against it:

mysqldump -h <host> -u <user> -p <database> > dump.sql
shell

Import the dump into the MySQL component as described under MySQL export and import. Switch the public endpoint off again afterwards.

fortrabbit runs MySQL only. An app on Serverless Postgres needs its schema and data moved to MySQL first: run the migrations against an empty MySQL database, then copy the data with a conversion tool.

6. Move the files

Laravel Cloud has an ephemeral filesystem, so uploads live in Laravel Object Storage, an S3-compatible Cloudflare R2 bucket. Two options:

  • Keep the bucket. Copy the access keys from Resources → Object storage into the environment variables. Nothing moves.
  • Move the files into the storage component of the environment. Download the bucket with an S3 client, push the files with rsync, and set FILESYSTEM_DISK=public.

7. Switch the DNS

Laravel Cloud does not host DNS; the records sit at the domain provider. Test the app on its default domain, add the custom domain to the environment and point the records to fortrabbit, see external domain setup. Remove the _cf-custom-hostname and _acme-challenge records Laravel Cloud asked for.

Once the app runs on fortrabbit, delete the environment and its resources in Laravel Cloud.