Set up scmbug with subversion & bugzilla

First of all, please install bugzilla and subversion.
Regarding bugzilla, this is a post how to set up it, just click.

Regarding subversion, there is a wiki page, just click.
Simple commands:

$ sudo apt-get install subversion
$ sudo apt-get install libapache2-svn





Subversion is an open source version control system.
Bugzilla is an open source bug-tracking system.
This post share a way to let svn and bugzilla use same database with same users, group and authority.

To approve that, mod_auth_mysql is required, it is a module of apache.
install command:
$ sudo apt-get install libapache2-mod-auth-mysql 
you can check help docs in /usr/share/doc/libapache2-mod-auth-mysql
 
Configure subversion to let users of bugzilla can access its version repository.
Refer to WebADV protocol wiki, just do little change in
/etc/apache2/mods-available/dav_svn.conf is ok.

<Location /svn/myproject>
   DAV svn #use svn
   SVNPath /home/svn/myproject    #version repository path
   AuthType Basic  
   AuthName "myproject subversion repository"
   #AuthUserFile /etc/subversion/passwd     #comment it cause we will use mysql
   #<LimitExcept GET PROPFIND OPTIONS REPORT>
      Require valid-user   #need user permission valiate
   #</LimitExcept>
   Auth_MySQL  on   #use mysql do authority verification
   AuthUserFile /dev/null
   AuthBasicAuthoritative off
   ########important, please keep it same to the database of bugzilla#######
   Auth_MySQL_Host   localhost  #mysql database server
   Auth_MySQL_User   bugs       #the root account of mysql database
   Auth_MySQL_Password  bugzilla   #password
   Auth_MySQL_DB        bugs     #the shared database name
   ########refer to bugzilla database, important, do not change############ 
   Auth_MySQL_Password_Table    profiles   #帐号密码所在表名
   Auth_MySQL_Username_Field    login_name  #存储帐号名称的字段名
   Auth_MySQL_Password_Field    cryptpassword  #存储密码的字段名
   Auth_MySQL_Encryption_Types  Crypt   #密码的加密类型
</Location>

 
PS:
the instructions might not suitable for your mod_auth_mysql, please refer to  
/usr/share/doc/libapache2-mod-auth-mysql/DIRECTIVES.gz
and change to the corresponding instructions.

Bugzilla use SAH-256 to encrypt the password after 3.6 version.
but that in mod_auth_mysql is not supported, so I changed 
my bugzilla to 3.0.4 version.
yet, you also can patch mod_auth_mysql to support SAH-256, someone already did it.

Once done, restart apache2($sudo /etc/init.d/apache2 -restart).
subversion can use the database of bugzilla and share the same users.
open your subversion url, such as my url(http://localhost/svn/myproject/).
account and password is required to login, then input the same root account 
from bugzilla system is ok.

Ok. let's install and configure scmbug at last.
 
Install: 
scmbug download page, click me.
four debs scmbug-common、scmbug-doc、scmbug-server and scmbug-tools
install command ($dpkg -i xxx.deb)
 
Configure:
main change are red color:
/etc/scmbug/daemon.conf
 
    # Configuration information of the bug tracking
    # system
    bugtracker => {
        # The possible options are:
        # - 'Bugzilla'
        # - 'Mantis'
        # - 'RequestTracker'
        # - 'TestDirector'
        type => 'Bugzilla',
        # This MUST be in the format x.y.z, where x,y,z
        # are integers.
        version => '3.0.4',        #same with your bugzilla version
        database_location => '127.0.0.1',    #database server
        database_port => '3306',

        # Valid values are the ones accepted by the Perl DBI.
        #
        # For Bugzilla and RequestTracker, this value is ignored
        #
        # For Mantis, *some* valid values (there are others) are:
        # - 'MySQL'
        # - 'Pg'
        database_vendor => 'mysql',
        # For RequestTracker these values are ignored
        database_name => 'bugs',
        database_username => 'bugs',
        database_password => 'bugzilla',


        # Used only for Bugzilla.
        #
        # Flags whether the live bugtracker instance is installed
        # locally on the same machine the daemon is running
        installed_locally => 1,    #if bugzilla local installed, must set to 1

        # Used for Bugzilla and RequestTracker.
        #
        # Path to the directory of the bugtracker sources providing an
        # API that the daemon can use
        installation_directory => '/var/www/bugzilla',    #your bugzilla installed directory
...
...
 

Let's test.
1. start scmbug server
$ sudo /etc/init.d/scmbug-server start
how to check the server work well:
 ps ax | grep scmbug
183 ?        Ss     0:00 /usr/bin/perl /usr/sbin/scmbug_daemon.pl 
/etc/scmbug/daemon.conf
12190 pts/0    R+     0:00 grep --color=auto scmbug
 
The scmbug server not run well at the begining: 
check the log and found the error:
/var/log/scmbug/activity.log 

2010/12/09 19:33:12 Scmbug WARN> Daemon.pm:81:Scmbug::Daemon::Daemon::read_configuration - Read configuration file '/etc/scmbug/daemon.conf'
2010/12/09 19:33:12 Scmbug ERROR> Daemon.pm:329:Scmbug::Daemon::Daemon::check_configuration -
*******************************************
**
**
** Scmbug error 77: The userlist mappings are enabled, but no mappings are configured.
**
**
*******************************************
well, let's close userlist mappings.

        # Apply a case sensitive username verification
        case_sensitive_username_verification => 1,

        mappings => {

            # Enable SCM username translation. This flag must be
            # turned on for any of the mappings that follow to apply.
            enabled => 0,      #default is 1, change to 0
Then restart scmbug server, it works.
                                              
Install the glue for bugzilla and subversion.
First start scmbug server
#/etc/init.d/scmbug-server start
Then install command
$ sudo perl /usr/bin/scmbug_install_glue.pl --scm=Subversion  /
     --repository=file:///home/svn/myproject /
     --product=TestProduct --bug=770 --bin=/bin,/usr/bin,/usr/sbin --daemon=127.0.0.1
##################option###################################
--scm #use Subversion
--product #The product name that the bugs in bugzilla system belonging to
--repository #the repository directoy, file:// prefix is needed
--bug #the read/write permission for bugs, use 770
--binary-paths #the tools of svn, include all possible path
--daemon #127.0.0.1 the server
###################################################################
PS : no space in the product name, otherwise invalid product error will be reported.

Confirm your input via twice enter pressed:
his is the installation script of the Scmbug glue.
 The glue will be installed in repository: file:///home/svn/myproject.
 This is a repository for the Subversion SCM tool.
 The product name in the bug tracking system is TestProduct.
 The integration glue will be committed against bug 770.
 The IP address of the Scmbug integration daemon to contact is 127.0.0.1.
 The binary paths used are: /bin,/usr/bin,/usr/sbin.
 -------------
 Press Enter to continue or Ctrl-C to cancel


Glue processing has been prepared in /tmp/Scmbug.12267
Installing part 1
Check everything there before I commit. Hit Ctrl-C to exit or press Enter to continue.

Will chown 0 0 /home/svn/myproject/hooks/pre-commit
Will chown 0 0 /home/svn/myproject/hooks/post-commit
Glue processing has been prepared in /tmp/Scmbug.12267
Installing part 2
Check everything there before I commit. Hit Ctrl-C to exit or press Enter to continue.

If you can see above message, congraducation, glue installed well.
Subversion and bugzilla now is connected via glue daemon of scmbug.
The config file is /home/svn/myproject/hooks/etc/scmbug/glue.conf

No comments:

Post a Comment

fixed: embedded-redis: Unable to run on macOS Sonoma

Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...