Managing multiple WordPress blogs with SVK
August 12, 2006
This post is not an SVK tutorial; it simply describes how I use SVK to keep multiple blogs up to date whilst very conveniently keeping track of individual local changes to each site. The approach is essentially vendor branches with a twist.
Initial setup
I’ll pretend that you have an SVK depot already.
- Download a version of wordpress and unpack it
- cd ~/wordpress
- svk import //vendor/wordpress -m ‘importing wordpress vendor version’
- svk cp //vendor/wordpress //template -m ‘create template’
- import desired themes to //vendor/themes
- svk cp //vendor/themes/ //template/wp-content/themes -m ‘added themes to template’
- import desired plugins to //vendor/plugins
- svk cp //vendor/plugins/ //template/wp-content/plugins -m ‘added plugins to template’
- svk cp //template //yoursite.com -m ‘my site’
- svk co //yoursite.com /web/yoursite.com (assuming this is where your webserver expects it)
- cd /web/yoursite.com
- svk mv wp-config-sample.php wp-config.php [*]
- edit wp-config.php to point to your database
- svk ci -m ‘know where to find my db now’
If you want a second site, repeat the last five steps above.
[*] If you want, you can do this step on //template, before you copy it to //yoursite.com, instead.
Updating to a new version
Whenever you want to update your blogs (say, when 2.0.5 comes out) you just import that version over the current vendor version and merge it into your template:
- cd ~/wordpress-2.0.5
- svk ci –import //vendor/wordpress -m ‘upgrade to 2.0.5′
- svk smerge //vendor/wordpress //vendor/example.com/ -m ‘upgrade to 2.0.5′
Then, for each site, perform the following two steps:
- svk smerge -t //yoursite.com -m ‘upgrade to 2.0.5′
- svk up /web/yoursite.com
Making local changes that persist across upgrades
Making local changes is a doodle. In fact, you’ve already done this. Whenever you upgrade, the changes to wp-config.php will keep the changes you made to it. Let’s pretend, however, that you’ve made a change to a theme or a plugin, or to wordpress itself, that you want available in all your sites. Here’s how you do that:
- run svk log //yoursite.com and note the revision number of the changeset you want
- svk merge -c $REV //yoursite.com //template -m ‘propagate good change’
Then, update each site from the template as shown above under Updating to a new version.
Leave a Reply