Skip to content

Installation

  • DDEV v1.25.0 or newer. The add-on checks this when you install it. It has been exercised on macOS with Docker Desktop and DDEV v1.25.4; other setups are untested.
  • An SSH key in DDEV’s agent. The sync container reaches remote hosts through DDEV’s SSH agent. It cannot see key files in your ~/.ssh or entries in ~/.ssh/config.
  • DDEV’s SSH agent must not be switched off. If ddev-ssh-agent appears in omit_containers anywhere, a project with the add-on installed will not start. The error names what to remove.

The local database calls speak MariaDB’s client protocol.

  • Connections have been measured against DDEV’s MariaDB 10.8, 10.11 and 11.8.
  • A DDEV project that uses MySQL 8.0 as its local database is refused: its accounts use an authentication plugin the sync container’s client cannot load.
  • MySQL 5.x connects but is otherwise not covered.
  • PostgreSQL is not covered.

ddev-sync does not check the project’s database type up front, so an unsupported project fails at the first local database call.

From the project directory:

Terminal window
ddev add-on get NoiXdev/ddev-sync --version v0.1.0-rc.8

While ddev-sync is in release candidates, install with an explicit version like this. Once a final release exists, ddev add-on get NoiXdev/ddev-sync without --version takes the latest one.

No .ddev/.env lines are needed: the add-on names the image version it shipped with. The first start pulls that image, which can take a moment.

Then load your key and restart:

Terminal window
ddev auth ssh
ddev restart

The install prints these steps again, followed by ddev sync init, which is covered in Your first sync.

Run:

Terminal window
ddev sync doctor

doctor probes a target without changing anything and prints a checklist. For the installation itself, look at two rows:

  • web container is OK when the sync container can reach your project’s web container.
  • ssh agent is OK when the agent socket is available to it.

If both are OK, the install works. Without a reachable remote, the ssh connection row will fail, and that is expected: it says nothing about the installation.

The install puts files into .ddev/. Some belong to the add-on and some to you.

FileOwnerNotes
.ddev/ddev-sync.yamlYou, committed with the projectCreated once from a commented template, never overwritten, and kept when you remove the add-on.
.ddev/ddev-sync/local.yamlYou, this machine onlyDatabase credentials and S3 keys. The add-on’s .gitignore already excludes it.
~/.ddev/ddev-sync/config.yamlYou, per machineOptional global file for targets, so hosts and users are not committed. The first start creates the ~/.ddev/ddev-sync directory; the file inside is yours to create. The sync container mounts the directory read-only, so it reads the file and never writes it.
.ddev/.env.localYou and the add-onYou may set DDEV_SYNC_IMAGE and DDEV_SYNC_VERSION here. The add-on rewrites DDEV_SYNC_DOCKER_GID and DDEV_SYNC_HOST_HOME on every start. DDEV git-ignores this file, and it wins over .ddev/.env.
.ddev/docker-compose.ddev-sync.yaml, .ddev/config.ddev-sync.yaml, .ddev/commands/sync/sync, .ddev/ddev-sync/prepare-sidecar.sh, .ddev/ddev-sync/ddev-sync.example.yaml, .ddev/ddev-sync/.gitignoreThe add-onMarked #ddev-generated. DDEV replaces them on update and deletes them on removal. Do not edit them.
.ddev/ddev-sync/passwd, .ddev/ddev-sync/home/Generated, this machine onlyWritten on every start. home/ holds the known_hosts file. Both are git-ignored.

DDEV_SYNC_DOCKER_GID records which group owns the Docker socket on your machine, and DDEV_SYNC_HOST_HOME records where your home directory is, so the container can mount ~/.ddev/ddev-sync. Both differ from machine to machine, which is why they live in the ignored .env.local. If a project was set up when they were still written to .ddev/.env, which is not ignored, the next start moves them and says so once. The DDEV_SYNC_IMAGE and DDEV_SYNC_VERSION lines are yours and stay where you put them.

Under the older name .ddev/ddev-sync.local.yaml, the local file is still read, but that path is not git-ignored. See Targets.

The pre-start hook checks a few things on every start and prints a message that names the cause when one fails; DDEV’s own error may follow it as the last line. The ones you are most likely to meet, with their fixes in Troubleshooting:

  • DDEV’s SSH agent is switched off. Remove ddev-ssh-agent from omit_containers wherever it is listed: the global config (~/.ddev/global_config.yaml), .ddev/config.yaml, or a .ddev/config.*.yaml file. Edit the list rather than clearing it with ddev config global --omit-containers=, which would also switch back on anything else you omitted globally, such as ddev-router.
  • The hook cannot read the sync image. The message names the image. Check DDEV_SYNC_IMAGE and DDEV_SYNC_VERSION, or build the image first if you are running a local build.
  • The hook cannot read the Docker socket’s group. Docker is probably not running; the message includes what Docker answered.

Every connection runs without prompts. A host seen for the first time is trusted and remembered; a host whose key has changed is refused, and doctor reports it on the ssh connection row. Passwords, passphrases and host-key questions are never asked, so a key with a passphrase has to be added to the agent first with ddev auth ssh.

Terminal window
ddev add-on remove ddev-sync

This deletes the add-on’s own files and the generated passwd and home/ entries, and takes its two lines out of .ddev/.env.local and, for a project that predates the move, out of .ddev/.env as well. Your .ddev/ddev-sync.yaml and .ddev/ddev-sync/local.yaml stay where they are, and so does ~/.ddev/ddev-sync/config.yaml, because your targets are shared with your other projects. Deleting home/ also deletes the remembered known_hosts, so after a reinstall each remote host is accepted again on first contact. Any DDEV_SYNC_IMAGE and DDEV_SYNC_VERSION lines you added are yours to delete.

The sync container keeps running until the next ddev restart: removal deletes its service definition, but DDEV only notices on the next start.

Your first sync.