Introduction

Hello and thank you for trying out MigrateWP. 

MigrateWP is a command line utility that lets you migrate a WordPress site from your macOS Local development environment to a linux server with a single command. It is open source software released by Tartan Web Design under the GPLv2 licence.

The documentation is designed to help you get set up and using MigrateWP as quickly as possible. If anything is unclear, please free post in the matrix.org user group where someone may be able to help. 

Getting started

The tool is aimed at developers so some prior knowledge of the command line is assumed.

System Requirements

To use MigrateWP you need 

  1. MacOS running on your local machine
  2. Linux on a remote server

Dependencies 

Prior to running migrateWP you should ensure the following is installed

Local machine

  1. WP CLI 2.4.0
  2. Rsync 2.6.9

Remote server

  1. SSH user 
  2. WP CLI 2.4.0
  3. Rsync 2.6.9

Installation & Setup

Before beginning the setup please check you meet the system requirements and have the required dependencies installed on your systems. 

Download

Download latest release here:

https://github.com/Tartan-Web-Design/migrateWP/releases

Open terminal and cd into the folder containing migrate

Create an alias:

nano ~/.zshrc
alias mwp="bash /Users/username/yourfolder/MigrateWP.sh" 

Or

echo "alias mwp="bash /Users/username/yourfolder/MigrateWP.sh" >> ~/.zsh

Then restart your terminal session

exec zsh 

Config file

Each site in the config will look something like this

sitename)
  

systemUser=”sysuser_f@8.8.8.8”

remoteUrl="example.com"
remotePath=”/var/www/vhosts/example.com/httpdocs/wp-content/” 

localUrl=”example.local”
localPath=”/Users/Scott/Local Sites/example/app/public/wp-content/”`

;;

Replace ‘sitename’ with the name you want to use to reference your site

in ‘sshUser’, enter an SSH user with permissions over the folder which holds your WordPress installation. 

If you are using Plesk, this will be the systemUser for the plesk webspace. (This user can be found at: subscriptions>sitename>Connection Info)

E.g username@8.8.8.8

Finally, enter the file path to the wp-content folder on the local and remote servers

SSH

MigrateWP accesses the remote server numerous times and so it will be helpful to add a key to your SSH account.

The ssh guide assumes you are using Plesk as your server management platform and have the ‘SSH Keys manager’ extension installed. If you are using a different server management solution some steps may be slightly different & you should refer to their documentation. 

If you are using Plesk, this can be done by

  1. Installing the ‘SSH Keys Manager’ Plesk extension
  2. Copying your local public SSH key
cat ~/.ssh/id_rsa.pub

Pasting the public key into the Plesk SSH keys page for this website. The Plesk SSH keys page can be found at (subscriptions>sitename>SSH Keys)

  1. Setting ‘Access to the server over SSH’ to /bin/sh (subscriptions>sitename>Connection Info-> Manage access)

NB, you don’t need to set up separate ssh sub-domains, as on Plesk at least, the credentials are the same as the main domain.

Migration Commands

MigrateWP has four commands, push, pull, rollback & report.

Push

The push command migrates a site from your local machine to a remote server 

mwp pull sitename

Pull

The pull command migrates a site from the remote server to your local machine

mwp push sitename

Rollback

The rollback command allows you to undo the last push or pull

mwp rollback sitename

Report

The report command displays the migration history for the site you specify

mwp report sitename