Installation
Requirements
Section titled “Requirements”- 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
~/.sshor entries in~/.ssh/config. - DDEV’s SSH agent must not be switched off. If
ddev-ssh-agentappears inomit_containersanywhere, a project with the add-on installed will not start. The error names what to remove.
Database support
Section titled “Database support”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.
Install
Section titled “Install”From the project directory:
ddev add-on get NoiXdev/ddev-sync --version v0.1.0-rc.8While 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:
ddev auth sshddev restartThe install prints these steps again, followed by ddev sync init, which is covered in Your first sync.
Prove it works
Section titled “Prove it works”Run:
ddev sync doctordoctor probes a target without changing anything and prints a checklist. For the installation itself, look at two rows:
web containerisOKwhen the sync container can reach your project’s web container.ssh agentisOKwhen 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.
Who owns which file
Section titled “Who owns which file”The install puts files into .ddev/. Some belong to the add-on and some to you.
| File | Owner | Notes |
|---|---|---|
.ddev/ddev-sync.yaml | You, committed with the project | Created once from a commented template, never overwritten, and kept when you remove the add-on. |
.ddev/ddev-sync/local.yaml | You, this machine only | Database credentials and S3 keys. The add-on’s .gitignore already excludes it. |
~/.ddev/ddev-sync/config.yaml | You, per machine | Optional 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.local | You and the add-on | You 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/.gitignore | The add-on | Marked #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 only | Written 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.
If the project will not start
Section titled “If the project will not start”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-agentfromomit_containerswherever it is listed: the global config (~/.ddev/global_config.yaml),.ddev/config.yaml, or a.ddev/config.*.yamlfile. Edit the list rather than clearing it withddev config global --omit-containers=, which would also switch back on anything else you omitted globally, such asddev-router. - The hook cannot read the sync image. The message names the image. Check
DDEV_SYNC_IMAGEandDDEV_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.
SSH never asks questions
Section titled “SSH never asks questions”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.
Removing the add-on
Section titled “Removing the add-on”ddev add-on remove ddev-syncThis 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.