Using WordMove to mirror sites


#1

I use WordMove to mirror local Wordpress installations and DB data back and forth from my Local development machine to the remote server.

Here’s a sample setup:

  • ssh into your site (right click site name, and select Open SSH)
  • cd /app/public
  • Edit wp-config.php and make sure it has the same table prefix as the remote site, don’t change anything else.
  • Install WordMove: gem install wordmove
  • Create the Movefile by doing: wordmove init
  • Edit the Movefile and add Production (and maybe more environmentes)
  • Pull the remote site, including database and media doing: wordmove pull -all

Here’s a sample Movefile:

local:
  vhost: "http://soderlind.dev"
  wordpress_path: "/app/public" # use an absolute path here

  database:
    name: "local"
    user: "root"
    password: "root"
    host: "localhost"

production:
  vhost: "https://soderlind.no"
  wordpress_path: "/ABSOULUTE/PATH/TO/WORDPRESS" # use an absolute path here

  database:
    name: "wp"
    user: "wp"
    password: "PASSWORD"
    host: "localhost"

  exclude:
    - ".git/"
    - ".gitignore"
    - ".sass-cache/"
    - "node_modules/"
    - "bin/"
    - "tmp/*"
    - "Gemfile*"
    - "Movefile"
    - "wp-config.php"
    - "wp-content/*.sql"

  ssh:
    host: "SSHHOST"
    user: "SSHUSER"

Using mysqldump with Wordmove
#2

I tried to use WordMore with this but kept getting:
sh: mysqldump: command not found

I’m not sire if I needed a path or to run sql somewhere. How did you get around this?


#3

@soderlind I actually sorted this out mostly. I installed a local mysql and got rid of any other mysql installs or apps that had it running. I now have wordmove using my local installs mysqldump, but when it runs I get this error:
mysqldump: Got error: 1049: Unknown database ‘local’ when selecting the database


#4

Hey soderlind,

Any chance you could do a little video tut for us on this workflow?

Thanks in advance :slight_smile:


#5

Ok, late but I was able to make it work.

The important stuff is:

  • Make sure you have the same database prefix as the remote site.
  • Be sure to have all the dependencies required to make WordMove work. That includes having mysql installed in the system and having its executable in your path with the proper permissions. I had to manually add the mysqldump executable to my path. For this, after I installed MySQL in my system, I created a symbolic link (ln -s) from /usr/local/bin/mysqldump to /usr/local/mysql/bin/mysqldump.
  • In the Movefile, in the remote (or production or however you call it) environment, I specified the database host as the IP that Local gives you in the Database tab of the site you created in the GUI.
  • I installed wp cli in my system and changed the sql_adapter line in the Movefile from ‘default’ to ‘wpcli’.
  • Finally, in the wp-config.php I changed the localhost in the "define( ‘DB_HOST’, ‘localhost’) " line for the same IP that Local gives you in the Database tab in GUI and added the port number at then end. It lookes like this:
    define(‘DB_HOST’, ‘192.168.90.200:4002’). We need to make that change or wp-cli won’t be able to connect to the database and replace the urls automatically. In my case, I still had to change the siteurl value manually in the database but that was easy.

After all this, I was able to successfully pull the database with WordMove. The last problem I got in was that wp-cli didn’t changed the siteurl value in the database, so when I tried to access the local domain it redirected me to the remote server and the browser cached this as a 301 redirect. So I had to erase that cache (is not the regular cache you can delete in the privacy settings) and, after also changing hte siteurl value directly in the database with Sequel Pro, I was finally able to visit the local environment.

Hope all this helps/saves someone!


#7

Hello,
I am trying to pull a Database from production to local (flywheel) and i am not sure how to deal with the database. It’s not finding the mysql database ( local
mysqldump: Got error: 2002: Can’t connect to local MySQL server through socket). Is there a fix ?
Any pointers would be great ! Thanks


#8

@squaremunkey

Please see:


#9

I got the following error

/var/lib/gems/2.1.0/gems/wordmove-2.0.0/lib/wordmove/sql_adapter.rb:44:in `gsub!': 
invalid byte sequence in US-ASCII (ArgumentError)

Fixed it by adding the following to .profile

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

#10

I don’t know what Local by Flywheel does to host the MySQL section of these WordPress installs, but I have my own solution with wordmove and I hope other are able to get help with this.

So turns out that for me it’s just impossible to get wordmove to work with primarily the database section… here is a trick to get something.

Assuming all your credentials are correct. Go ahead and do a wordmove push --all. After like 3-4 minutes it will be successful everywhere BUT the database section. Let that be.

Now go to local by flywheel and go to the database of the site you are converting. Click on “Adminer” to open up the database. On the left hand side click on Export.

Make sure that the option is selected as save rather thanopen. At the top you will see a section on the table calledDATABASE. Leave blank. Under tables select the optionDROP + CREATE`. This looks sketch but your local database will be fine. Usually PHPmyadmin is annoying if there is a table that already exists.

Go to your PHPmyadmin in your server and import the file that was just created.

After that go to the wp_options table and replace the url’s of your old site to the new one. Wordmove does this for you if you were able to get the database to work but hey, you are reading this for a reason aren’t you?

Your site should be live. It’s not the most convenient way to do this but beggars can’t be choosers I guess.


#11

I am coming back to this question 2 month from when I posted my solution. When can we get an update on this?


#12

@lewismenelaws,

Can you please share the errors that you’re running into? Does @soderlind’s guide not work for you?

This is the most important step. If you run WordMove on your Mac or PC, you will have to install many more dependencies such as MySQL.