Friday, April 17, 2009

Multiple Bugzilla databases with a single installation

Dear All, Let me drop some comments in connection with my findings about Single Bugzilla but Multiple Databases

The Bugzilla guide is not wrong at all as mentioned previously. VirtualHost with Directory directive will work fine as these are related to Apache(2) web-server only. So Apache(2) and Bugzilla both need to be configure for the same. No Alias is needed at all or there is no need to make a soft link[e.g. ln -s xyz bugzilla] to the alreadey installed 'bugzilla' directory. Yes believe it first and then lets goon.

The bugzilla can be installed and configured later in two ways as follows:
1) Single Bugzilla with Multiple Databases
2) Multiple Bugzilla with Multiple Databases (in a single server) [There may be some other successful combinations]

Lets grab it in a little bit details:
Prerequisites :
There must be/exist a successful installation of bugzilla with MySQL, perl and Apache2-cgi [ GNU/Linux System, but windows system may also works in similar way - with IIS/Apache etc.], Perl etc. etc.

1) How to configure Single Bugzilla instance with Multiple Databases: {GNU/Linux} [Login into your Bugzilla Server using ssh/putty/shell as 'root'
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
A ) Make your web server ready:
- Let assume your old bugzilla database instance is accessible as [URL] http://bugzilla1.com [Local DNS server was configured in such way, if not assume it as http://192.168.1.11 instead http://bugzilla1.com]

- We are going to set up VirtualHost in Apache2 [ the old and new both URL but single instance of bugzilla]

- Let our new bugzilla [single instance] database will be accessible as http://bugzilla2.com

- So lets configure the Apache2 now
- check if the virtual.conf file is exists or not into the path /etc/apache2/conf.d [ if exists rename it by 'mv virtual.conf backup.virtual.conf' command else create new one and keep only following: NameVirtualHost * into this file and save and exit]
- go to the path /etc/apache2/sites-available and create two new file as bugzilla1.com, bugzilla2.com and enter the following 'VirtualHost' entries into the files


&ltVirtualHost *&gt
ServerName bugzillaN.com #[ N should be substitute by 1 and 2 as per this description, i.e. your bugzilla server's instance URL ]
SetEnv PROJECT bugzillaN
ServerAdmin your-email-id #[ the web server admin's email-id]
DocumentRoot "/.../bugzilla-3.2" #[ your only bugzilla installation/extraction path, this should be same for both file bugzilla1.com and bugzilla2.com for single instace of bugzilla]
AddHandler cgi-script cgi

&ltDirectory /&gt
Options FollowSymLinks
AllowOverride None
< /Directory >

&ltDirectory "/.../bugzilla-3.2" &gt #[ "/.../buhzilla-3.2" will be your bugzilla extracted directory i.e. the DocumentRoot from where the index.cgi page will be served]
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
allow from all
< /Directory >

ErrorLog /var/log/apache2/bugzillaN-error.log
LogLevel warn
CustomLog /var/log/apache2/bugzillaN-access.log combined
< / VirtualHost >

- Save the files and exit
- Now to enable these two site execute following command a2ensite bugzillaN.apt [ if you get no error your almost done]
- Now reload the apache2 daemon by following command /etc/init.c/apache2 reload [if no error, Congrats your web server is ready to listen request for http://bugzilla1.com [ with PROJECT=bugzilla1] and for http://bugzilla2.com [ with PROJECT=bugzilla2], apache will forward these environment variable to the bugzilla script index.cgi and rest will be handled by bugzilla instance.
-----------------------------------------------------------------------------------------------

B ) Make your bugzilla instance ready:
- go into the bugzilla installation/extracted directory [ assume it is /tmp/buhzilla-3.2, by cd /tmp/buhzilla-3.2 ]

- export the bugzilla1 environment variables [ by # export PROJECT=bugzilla1]
- execute the checksetup.pl script by command ./checksetup.pl or pl checksetup.pl
- the checksetup.pl will create localconfig.bugzill1 [bugzilla database configuration file for http://bugzilla1.com]
- edit this file and set db_user='bugzilla1User', db_name='bugzilla1_db', db_pass='bugzilla1Pass', and $webservergroup = '' and save and exit
- rerun the checksetup.pl by ./checksetup.pl
- It will throw an error about database connection is not possible [ Don't worry just keep patience, its normal]
- create MySQL login/user/credential for the bugzilla1User as follows [ #mysql -u root -p,
enter mysql root user password when it prompts, your prompt will be like this mysql > ,
- type following two SQL query at you mysql > prompt as follows
- mysql > GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugzilla1_db.* TO bugzilla1User@localhost IDENTIFIED BY 'bugzilla1Pass';
- mysql > FLUSH PRIVILEGES;

- no error!! congrats mysql user/login/credential created successfully. now exit from mysql as mysql > exit;
- rerun the checksetup.pl by[b] ./checksetup.pl[/b] [All databases related to bugzilla1.com will be created and you've to enter administrator e-mail, Real name, password etc. [ Repeat the above steps for bugzilla2.com after exporting the PROJECT=bugzilla2 ]

- Now Create the template folders for the sites bugzilla1.com and bugzilla2.com as follows [cp -r /tmp/bugzilla-3.2/template/en/default /tmp/bugzilla-3.2/template/en/bugzilla1 and cp -r /tmp/bugzilla-3.2/template/en/default /tmp/bugzilla-3.2/template/en/bugzilla2 respectively. ]
- you are 98% done. Congrats Folks
- Now set your local DNS so that you can access your sites by http://bugzilla1.com and http://bugzilla2.com [ if you don't want to set DNS right now jutst make similar entries into you local hosts file /etc/hosts 192.168.1.11 bugzilla1.com and
192.168.1.11 bugzilla2.com
- Now Try With Your Browser and configure you bugzilla settings/preferences/base URL etc. ....

- Reboot the system and check whether everything works fine.

-- That All Folks
[Himadri Sekhar Das,
APT Software Avenues Pvt. Ltd.
Kolkata, INDIA
contact: das.himuinkol@gmail.com]

PS: Dont forget to drop your comments and suggestions if any
REFs: http://www.bugzilla.org/docs/3.2/en/html/multiple-bz-dbs.html
http://www.debian-administration.org/articles/18

No comments:

Post a Comment