Lerd Plugins

00 / Reviewed plugins

Pluginsfor Lerd

Commands, dashboard pages, AI tools and services that extend Lerd. A maintainer reads each plugin at one exact commit, and that commit is the one Lerd installs. Plugins run as you, so read what you install.

0plugins
0authors

db-import-host

Bring your databases over from a MySQL, MariaDB or PostgreSQL server installed on this machine

README at reviewed commit 7836bd4

Move to Lerd from Valet, Herd, DBngin or a MySQL installed with your package manager, data included. One command copies a site's database from the server on your machine into Lerd's own.

Your sites link to Lerd in a minute, but their data is still in the MySQL, MariaDB or PostgreSQL server you were using before. This plugin copies it into Lerd's own database service, one site at a time or all at once, and only ever reads the server it copies from.

Install

lerd plugin install db-import-host

Use

See what is on the machine's server and which Lerd site each database fills, then import:

lerd db-import-host:list
cd ~/code/shop
lerd db-import-host:import

lerd db-import-host:import shop blog imports named sites and --all every site whose database exists on the machine's server. It is also in the site's Commands menu in the dashboard as Import database from this machine, and AI assistants get db-import-host_list and db-import-host_import through Lerd's MCP server. The full instructions are on the plugin's Documentation tab in the dashboard.

Option Meaning
--all Import every site whose database exists on the machine's server
--from The database on the machine's server, when its name differs from the site's
--database The site's database in Lerd, when Lerd does not know it (WordPress, Drupal)

By default it connects to 127.0.0.1:3306 as root with no password for MySQL and MariaDB, and 127.0.0.1:5432 as postgres for PostgreSQL. To save anything else, run lerd db-import-host:connect and answer its questions; it tries the connection before saving. Or pass it all at once:

lerd db-import-host:connect mysql --user root --password secret
lerd db-import-host:connect mysql --socket /run/mysqld/mysqld.sock
lerd db-import-host:connect postgres --port 5433 --bin-dir /Applications/Postgres.app/Contents/Versions/latest/bin

What it does

  • Dumps the database with the machine's own mysqldump/mariadb-dump or pg_dump, skipping Lerd's shims of the same name, which run inside Lerd's containers and cannot reach the machine's server.
  • Creates the site's Lerd database if needed and takes a before-host-import snapshot, so lerd db:restore undoes the import.
  • Replaces what Lerd held for that database with the dump.
  • Swaps a MariaDB dump's utf8mb4_uca1400_* collations and NO_AUTO_CREATE_USER sql mode for what MySQL accepts when the site uses Lerd's MySQL.
  • Imports a database shared by several sites in a group only once with --all.

What it reads, changes and sends

It reads the databases you import from the server on this machine, and never writes to that server. It reads the site list from Lerd's API. It replaces the site's Lerd database, after the snapshot. The dump is written to tmp/ in the plugin's data folder and deleted once imported. The connection you save with connect, password included, is kept in connection.json in the same folder, readable only by you. Nothing leaves your machine.

Requirements

  • Lerd 1.38 or newer, and Node, which Lerd installs
  • The client tools of the server you import from, on your PATH or found through --bin-dir

Development

node --test test/
lerd plugin install .

License

MIT

01 / Make one

Build a pluginand list it here.

Shell, Python or Node, for anything Lerd doesn't do on its own: your team's tools, a debug bar, a dashboard for the one service you always open.

  1. 01

    Build it

    Start from a working plugin that uses every surface, or ask your AI assistant: Lerd's MCP server carries the plugin guide.

    $lerd plugin new my-plugin
  2. 02

    Publish it

    Put it in a public git repository with a README, a license and a screenshot of what it adds.

  3. 03

    Submit it

    Open a pull request on lerd-env/plugins naming one commit. A maintainer reads it, and that commit is what everyone installs.