Bugzilla

From wikinotes
Revision as of 13:53, 27 June 2021 by Will (talk | contribs) (→‎Configuration)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Install

TODO:

need to extend the size of mysql tables so that they can receive attachments


System

sudo pkg install mysql56-server bugzilla50 nginx perl5 fcgiwrap postfix

adduser www				## for nginx
adduser backup			## to backup fs, and database


#### /etc/rc.conf
sshd_enable="YES"
mysql_enable="YES"
nginx_enable="YES"
postfix_enable="YES"
fastcgi_enable="YES"
fastcgi_user="www"

####


## Set timezone
cp /usr/share/zoneinfo/America/Toronto /etc/localtime

MySQL

## Create the bugs database
CREATE DATABASE bugs;



## Create user backup for automated mysqldumps
GRANT   SELECT, LOCK TABLES, SHOW VIEW
ON      *.*
TO      'bugs'@'%'
IDENTIFIED BY <password>;


## Create user bugs, used by bugzilla
## to update the tables
GRANT   SELECT, 
        INSERT,
        UPDATE, 
		  DELETE, 
		  INDEX, 
		  ALTER, 
		  CREATE, 
		  LOCK TABLES,
        CREATE TEMPORARY TABLES, 
		  DROP, 
		  REFERENCES 

ON      bugs.*
TO      bugs@localhost IDENTIFIED BY <password>;



## Flush privileges so that new settings take effect
FLUSH PRIVILEGES;


fastcgiwrap

cgi scripts are written in Perl, nginx does not parse fcgi so you need something else nginx can use to render them. All configuration is done in /etc/rc.conf.



Nginx

## /usr/local/etc/nginx/nginx.conf                                                                                                                                                                                                     |1

                                                                                                                                                                                                                                       |
user www www;                                                                                                                                                                                                                          |
worker_processes 1;                                                                                                                                                                                                                    |
                                                                                                                                                                                                                                       |
events {                                                                                                                                                                                                                               |
   worker_connections 1024;                                                                                                                                                                                                            |
}                                                                                                                                                                                                                                      |
                                                                                                                                                                                                                                       |
                                                                                                                                                                                                                                       |
http {                                                                                                                                                                                                                                 |
                                                                                                                                                                                                                                       |
   ## Default page type is HTML with CSS                                                                                                                                                                                               |
   include       /usr/local/etc/nginx/mime.types;                                                                                                                                                                                      |
   default_type  application/octet-stream;                                                                                                                                                                                             |
                                                                                                                                                                                                                                       |
                                                                                                                                                                                                                                       |
   ## HTTP                                                                                                                                                                                                                             |
   server {                                                                                                                                                                                                                            |
      listen         80;                                                                                                                                                                                                               |
      server_name    localhost;                                                                                                                                                                                                        |
                                                                                                                                                                                                                                       |
      charset utf-8;                                                                                                                                                                                                                   |
      root       /usr/local/www/bugzilla;                                                                                                                                                                                              |
      index      index.cgi;                                                                                                                                                                                                            |
                                                                                                                                                                                                                                       |
                                                                                                                                                                                                                                       |
      location ~ ^.*\.cgi$ {                                                                                                                                                                                                           |
         fastcgi_pass    unix:/var/run/fcgiwrap/fcgiwrap.sock;                                                                                                                                                                         |
         fastcgi_index index.cgi;                                                                                                                                                                                                      |
         fastcgi_param SCRIPT_FILENAME /usr/local/www/bugzilla/$fastcgi_script_name;                                                                                                                                                   |
         include fastcgi_params;                                                                                                                                                                                                       |
                                                                                                                                                                                                                                       |
         ## Prevent 502 Bad Gateway                                                                                                                                                                                                    |
         #fastcgi_connect_timeout 60;                                                                                                                                                                                                  |
         #fastcgi_send_timeout 180;                                                                                                                                                                                                    |
         #fastcgi_read_timeout 180;                                                                                                                                                                                                    |
         #fastcgi_buffer_size 128k;                                                                                                                                                                                                    |
         #fastcgi_buffers 4 256k;                                                                                                                                                                                                      |
         #fastcgi_busy_buffers_size 256k;                                                                                                                                                                                              |
      }                                                                                                                                                                                                                                |
   }                                                                                                                                                                                                                                   |
}


postfix

http://bugzilla.readthedocs.io/en/latest/installing/essential-post-install-config.html

We don't need a full postfix install, we only need the sendmail (SMTP) portion of it. For the most part, the default config just works:

See postfix.

#### /usr/local/etc/postfix/main.cf
recipient_delimiter = +;

####
service postfix start
echo "Email Body" | mail -s "Test Subject" willjpittman@gmail.com		## check in spam

Bugzilla


## Bugzilla needs an assortment of PERL modules in order
## to start.

sudo -i
cd /usr/local/www/bugzilla

perl   installmodule.pl   MIME::Parser 
perl   installmodule.pl   LWP::UserAgent
perl   installmodule.pl   XML::Twig    
perl   installmodule.pl   Net::LDAP                                                                                                                                                                                                 |  3 #!TODO: kind of a major oversight. Currently the way tha this is working
perl   installmodule.pl   Authen::Radius                                                                                                                                                                                            |  2 #!      it is going to strip all comments from the output file. This should
perl   installmodule.pl   SOAP::Lite                                                                                                                                                                                                |  1 #!      be fixed...
perl   installmodule.pl   XMLRPC::Lite                                                                                                                                                                                              |30
perl   installmodule.pl   JSON::RPC                                                                                                                                                                                                 |  1
perl   installmodule.pl   Test::Taint                                                                                                                                                                                               |  2 class ModifyKeyVals( object ):
perl   installmodule.pl   Email::Reply                                                                                                                                                                                              |  3 +-- 87 lines: #@ __init__                                                                            --------------------------------------------------------------------------------------------------------------------
perl   installmodule.pl   HTML::FormatText::WithLinks                                                                                                                                                                               |  4 +-- 10 lines: #@ main                                                                                --------------------------------------------------------------------------------------------------------------------
perl   installmodule.pl   TheSchwartz                                                                                                                                                                                               |  5 +-- 13 lines: #@ _validate_args                                                                      --------------------------------------------------------------------------------------------------------------------
perl   installmodule.pl   Daemon::Generic                                                                                                                                                                                           |  6
perl   installmodule.pl   Apache2::SizeLimit                                                                                                                                                                                        |  7 +-- 17 lines: #@ strip_comments                                                                      --------------------------------------------------------------------------------------------------------------------
perl   installmodule.pl   File::MimeInfo::Magic                                                                                                                                                                                     |  8 +--109 lines: #@ _strip_multiline_comments                                                           --------------------------------------------------------------------------------------------------------------------
perl   installmodule.pl   IO::Scalar                                                                                                                                                                                                |  9 +-- 21 lines: #@ _strip_line_comments                                                                --------------------------------------------------------------------------------------------------------------------
perl   installmodule.pl   Cache::Memcached                                                                                                                                                                                          | 10
perl   installmodule.pl   File::Copy::Recursive                                                                                                                                                                                     | 11 +-- 32 lines: #@ write_tempfile                                                                      --------------------------------------------------------------------------------------------------------------------
perl   installmodule.pl   File::Which                                                                                                                                                                                               | 12 +-- 39 lines: #@ replace_keyvals                                                                     --------------------------------------------------------------------------------------------------------------------
perl   installmodule.pl   DBD::mysql                                                                                                                                                                                                | 13 +-- 17 lines: #@ write_to_config                                                                     --------------------------------------------------------------------------------------------------------------------
## Run Bugzilla Installer
sudo -i
cd    /usr/local/www/bugzilla
perl  checksetup.pl


Usage

Configuration

Administration > Bugzilla 

	Required Settings:
		- urlbase

	Maintainer:
		- user@domain.com

	User Authentication:
		- remember login: yes

	Bug Fields:
		- Default Priority: normal
		- Default Severity: normal

	Email:
		- mail_delivery_method: sendmail
		- mailfrom:             bugzilla@domain.com		## domain doesn't exist
																		#  that is alright. must match hostname's fake domain.