Alternatively you can put your excludes in a file (one pattern per line) and reference that instead: path/to/local/wordpress/ command is starting to get long and there are probably more things you want to exclude like wp-content/upgrade, WPEngine’s mu-plugin suite, etc. Your rsync command will start looking like: rsync -avz -delete \ Add an -exclude option for each thing you want to exclude. You for sure don’t want rsync to delete your uploads folder that would be bad. You also probably don’t want to upload any node_modules folders, but you do want to upload the vendor folders. git folder with your project’s revision history database will save a bunch of time. There are probably some assets that you don’t need to transfer to your host. When you use it in concert with -delete, you’re making sure you don’t nuke something on the server that you want to keep. ExcludesĮxcludes control both what will get transferred from the source, as well as what shouldn’t be messed with at the destination. To control what gets deleted and what doesn’t, we’ll use an exclude list. It’s a necessary evil for us because if a plugin or theme file gets renamed, we want the old file to go away. -delete Delete (delete extraneous files at the destination)ĭeleting files on the destination is where you’ll want to exercise caution.-z Zip (compress files during transfer).-v Verbose (shows files as they’re being transferred).-a Archive mode (a good combination of options to start with if you’re not an rsync master).I just always add trailing slashes to both the source and destination folder paths. If you omit it from the src folder in the above example, rsync will make a folder called directory inside /path/to/remote/folder/. We typically run rsync as: rsync -avz -delete /path/to/local/directory/ getting into the options, it’s worth noting that rsync is picky about the trailing slash on the source folder. rsync requires the following arguments, but it supports many options and can grow to be quite complex: rsync src dest It’s awesome because the interface is super easy to use and set up, but you can use rsync with anything from Jenkins to just running the shell command on your computer to upload files. We use a continuous integration service called Buddy for our deploys. rsync also has the ability to compress files during transfer, making it even more efficient. Only transferring what has changed makes rsync deploys an order of magnitude faster than traditional SFTP deploys where everything is uploaded. What has changed gets updated on the remote host.The sender and receiver processes compare what files have changed.rsync establishes a connection to the remote host (usually via SSH) and runs another rsync receiver process at the destination.WPEngine added SSH support in 2018, so it was just a matter of time before we switched to rsync deploys for all of our hosts. If your host supports SSH, it supports rsync. Does my host have rsync? How does it work? Why not use their git push functionality? As much as I like WPEngine’s git push (it’s fantastic!), we need something that is adaptable across all of our clients. Eventually, the time came to see if we can adopt using it for future clients and projects. But having used rsync for deploys on projects over 15 years ago, I understand the benefits. SFTP works on all hosts, so it’s easy to go with that. Let’s all sync up and go on this journey together.Ĭombined, WebDevStudios (WDS) and Maintainn have several customers which use a wide variety of hosts. If we’re still using SFTP for transfers to some hosts, it’s likely you may be too. So why are we talking about this in 2021?!?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |