Move a Laravel Sail project to Lerd with its data. One command lifts the database and the files out of Sail's Docker stack and into Lerd, and puts Sail back the way it was.
A Sail project links to Lerd in a minute, but its data stays behind in Sail's containers. This plugin starts only Sail's database and storage, on ports clear of Lerd's so both run side by side, copies the database into the site's Lerd database and the files into its Lerd bucket, and stops Sail again. Sail's app image is never built, so a broken sail build cannot get in the way, and docker-compose.yml is left untouched if you ever want to go back.
lerd plugin install sailLink the project and let Lerd set up its env first, then import:
cd ~/code/shop
lerd link && lerd env
lerd sail:importIt is also in the site's Commands menu in the dashboard as Import from Sail, and AI assistants get it as sail_import through Lerd's MCP server. The full instructions are on the plugin's Documentation tab in the dashboard.
| Option | Meaning |
|---|---|
--db-name |
The Sail database, when Sail holds several |
--db-user, --db-password |
Sail's database login, when it is not the one in the compose file |
--bucket |
The MinIO or RustFS bucket to copy, when it is not AWS_BUCKET |
--skip-s3 |
Leave the files alone and import the database only |
--no-stop |
Leave Sail running afterwards |
--yes |
Don't ask before replacing the Lerd database |
- Reads the compose file with Sail's original settings from
.env.before_lerd, the copy Lerd keeps when it rewrites.env, so it finds Sail's database and bucket even after the project moved to Lerd. - Moves every port Lerd already uses up by 20000 (3306 becomes 23306) and leaves out the app's ports.
- Works with MySQL, MariaDB and PostgreSQL, and with RustFS or the MinIO older Sail projects ran.
- Takes a
before-sail-importsnapshot of the site's Lerd database before it imports, solerd db:restoreundoes the import. - Copies the files with
lerd s3:importinto the site's Lerd bucket.
It reads the project's compose file, and .env.before_lerd or .env for Sail's database and S3 settings. It starts and stops the project's own Sail containers through docker compose or podman compose and runs nothing else. It replaces the site's Lerd database, after the snapshot, and writes Sail's files into the site's Lerd bucket. The dump and a copy of the compose file with moved ports pass through tmp/ in the plugin's data folder and are deleted afterwards. Nothing leaves your machine.
- Lerd 1.38 or newer, and Node, which Lerd installs
docker composeorpodman compose, which Sail needs anyway. With Podman,docker composetalks to it through its socket:systemctl --user start podman.socket- MinIO no longer publishes its images, so an older Sail project whose MinIO image is not already on the machine cannot start it; import the database alone with
--skip-s3
node --test test/
lerd plugin install .MIT
