Setting up a Development copy of the masspirates.org blog

From Mass Pirate Wiki
Jump to navigationJump to search

Setting up a Development copy of the masspirates blog

source control

I've put wordpress (the masspirates blog) under git version control. The master git repository (on rose.mayfirst.org) is

 ~masspiratesweb/masspirates.org/include/git/blog  

Creating a local copy for development

To create your own copy of the masspirates.org blog,

 mkdir blog
 cd blog
 git clone ssh://masspiratesweb@rose.mayfirst.org/home/members/masspirateparty/sites/masspirates.org/users/masspiratesweb/masspirates.org/include/git/blog .

For now, I've excluded files in wp-content/uploads but I may change my mind about that in the future.

You'll need a MySQL database for your development environment. Like this:

 mysql> create database masspirates_wp default character set utf8;
 Query OK, 1 row affected (0.03 sec)
 mysql> grant all privileges on masspirates_wp.* to 'masspirates_wp'@'localhost' identified by 'SOME-PASSWORD';
 Query OK, 0 rows affected (0.00 sec)


Next, copy dev/sync.conf.sample to dev/sync.conf. Edit dev/sync.conf to provide local database parameters.

Next,

 cp wp-config-db.php.sample wp-config-db.php

Then provide the appropriate database configuration parameters in wp-config-db.php.

After you've done this much

 ./dev/sync.wordpress

sync.wordpress will download wp-content/uploads, create a backup of wordpress's database, and load that database backup on your local machine.

VirtualHost configuration

Without getting into the intracacies of web server configuration, you'll need to add a VirtualHost configuration that looks something like this.

 <VirtualHost localhost:80>
   ServerName masspirates.local
   ServerAlias masspirates.org
   DocumentRoot /home/www/masspirates.org
   <Directory /home/www/masspirates.org>
     AllowOverride all
   </Directory>
 </VirtualHost>

(These directives are for the apache web server)

You'll also need an /etc/hosts entry

127.0.0.1 masspirates.local
127.0.0.1 masspirates.org

Wordpress and piratenkleider (our Wordpress theme) are obsessed with fully-qualified URLs, and changing hostnames requires some minor surgery. You may find it easiest to repoint masspirates.org to your local machine (via an /etc/hosts entry).

To get my own development instance working, I also had to disable the wordpress-automatic-upgrade plugin, as follows:

 mkdir plugins-disabled
 mv plugins/wordpress-automatic-upgrade plugins-disabled/

pushing and deploying changes

To push changes from your machine to the master repository

 # assuming that you're pushing branch "master"
 git push origin master

To deploy those changes

 ssh masspiratesweb@rose.mayfirst.org
 cd ~/masspirates.org/web/blog
 git remote update
 git merge origin/master