Use WordMove to Move Code and Databases from Local to Remote Servers

by Noor Ali  February 9, 2017

One of the most important challenge in WordPress development is to move local WordPress installation to remote servers. This is a critical step in transferring test or finished code to staging or live servers.

In this article, I will introduce WordMove, a very popular tool for mirroring the local WordPress installation to the remote servers. The best thing about WordMove is that it takes care of syncing code and databases with staging or live servers.

WordMove for WordPress Installation Transfer

For many developers, two important aspects of the tool is the complete support for SSH connections and the ease of pulling or pushing the environment through simple commands. you can easily pull or push the environment back and forth with simple commands.

Prerequisites & Notes

1- Make sure you have rsync installed.

2- sshpass must be installed in order to have Wordmove use the ssh details provided in the Movefile.

3- We have tested WordMove on Linux and written this guide accordingly.

Install the Ruby Virtual Machine (RVM)

Installation of WordMove depends upon RVM because Wordmove primarily depends upon Ruby 2.0 or higher. I will set up the environment before getting started.

By default, RVM is not installed on Linux platforms. So, before installing RVM, I will import the public key into our system, and then use Curl to install RVM in the system:

After installing RVM, I will setup RVM environment so that the current shell takes up new environment settings.

Install all the dependencies for installing Ruby automatically on the system:

Install WordMove

The next step is the installation of WordMove using GEM

I faced some issues while running this command. Here are several tips for handling the issues:

To solve this issue, just make the Ruby directory publicly writeable:

Set up WordMove

WordMove maintains a config file, and a SSH connection. This determines the folders and files need to be synched. Here is a sample WordMove File named Movefile.

Use WordMove

I will now detail simple commands  to push or pull code:

You could define multiple environment for deploying to WordPress website.

Parameters could also be used when pulling and pushing the files:

In addition, WordMove integrated an incremental approach and after the initial synchronization, only unsynced files are pushed or pulled.

All these commands also work equally well for databases. I have tested the following scenarios:

  • Created a new table in the remote database. Next, I ran a local push, which only caused changes in existing tables and left the newly created table as it was. Note that the new table did not exist locally.
  • Created a new table in the local database. Next, I ran a remote pull, which only caused changes in the existing tables and left the newly created table as it was. Note that the new table did not exist remotely.
  • Created a new table in the remote database and then ran a remote pull, which brought the newly created table into the local database.
  • Created a new table in the local database and then ran a local push, which pushed the changes in the newly created table to the remote database.

Conclusion

WordMove is a very important tool for moving local WordPress installations to staging and remote servers. The move is very streamlined and works without a hitch in almost all cases. I would recommend that you try out WordMove for your next project. If you face any issues or would like to contribute to the discussion, do leave a comment below.

Make Your WordPress Website 100% Faster.

Host it now on Cloudways WordPress Hosting Platform.

About Noor Ali

Noor Ali is an Associate Software Engineer at Cloudways. He loves to solve technical problems through programming and mathematics.

Stay Connected:

You Might Also Like...