Skip to content

Syncing

ddev sync runs a fixed sequence of steps against one target. Your first sync walks through a run; this page is the reference for choosing what it does.

GroupSteps in itDoes
(always)preflightChecks the remote and the credentials. Always runs.
dbdb.dump, db.download, db.import, envDumps the remote database over SSH, drops and recreates the local one, imports, then rewrites the local environment file.
filesfiles.syncrsync for the paths the profile or your configuration declares.
s3s3.syncCopies between two S3 endpoints.
sanitizesanitizeRuns the sanitize rules.
setupsetupRuns the framework’s commands in the web container.

The order is fixed, whatever order you name groups in: preflight, db, env, files, s3, sanitize, setup. A group is only available when the project has work for it. Naming one that is not, such as s3 without S3 configured, is an error that lists what is available.

Terminal window
ddev sync --steps=db,sanitize

A comma-separated list of db, files, s3, sanitize and setup. An empty list, an unknown name or an unavailable group is an error. Only the groups you name run, plus preflight.

A group is offered when it would put at least one step into the plan. A project with no S3 configuration is not asked about s3, and --yes does not select it. Naming a group that is not offered is an error that lists the ones that are. An empty --steps "" is refused for the same reason, and so is pressing Enter at the picker with nothing ticked: a selection of nothing would plan only the preflight check and then report a successful sync, which is worse than an error.

Three consequences are worth knowing before they look like a bug:

  • A misspelled group name gets a different message, which says the name is unknown. If you see the list of available groups instead, the name was right and the project has nothing for it.
  • On a project with no sanitize rules, --yes does not select sanitize, because there is nothing for it to do. The run therefore ends with data from production is on your machine and was not sanitized, and that is the honest answer: the copy really is unsanitized. Either configure rules for the project (see Sanitizing) or treat the copy as production data.
  • A group whose configuration is broken still counts as offered, because it is configured, just wrongly. Its error appears when that group is planned, not when you asked for an unrelated one.

--yes assumes every default and asks nothing:

  • it selects every available group, including setup and s3, which the interactive picker does not tick;
  • it skips the confirmation before the local database is dropped;
  • it skips the diff confirmation before the environment file is changed.

Use --steps when you want less. --yes is refused together with init.

setup is not ticked in the picker because it runs composer install, migrations and frontend builds that can take minutes, and someone who only wants fresh data should not have to wait for them.

With neither flag and a terminal, you get a checklist. db, files and sanitize are ticked; s3 and setup are listed when the project has work for them, but not ticked. Pressing Enter with nothing ticked stops. Without a terminal, there is nothing to ask, so the run fails and tells you to pass --steps or --yes.

With several targets and no --target, you are asked which one, and without a terminal that is an error as well.

Terminal window
ddev sync --dry-run

Prints the plan and runs nothing. It also checks the sanitize.disable_* switches. A target that reads its connection from Deployer is still resolved, which evaluates deploy.php.

Each step prints .. while running, then OK, FAIL or -- when skipped. After a failure, the steps that follow print --.

FlagAdds
-vEach step’s plan detail.
-vvThe stdout and stderr of the commands that run. Output of commands that carry credentials is replaced by <output withheld: it carries credentials>.
-vvvThe command lines themselves, and the duration of each step.

Known secrets, such as database passwords and S3 keys, are replaced with *** in everything printed. Colour follows the usual conventions: NO_COLOR switches it off, a non-empty FORCE_COLOR forces it on, and it is off when output is not a terminal.

Terminal window
ddev sync build

Runs only the frontend build (installing packages and running the project’s build script) in the web container, without touching the database or files. It is a shortcut for --steps=setup --features=node-build --only-feature-setup, so combining it with --steps, --features, --no-features or --only-feature-setup is refused. It needs a package.json with a build script and a lockfile.

A feature is a small add-on layer that contributes setup commands, and sometimes sanitize rules, for a tool the project uses. ddev-sync detects them from composer.lock and package.json:

FeatureForDetected byAdds
node-buildanypackage.json with a build scriptPackage install, then the build script. Package manager from package-lock.json, yarn.lock or pnpm-lock.yaml.
filamentLaravelfilament/filamentphp artisan filament:upgrade and filament:optimize
livewireLaravellivewire/livewirephp artisan livewire:publish --assets
horizonLaravellaravel/horizonphp artisan horizon:clear (the local queue only)
inertiaLaravelinertiajs/inertia-laravelnothing; it is only reported
symfony-searchSymfonyfriendsofsymfony/elastica-bundlephp bin/console fos:elastica:populate
typo3-processedfilesTYPO3not detected; name it yourselfTruncates sys_file_processedfile and removes fileadmin/_processed_

--dry-run lists the features in play and why. To take control:

  • --features=a,b replaces detection with exactly these. A feature meant for another framework is an error when you name it, and silently skipped when it was only detected. An empty --features= is refused.
  • --no-features turns detection off for this run. It cannot be combined with --features.
  • features: in the configuration does the same permanently: a list of names, or [] for none. Any features: key replaces detection.
  • defaults.detect_features: false in a file you own is the master switch for detection.

The order of precedence is --no-features, then --features, then the features: key, then defaults.detect_features, then detection. Feature layers sit between the profile and your files, so your configuration can override them.

A failed step ends the run, and the steps after it print --. The most common case is a failing setup command: it runs after the database has been imported and sanitized, so the data is already in the state you want. Fix the command, then re-run with --steps=setup alone. A command that is allowed to fail has allow_failure: true, see Configuration.

Pressing Ctrl-C stops the run and exits with 130. The run ends with a message instead of a traceback. It names where it stopped and the last step that finished, and says what state that leaves the local database in. It does not undo or clean up anything, so read it before you do the next thing. What it says depends on where you were:

  • At a confirmation prompt, such as “This will drop the local database … Continue?”. The step was waiting for an answer and changed nothing. The message still reports what earlier, finished steps left behind.
  • Before anything touched the database. The message says where it stopped and makes no claim about your data.
  • During the import, once the drop has begun. The local database may be partly replaced with production data, and it is not sanitized. Re-run with --steps db,sanitize, or treat the copy as production data.
  • After the import, before sanitizing. The local database has been replaced with production data and was not sanitized. Re-run with --steps sanitize, or treat the copy as production data until you have.
  • During sanitizing, in a run that imported the database too. The database holds production data and is “not fully sanitized”: some rules may already have applied. Re-run with --steps sanitize, or treat the copy as production data.
  • During sanitizing, in a --steps sanitize re-run. This run has no import of its own to reason from, so it cannot see what an earlier one left and does not pretend to. It says that if the local database holds production data it may be only partly sanitized. The remedy is the same, and only you can tell which case it is.
  • In a pre_ or post_ hook of a step. The message names the hook as a hook. The state of the database is still reported from the steps that finished.
  • In the post_sync hooks. They “may not have finished”, and the state of the database is still reported.

post_sync hooks do not run after Ctrl-C at any earlier point, and when you have such hooks the message says so. If you keep cleanup in post_sync, it has not happened. Stopping between the import and the end of sanitizing leaves production data on your machine, which is what the message is there to tell you.

A run without the sanitize step ends with ! data from production is on your machine and was not sanitized; the stage in it is the target’s. The stage changes nothing but that wording. If a sanitize.disable_* switch is set, the run also names the switch and the file it came from.

CodeMeaning
0Success. For doctor: every row passed.
1A failed step, a failed doctor row, or any error ddev-sync reports.
2The command line was wrong: a usage error, such as an unknown option, one placed after the subcommand, or a refused combination of options.
130Interrupted with Ctrl-C.

Every option is listed in the command line reference, and every error is explained in troubleshooting.

Frameworks lists what each profile does and how far it has been verified.