I heard about Wordmove from Dann over at SpeakWP which helps manage multiple WordPress environments like local, staging and production. Wordmove is written in Ruby and requires some dependencies to install correctly before you can use it to easily push and pull WordPress installations with incredible ease.
I also outline the basic configuration files for Wordmove to set up multiple environments.
Install Wordmove on Ubuntu 16.04
We need to grab a bunch of dependencies for Wordmove to work.
We are using the Brightbox repository to install Ruby 2.4 which photocopier – a Wordmove dependency – requires
sudo apt update
sudo apt install python-software-properties software-properties-common -y
sudo add-apt-repository ppa:brightbox/ruby-ng -y
sudo apt install curl git libcurl4-openssl-dev make zlib1g-dev gawk g++ gcc libreadline6-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison gzip pkg-config ruby2.4 ruby-bundler ruby-dev -y
Install the Wordmove Ruby gem
gem install wordmove
You will get a bunch of output showing the gem dependencies being installed
Fetching: colorize-0.7.7.gem (100%)
Successfully installed colorize-0.7.7
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: activesupport-4.2.7.1.gem (100%)
Successfully installed activesupport-4.2.7.1
Fetching: net-ssh-3.2.0.gem (100%)
Successfully installed net-ssh-3.2.0
Fetching: net-scp-1.2.1.gem (100%)
Successfully installed net-scp-1.2.1
Fetching: net-ssh-gateway-1.2.0.gem (100%)
Successfully installed net-ssh-gateway-1.2.0
Fetching: photocopier-1.1.1.gem (100%)
Successfully installed photocopier-1.1.1
Fetching: wordmove-2.0.0.gem (100%)
Starting from 2.0.0 Wordmove will compress SQL dumps both in remote and locale environments.
If something will broke, please check if gzip executable is present locally and
remotely. We are considering obvious it's installed in any web environment.
Open an issue on github at your needs.
Successfully installed wordmove-2.0.0
Parsing documentation for colorize-0.7.7
Installing ri documentation for colorize-0.7.7
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for activesupport-4.2.7.1
Installing ri documentation for activesupport-4.2.7.1
Parsing documentation for net-ssh-3.2.0
Installing ri documentation for net-ssh-3.2.0
Parsing documentation for net-scp-1.2.1
Installing ri documentation for net-scp-1.2.1
Parsing documentation for net-ssh-gateway-1.2.0
Installing ri documentation for net-ssh-gateway-1.2.0
Parsing documentation for photocopier-1.1.1
Installing ri documentation for photocopier-1.1.1
Parsing documentation for wordmove-2.0.0
Installing ri documentation for wordmove-2.0.0
Done installing documentation for colorize, i18n, thread_safe, tzinfo, activesupport, net-ssh, net-scp, net-ssh-gateway, photocopier, wordmove after 13 seconds
10 gems installed
Wordmove is now installed, I plan to make a detailed configuration in the future but for now this is how you get started.
Wordmove Initial Configuration
Enter your home folder, create a new folder for your Movefile configurations and initialize the first Movefile
cd ~
mkdir wpbulletstaging
cd wpbulletstaging
wordmove init
Open your Movefile
nano Movefile
You will see a local
section which is meant to reference the local installation
Make sure you specify the absolute path and database credentials.
If you plan to use SSH keys see this.
local:
vhost: "http://vhost.local"
wordpress_path: "/root/staging" # use an absolute path here
database:
name: "database_name"
user: "user"
password: "password"
host: "127.0.0.1"
You also will usually have a production block.
Wordmove will connect by SSH or FTP to execute remote commands – FTP support will be deprecated in the future.
More detail about Movefile configurations can be found here.
production:
vhost: "http://example.com"
wordpress_path: "/var/www/your_site" # use an absolute path here
database:
name: "database_name"
user: "user"
password: "password"
host: "host"
# port: "3308" # Use just in case you have exotic server config
# mysqldump_options: "--max_allowed_packet=1G" # Only available if using SSH
exclude:
- ".git/"
- ".gitignore"
- ".sass-cache/"
- "node_modules/"
- "bin/"
- "tmp/*"
- "Gemfile*"
- "Movefile"
- "wp-config.php"
- "wp-content/*.sql"
ssh:
host: "host"
user: "user"
password: "password" # password is optional, will use public keys if available.
port: 22 # Port is optional
rsync_options: "--verbose" # Additional rsync options, optional
# gateway: # Gateway is optional
# host: "host"
# user: "user"
# password: "password" # password is optional, will use public keys if available.
If your host doesn’t have SSH you can swap out the ssh block with FTP
ftp:
host: "host"
user: "user"
password: "password"
passive: true
scheme: "ftp" # default "ftp", "ftps" also available
You can save this configuration now with Ctrl+X, Y and Enter to Save and Exit.
In Wordmove you can pull an installation from a remote server, this will pull from your production environment to your local one.
Wordmove commands must be run from the folder containing the Movefile!
wordmove pull -e production --all
Similarly you can push your local installation that you have been working onto the production environment
wordmove push -e production --all
Here is the full list of Wordmove flags