Discussion:
How do you "version" content?
Dino Termini
2014-04-16 14:26:15 UTC
Permalink
Hello list,

I am setting up a git repo to manage my WordPress "stuff". I have a
somewhat clear idea of how to setup my environment.
However I would like to hear from the experts on what the best practices
are to synchronize and reconcile content.
In other words, how do you keep your dev/stg/prd databases in synch?
(both directions)

Thank you,
Dino.
Chris McCoy
2014-04-16 14:40:29 UTC
Permalink
You can use branches

http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
Post by Dino Termini
Hello list,
I am setting up a git repo to manage my WordPress "stuff". I have a
somewhat clear idea of how to setup my environment.
However I would like to hear from the experts on what the best practices
are to synchronize and reconcile content.
In other words, how do you keep your dev/stg/prd databases in synch?
(both directions)
Thank you,
Dino.
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Dino Termini
2014-04-16 14:44:09 UTC
Permalink
Post by Chris McCoy
You can use branches
http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
Would you care to elaborate on how that would apply to content stored in
your database? :)

Thank you,
Dino
Chris McCoy
2014-04-16 14:46:24 UTC
Permalink
ahh I misread that part.

For database I have used two methods, as mentioned before, migrate db pro
to pull and push, also ive used ramp by crowdfavourite.

http://crowdfavorite.com/ramp/
Post by Dino Termini
Post by Chris McCoy
You can use branches
http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
Would you care to elaborate on how that would apply to content stored in
your database? :)
Thank you,
Dino
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Nikola Nikolov
2014-04-16 14:42:13 UTC
Permalink
I personally haven't had the chance to get it yet, but I'd highly recommend
the Migrate DB Pro plugin(
https://deliciousbrains.com/wp-migrate-db-pro/). Although as I took a
look at their prices, I'm kind of sad :( The
developer version used to be like $100 for unlimited sites. Now it's $200
and limited to 100 installs(you can deactivate the license on any of your
sites, but still).
I would still say that even though it's much pricier now, it's still going
to make your life a whole lot easier. It has pull/push that is pretty easy
to use. They recently added a media add-on that allows you to sync your
media files as well.

Usually I would do one of the following things:
- Use Migrate DB(the free version) in order to get a DB export with new
URL's and then upload it to the target server
- Download a DB copy through phpMyAdmin, upload it to the new server and
if possible use wp-cli's search-replace command

They're both more time consuming, but right now I can't toss-away about 7
to 10 hours of paid work time just to get the plugin :)
Post by Dino Termini
Hello list,
I am setting up a git repo to manage my WordPress "stuff". I have a
somewhat clear idea of how to setup my environment.
However I would like to hear from the experts on what the best practices
are to synchronize and reconcile content.
In other words, how do you keep your dev/stg/prd databases in synch? (both
directions)
Thank you,
Dino.
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Jacob Snyder
2014-04-17 13:18:42 UTC
Permalink
I have started using Migrate DB Pro. It is definitely the best solution I
have found.

A paid service like https://managewp.com/ might also be good, but I haven't
really tried that.

It has been an ongoing issue for us to keep the databases synced quickly.
Migrate DB Pro has been the first good solution we have used. It can also
sync your upload directories. It costs money... For us it is a really small
amount when we compared it to man hours lost dealing with these things.
Expecially when new people come on to a project.

Once you set it up. You just pull and push somewhat similar to GIT.

-Jake.
Dino Termini
2014-04-17 15:08:21 UTC
Permalink
Thank you, Jacob.
Post by Jacob Snyder
I have started using Migrate DB Pro. It is definitely the best solution I
have found.
A paid service like https://managewp.com/ might also be good, but I haven't
really tried that.
It has been an ongoing issue for us to keep the databases synced quickly.
Migrate DB Pro has been the first good solution we have used. It can also
sync your upload directories. It costs money... For us it is a really small
amount when we compared it to man hours lost dealing with these things.
Expecially when new people come on to a project.
Once you set it up. You just pull and push somewhat similar to GIT.
-Jake.
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Mark Jaquith
2014-04-17 16:15:48 UTC
Permalink
I am setting up a git repo to manage my WordPress "stuff". I have a somewhat
clear idea of how to setup my environment.
However I would like to hear from the experts on what the best practices are
to synchronize and reconcile content.
In other words, how do you keep your dev/stg/prd databases in synch? (both
directions)
For pulling down from production to staging or production to a local
development environment, I use mysqldump and rsync. I have custom
Vagrant commands on my local environment that automate this. The
procedure is to have a command that SSHes into prod, makes a mysqldump
(use -r, not to-file redirection operator >) to a
NON-WEB-ACCESSABLE-LOCATION, then rsyncs the dump file to the location
(either staging or local), and runs the db import command. You could
also leverage WP-CLI for this on either or both ends (wp db export and
wp db import). I actually prefer to NOT gzip the dump file before
transferring, and then I make sure to enable the -z flag in rsync.
This is actually more efficient in my experience, because if you
already have a recent-ish dump file on the destination, it won't
transfer the whole thing, but will do a diff, and then compress those
changes on the fly. With a binary compressed format, it'll probably
have to send the whole thing every time.

Next, I rsync uploads from prod to staging. I don't do this to local
dev if there are more than a gig or two of uploads — instead I just
have my local VM's nginx config proxy static file 404s to the
production server. In the local VM, I'm using the production domain
(pointed to my VM), so no URL rejiggering. On staging, which has to be
publicly available for clients to inspect, I use this to change the
domain on the fly:
https://github.com/markjaquith/WP-Stack/blob/master/WordPress-Dropins/wp-stack-staging.php

I've also used output buffers on the whole page to do that swap for
other things.

This is pretty straightforward. What's trickier is when you want to
migrate content from staging to production. RAMP is a solution. You
could also just write migration scripts as an mu-plugin or as WP-CLI
scripts and run those.

Right now I'm working on a plugin that solves this issue… lets you hit
"record" locally, make changes, hit "stop", and get a PHP export of
the changes that you can check in, and will run on deploy. Hoping to
get that done in the next couple months.
--
Mark Jaquith
Loading...