ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Migrate command

Open tedmasterweb opened this issue 8 years ago • 5 comments

We often have to migrate web sites from local dev machines or staging machines to production. The standard process is something like:

  1. Dump the database to a file
  2. Zip up the project (including the db dump)
  3. Copy the compressed archive to the new server
  4. Unzip the archive to the web root
  5. Import the database
  6. Search and replace URLs for the new domain
  7. Modify wp-config.php for the new database
  8. Pull our hair out wondering why some theme and plugin options didn't show up in the new site and end up either updating them manually or using the often fallible theme option import/export feature.

It would be great if wp-cli could assist in this process. I think most of the tools are already there (search-replace, generate a default wp-config file, etc.) but the migrate command would bundle the entire process and should probably be complimented with a deploy command as well.

I've tried to do this in bash and it mostly works but the restore script has issues. Also, I'm not using wp-cli in my script but I've already started writing code to use it as it does a much, much better job searching and replacing.

And regarding searching and replacing… I've noticed that revslider, and probably other plugins, stores URLs as http://domain.com/somedir/anotherdir etc. Neither my script nor wp-cli succeeds at matching this escaped URL but perhaps it's just out of scope and I'll have to learn to live with it.

I sure hope this gets included in a future version of wp-cli.

Thanks!

Ted Stresen-Reuter

tedmasterweb avatar Jan 20 '17 00:01 tedmasterweb

Related #14 and #5

Pull our hair out wondering why some theme and plugin options didn't show up in the new site and end up either updating them manually or using the often fallible theme option import/export feature.

I started on https://github.com/runcommand/manifest as a way to create a simple document representing the state of WordPress, such that you could easily compare before and after to verify the migration proceeded correctly.

And regarding searching and replacing… I've noticed that revslider, and probably other plugins, stores URLs as http://domain.com/somedir/anotherdir etc. Neither my script nor wp-cli succeeds at matching this escaped URL but perhaps it's just out of scope and I'll have to learn to live with it.

Can you open a new WP-CLI issue and provide test steps to reproduce?

danielbachhuber avatar Jan 20 '17 00:01 danielbachhuber

a way to create a simple document representing the state of WordPress

Will look into it, see if it can help. Thanks!

Can you open a new WP-CLI issue and provide test steps to reproduce?

You bet, where?

tedmasterweb avatar Jan 20 '17 01:01 tedmasterweb

Hi @tedmasterweb,

You bet, where?

You can post an issue here: https://github.com/wp-cli/wp-cli/issues

trepmal avatar Jan 20 '17 04:01 trepmal

Thanks @trepmal. All done: https://github.com/wp-cli/wp-cli/issues/3753

tedmasterweb avatar Jan 20 '17 10:01 tedmasterweb

And regarding searching and replacing… I've noticed that revslider, and probably other plugins, stores URLs as http://domain.com/somedir/anotherdir etc. Neither my script nor wp-cli succeeds at matching this escaped URL but perhaps it's just out of scope and I'll have to learn to live with it.

WP-CLI's search-replace cannot replace url's stored by revslider hence I have created a custom command for this, I have been using it since a long time now and it does get the job done.

Nikschavan avatar Feb 02 '17 16:02 Nikschavan