On Tue, May 10, 2011 at 11:51 AM, Christian Hammond <chip...@chipx86.com> wrote:
> Absolutely. What you can do is just generate a new site with rb-site after
> you install the eggs and reuse the existing database.

I did an upgrade from pre-1.0 SVN to 1.5.5 recently, and basically did
as Christian said and created a new site pointed at the old database,
then upgraded it (database evolutions). One issue was that the install
was so old it didn't have a siteconfig_siteconfiguration table, so
that had to be added. The upgrade moved the web server from EL5 using
mod_python to EL6 using mod_wsgi. Review Board was installed from
EPEL, PyLucene from a package I built.

Overview:
* ReviewBoard and PyLucene installed from RPMs
* Create a new site using local test database
* Dump the siteconfig_siteconfiguration table
* Drop the DB and re-create
* Restore the old DB and the new siteconfig table
* Do an rb-site upgrade
* Copy old uploads/images
* Test
* Dump the local DB and restore to production cluster
* Point site at production DB cluster

Details:

Configure and start memcached:
# sudo vi /etc/sysconfig/memcached # Not needed, we have more RAM than
we know what to do with
    CACHESIZE="1024"
# sudo chkconfig memcached on
# sudo service memcached start

Configure and start mysqld:
# sudo vi /etc/my.cnf
    max_allowed_packet=32M
# sudo chkconfig mysqld on
# sudo service mysqld start

Create an empty database:
# mysql -u root
    CREATE DATABASE rbtestdb;
    GRANT ALL PRIVILEGES ON rbtestdb.* TO 'rbtest'@'localhost'
IDENTIFIED BY 'password';

Create site, it will create files and load the database:
# sudo rb-site install /var/www/reviews

Modify permission where apache has to write:
# sudo chown -R apache:apache /var/www/reviews/htdocs/media/uploaded
# sudo chown -R apache:apache /var/www/reviews/data

Copy the apache config:
# sudo cp /var/www/reviews/conf/apache-wsgi.conf /etc/httpd/conf.d/reviews.conf

Start apache:
# sudo chkconfig httpd on
# sudo service httpd restart

Dump the siteconfig_siteconfiguration table, our old database doesn't have it.
# mysqldump --user=rbtest --password=password --add-drop-table
rbtestdb siteconfig_siteconfiguration > siteconfig.mysqldump

Extract an RB backup:
# tar -xvf reviewboard-backup.tar.gz

Drop and re-create the database:
# mysql -u root
# DROP DATABASE rbtestdb;
# CREATE DATABASE rbtestdb;
# GRANT ALL PRIVILEGES ON rbtestdb.* TO 'rbtest'@'localhost'
IDENTIFIED BY 'password';

Restore the backup database and siteconfig:
# mysql -u root -h localhost -D rbtestdb --max_allowed_packet=32M <
reviewboard-backup.mysqldump
# mysql -u root -h localhost -D rbtestdb --max_allowed_packet=32M <
siteconfig.mysqldump

Upgrade the site, this performs database evolutions:
# sudo rb-site upgrade /var/www/reviews

Copy images:
# Copy the files in reviewboard-backup/htdocs/media/uploaded/images/
to /var/www/reviews/htdocs/media/uploaded/images/
# sudo chown -R apache:apache /var/www/reviews/htdocs/media/uploaded

Probably should restart httpd and memcached at this point:
# sudo service httpd restart
# sudo service memcached restart

Search???:
# sudo mkdir -p /var/www/reviews/search-index
# sudo chown apache:apache /var/www/reviews/search-index
# sudo cp /var/www/reviews/conf/search-cron.conf /etc/cron.d/rb-index
    Should probably edit the above to run as apache
# Enable Search in WebUI, with path /var/www/reviews/search-index
# sudo -u apache "/usr/bin/python" "/usr/bin/rb-site" manage
"/var/www/reviews" index -- --full

Dump the database:
# mysqldump --user=rbtest --password=password --add-drop-table
rbtestdb > rbtest-real.mysqldump

Restore the database to a cluster:
# mysql -u root -h cluster
# CREATE DATABASE rbrealdb;
# GRANT ALL PRIVILEGES ON rbrealdb.* TO 'rbuser'@'%' IDENTIFIED BY 'password';
# mysql -u root -h cluster -D rbrealdb --max_allowed_packet=32M <
rbtest-real.mysqldump

Point the site at the DB cluster:
# sudo vi /var/www/reviews/conf/settings_local.py
# DATABASE_NAME = 'rbrealdb'
# DATABASE_USER = 'rbuser'
# DATABASE_PASSWORD = 'password'
# DATABASE_HOST = 'cluster'
# Clear browser Review Board cookies

Change apache config to force SSL:
# sudo vi /etc/httpd/conf.d/reviews.conf

Change name/URL in WebUI:
# Settings -> General
# Database -> Sites


Hope that help,
Anton

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en

Reply via email to