Pull code, a database, and uploads
Copy the code, the database, and the uploads of an environment to your computer. Pick any of the three. Staging and multidevs pull over SSH and Git. Live pulls from a backup.
Parts of this feature are still being built. The Not yet section lists them.
ddev avaloi pull copies an environment to your computer. You choose the parts: --code, --db, --uploads, or --all. Setup is in Develop locally with DDEV.
Where each part comes from
| Source | Code | Database and uploads |
|---|---|---|
| Staging or a multidev | Git, from the Avaloi remote | SSH: the database streams as a compressed dump, and uploads copy with rsync |
| Live | Git, the commit live runs | A backup download. Live takes no account SSH keys and is read only. |
| Any environment with SSH off, or a connected external repository | Your Git host | A backup download |
To pull data from live, add --from live:
ddev avaloi pull --db --uploads --from live
Live data comes from the newest backup. If it is more than a day old, or there is none, add --fresh-backup to take a new one first. A backup of a large site can take several minutes. Taking one does not change live.
Another way to get live's data without touching live: reset staging from live in the dashboard, then pull staging. Staging then holds live's code, database, and uploads under staging's own address.
Code
Code comes from the repository, never by file copy.
- The first
pull --codeclones into the project folder. - Later pulls run
git pull --ff-only. It stops, and changes nothing, when your branch has diverged or you have uncommitted changes. Commit or stash first, or add--rebase. ddev avaloi code --release livechecks out the exact commit live runs.
The repository holds the whole site folder: WordPress core, plugins, themes, and wp-content code. It leaves out uploads, caches, and wp-config.php. A pull never deletes a tracked file.
Database
The dump is made with wp db export --single-transaction, so it is consistent and does not lock tables. It travels compressed. The add-on checks that the dump ended properly before it touches your local database, so a cut connection leaves your local copy as it was.
After the import, the add-on:
- Rewrites the site address, and the temporary address, to your local address in every table with your prefix. It handles serialized values safely. It leaves each post's
guidalone. - Reads the real table prefix from the server, so a prefix other than
wp_works. - On a WordPress network, rewrites the network and subsite addresses and uses the network flag.
- Removes the Avaloi settings that came along in the database (a stored sign-in ticket, the mail relay state) from the local copy only.
A site with a large database can take a while. The add-on shows progress. For a database over about 2 GB, or on a slow link, pull from a backup instead with --method backup: the download resumes if it is cut.
Uploads
Uploads copy with rsync and resume if the connection drops. The add-on skips caches (cache/), backup plugin archives (backup*/, updraft/, ai1wm-backups/), database dumps (*.sql, *.sql.gz), logs, and PHP files. See your list with ddev avaloi exclude list. You can add your own with ddev avaloi exclude add PATTERN.
Useful options:
--max-size 50Mskips files larger than that.--uploads-days 30pulls only files changed in the last 30 days.
Uploads you already have are not copied again.
What the pull leaves alone
The pull never deletes a file that is in your Git repository. The Avaloi plugin is part of the server, so it never comes down. If your repository holds a cache or database drop-ins such as object-cache.php, they stay, and the add-on warns you. Pass --disable-dropins to rename an untracked one to NAME.avaloi-disabled. For a tracked one it prints the line to put in a local wp-config.php override instead.
What the database holds
A pulled database holds user emails and password hashes, and any order and customer data. Keep your disk encrypted and do not share the folder. Email stays on your computer: DDEV catches mail in Mailpit.
Checking the result
ddev avaloi status shows the environment, the branch, and when each part was last pulled. ddev avaloi doctor checks DDEV, Docker, your SSH key, the connection, the host key, rsync, and your API key.
API
GET /v1/environments/{id}/local-dev: sizes, the exclude list, the Git remote, and which parts each environment allows.POST /v1/environments/{id}/local-dev/pull-session: records the pull and returns the plan.GET /v1/environments/{id}/backups,POST /v1/environments/{id}/backups,POST /v1/backups/{id}/download, andPOST /v1/backups/{id}/download-link: the backup path.
Not yet
- The add-on is not public yet, so
ddev add-on get avaloi/ddev-avaloiworks once it is published. Until then install it from a local folder. - Subdomain WordPress networks are not finished locally. Subdirectory networks work.
- A pulled database cannot yet be made anonymous. There is no
--sanitizeoption.
Related
Still stuck?
Email [email protected] with your site name and what you tried, or send us a message.