Dev & Production sites

wordpress

#1

Hi all,

As Dreamhost supports SVN I’ve been looking into trying to setup a production like environment where I have a dev and a live version of my WP site.

For example -
Dev - dev.wordpresssite.com
Live - wordpresssite.com

I do all my development work on the Dev site and then when happy with it deploy it to the live version.

Has anyone around here done this or have any experience trying to do the same/a similar thing?


#2

I have not, mostly because I’ve yet to address the biggest hurdle you’ll have with this: The database.

Using SVN for files is a great idea. Theme development versioning is something I should totally do. But the database is a whole different kettle of fish, and that’s where your posts, plugin and theme [em]settings[/em], and so on all live :confused:


#3

As Ipstenu pointed out, keeping the database in sync is difficult, especially if people are commenting on your live site while you are adding features and/or content to your dev site which is also modifying the database.

There are a few approaches to deal with it that I’m aware of:

[list]
[] use the same database for both live and dev but be very very careful that any changes made to the database on your end won’t show up in the live site until it receives the code changes
[
] make an SQL script as you develop which records all changes made to the dev database. Then, as part of updating the site, you run the script on your database at the same time you push your code changes.
[/list]

I’ve tried both approaches and for now I’m using the second. It’s a bit tricky if you are changing a table or field which is also being updated on live. What I’ve done in the past is make a parallel field with the new format or changes and make the code get and set both for a bit. Then, after the new code is uploaded, convert the previous format to the new format so that both columns are full and in sync, then delete the code that gets/sets the old field. Assuming everything works, delete that field entirely.

If anyone else has suggestions on sharing/syncing a database between live and dev, I’d be interested in hearing about it as well.


#4

Another approach I’ve used before is same database with different table prefixes for dev-site vs live-site. This has pro’s and con’s as well.

For theme development that might be overkill, sometime I think it’s best to just run separate databases, and pick points to refresh the dev database by importing new tables from a production backup.


#5

For content develeopment, I’ve heard good things about RAMP. http://crowdfavorite.com/wordpress/ramp/

I know the devs and they’re quite solid.


#6

Thanks for the info guys!

I thought that the database may be an issue. I’ve since spoken to someone I know who has a lot of knowledge in this area and he mentioned that there may also be problems with plugins too as some have directories hardcoded into them.