Rt209 initacls.Pg fails to connect to Postgres database

Hi,

I believe I encountered a bug in the fix for

http://lists.fsck.com/pipermail/rt-users/2001-September/004252.html

Initacls.Pg is getting ‘localhost’ as the hostname, and passing it on to
psql with ‘-h localhost’, which in turn seems to cause psql to try to
connect via tcp/ip instead of a socket.

I modifed initacls.Pg to echo the psql call to the console. I have included
the make output below. I have include the following below: “make output”,
“modified initacls.Pg to echo psql call”, “Makefile”

As in the earlier post, initacls.Pg works if I remove the reference to
HOSTNAME in the call to psql.

Versions:
RT - 2.0.9
Postgres: 7.1.3-2
Red Hat Linux: 7.2-1
Perl: perl5 (revision 5.0 version 6 subversion 0)

make testdeps:
Checking for DBI 1.18 …found
Checking for DBIx::DataSource 0.02 …found
Checking for DBIx::SearchBuilder 0.47 …found
Checking for HTML::Entities…found
Checking for MLDBM…found
Checking for Net::Domain…found
Checking for Net::SMTP…found
Checking for Params::Validate 0.02 …found
Checking for HTML::Mason 0.896 …found
Checking for CGI::Cookie 1.20 …found
Checking for Apache::Cookie…found
Checking for Apache::Session 1.53 …found
Checking for Date::Parse…found
Checking for Date::Format…found
Checking for MIME::Entity 5.108 …found
Checking for Mail::Mailer 1.20 …found
Checking for Getopt::Long 2.24 …found
Checking for Tie::IxHash…found
Checking for Text::Wrapper…found
Checking for Text::Template…found
Checking for File::Spec 0.8 …found
Checking for Errno…found
Checking for FreezeThaw…found
Checking for File::Temp…found
Checking for Log::Dispatch 1.6 …found
Checking for DBD::Pg …found

I’m looking forward to getting it running. Thanks for the nice tool.

thanks,
Olaf

===========make output============
[root@localhost rt-2-0-9]# make install
mkdir -p file://opt/rt2/bin
mkdir -p file://opt/rt2/WebRT/data
mkdir -p file://opt/rt2/WebRT/sessiondata
mkdir -p file://opt/rt2/etc
mkdir -p file://opt/rt2/lib
mkdir -p file://opt/rt2/WebRT/html
mkdir -p file://opt/rt2/local/WebRT/html
/usr/bin/perl tools/initdb ‘Pg’ ‘/usr’ ‘localhost’ ‘’ ‘postgres’ 'rt2’
create
Database creation parameters:

DB_TYPE = Pg
DB_HOME = /usr
DB_HOST = localhost
DB_DBA = postgres
DB_DBA_PASSWORD =
DB_DATABASE = rt2
Now creating a database for RT.
Enter the Pg password for postgres:
Creating Pg database rt2.
dsn dbi:Pg:dbname=rt2
DB_DBA
DB_DBA_PASSWORD
/usr/bin/perl tools/initdb ‘Pg’ ‘/usr’ ‘localhost’ ‘’ ‘postgres’ 'rt2’
insert
Database creation parameters:

DB_TYPE = Pg
DB_HOME = /usr
DB_HOST = localhost
DB_DBA = postgres
DB_DBA_PASSWORD =
DB_DATABASE = rt2
Now populating database schema.
Enter the Pg password for postgres:
Creating database schema.
CREATE TABLE KeywordSelects (
id serial NOT NULL ,
Name varchar(255) ,
Keyword integer ,
Single integer ,
Depth integer NOT NULL DEFAULT 0 ,
ObjectType varchar(32) NOT NULL ,
ObjectField varchar(32) ,
ObjectValue varchar(255) ,
Disabled int2 NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence 'keywordselects_id_seq’
for SERIAL column ‘keywordselects.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
’keywordselects_pkey’ for table 'keywordselects’
CREATE INDEX KeywordSelects1 ON KeywordSelects (Keyword)
CREATE INDEX KeywordSelects2 ON KeywordSelects (ObjectType, ObjectField,
ObjectValue)
CREATE TABLE Attachments (
id serial NOT NULL ,
TransactionId integer NOT NULL ,
Parent integer ,
MessageId varchar(160) ,
Subject varchar(255) ,
Filename varchar(255) ,
ContentType varchar(80) ,
ContentEncoding varchar(80) ,
Content TEXT ,
Headers TEXT ,
Creator integer ,
Created timestamp ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘attachments_id_seq’ for
SERIAL column ‘attachments.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
’attachments_pkey’ for table 'attachments’
CREATE INDEX Attachments1 ON Attachments (Parent)
CREATE INDEX Attachments2 ON Attachments (TransactionId)
CREATE INDEX Attachments3 ON Attachments (Parent, TransactionId)
CREATE TABLE Queues (
id serial NOT NULL ,
Name varchar(120) NOT NULL ,
Description varchar(120) ,
CorrespondAddress varchar(120) ,
CommentAddress varchar(120) ,
InitialPriority integer ,
FinalPriority integer ,
DefaultDueIn integer ,
Creator integer ,
Created timestamp ,
LastUpdatedBy integer ,
LastUpdated timestamp ,
Disabled int2 NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘queues_id_seq’ for
SERIAL column 'queues.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'queues_pkey’
for table 'queues’
CREATE UNIQUE INDEX Queues1 ON Queues (Name)
CREATE TABLE Links (
id serial NOT NULL ,
Base varchar(240) ,
Target varchar(240) ,
Type varchar(20) NOT NULL ,
LocalTarget integer ,
LocalBase integer ,
LastUpdatedBy integer ,
LastUpdated timestamp ,
Creator integer ,
Created timestamp ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘links_id_seq’ for
SERIAL column 'links.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'links_pkey’
for table 'links’
CREATE UNIQUE INDEX Links1 ON Links (Base, Target, Type)
CREATE TABLE Groups (
id serial NOT NULL ,
Name varchar(16) ,
Description varchar(64) ,
Pseudo integer NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘groups_id_seq’ for
SERIAL column 'groups.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'groups_pkey’
for table 'groups’
CREATE UNIQUE INDEX Groups1 ON Groups (Name)
CREATE TABLE Watchers (
id serial NOT NULL ,
Type varchar(16) ,
Scope varchar(16) ,
Value integer ,
Email varchar(255) ,
Quiet integer ,
Owner integer ,
Creator integer ,
Created timestamp ,
LastUpdatedBy integer ,
LastUpdated timestamp ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘watchers_id_seq’ for
SERIAL column 'watchers.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'watchers_pkey’
for table 'watchers’
CREATE INDEX Watchers1 ON Watchers (Scope, Value, Type, Owner)
CREATE TABLE ScripConditions (
id serial NOT NULL ,
Name varchar(255) ,
Description varchar(255) ,
ExecModule varchar(60) ,
Argument varchar(255) ,
ApplicableTransTypes varchar(60) ,
Creator integer ,
Created timestamp ,
LastUpdatedBy integer ,
LastUpdated timestamp ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence 'scripconditions_id_seq’
for SERIAL column ‘scripconditions.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
’scripconditions_pkey’ for table 'scripconditions’
CREATE TABLE Transactions (
id serial NOT NULL ,
EffectiveTicket integer ,
Ticket integer ,
TimeTaken integer ,
Type varchar(20) ,
Field varchar(40) ,
OldValue varchar(255) ,
NewValue varchar(255) ,
Data varchar(100) ,
Creator integer ,
Created timestamp ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence 'transactions_id_seq’
for SERIAL column ‘transactions.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
’transactions_pkey’ for table 'transactions’
CREATE INDEX Transactions1 ON Transactions (Ticket)
CREATE INDEX Transactions2 ON Transactions (EffectiveTicket)
CREATE TABLE Scrips (
id serial NOT NULL ,
ScripCondition integer ,
ScripAction integer ,
Stage varchar(32) ,
Queue integer ,
Template integer ,
Creator integer ,
Created timestamp ,
LastUpdatedBy integer ,
LastUpdated timestamp ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘scrips_id_seq’ for
SERIAL column 'scrips.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'scrips_pkey’
for table 'scrips’
CREATE TABLE ACL (
id serial NOT NULL ,
PrincipalId integer ,
PrincipalType varchar(25) ,
RightName varchar(25) ,
RightScope varchar(25) ,
RightAppliesTo integer ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘acl_id_seq’ for SERIAL
column 'acl.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index ‘acl_pkey’ for
table 'acl’
CREATE INDEX ACL1 ON ACL (RightScope, PrincipalId)
CREATE INDEX ACL2 ON ACL (RightScope, RightAppliesTo, RightName,
PrincipalType, PrincipalId)
CREATE TABLE GroupMembers (
id serial NOT NULL ,
GroupId integer ,
UserId integer ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence 'groupmembers_id_seq’
for SERIAL column ‘groupmembers.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
’groupmembers_pkey’ for table 'groupmembers’
CREATE UNIQUE INDEX GroupMembers1 ON GroupMembers (GroupId, UserId)
CREATE TABLE ObjectKeywords (
id serial NOT NULL ,
Keyword integer NOT NULL ,
KeywordSelect integer NOT NULL ,
ObjectType varchar(32) NOT NULL ,
ObjectId integer NOT NULL ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence 'objectkeywords_id_seq’
for SERIAL column ‘objectkeywords.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
’objectkeywords_pkey’ for table 'objectkeywords’
CREATE UNIQUE INDEX ObjectKeywords1 ON ObjectKeywords (ObjectId, ObjectType,
KeywordSelect, Keyword)
CREATE INDEX ObjectKeywords2 ON ObjectKeywords (ObjectId, ObjectType)
CREATE INDEX ObjectKeywords3 ON ObjectKeywords (Keyword)
CREATE TABLE Keywords (
id serial NOT NULL ,
Name varchar(255) NOT NULL ,
Description varchar(255) ,
Parent integer ,
Disabled int2 NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘keywords_id_seq’ for
SERIAL column 'keywords.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'keywords_pkey’
for table 'keywords’
CREATE UNIQUE INDEX Keywords1 ON Keywords (Name, Parent)
CREATE INDEX Keywords2 ON Keywords (Name)
CREATE INDEX Keywords3 ON Keywords (Parent)
CREATE TABLE Users (
id serial NOT NULL ,
Name varchar(120) NOT NULL ,
Password varchar(40) ,
Comments TEXT ,
Signature TEXT ,
EmailAddress varchar(120) ,
FreeformContactInfo TEXT ,
Organization varchar(200) ,
Privileged integer ,
RealName varchar(120) ,
Nickname varchar(16) ,
Lang varchar(16) ,
EmailEncoding varchar(16) ,
WebEncoding varchar(16) ,
ExternalContactInfoId varchar(100) ,
ContactInfoSystem varchar(30) ,
ExternalAuthId varchar(100) ,
AuthSystem varchar(30) ,
Gecos varchar(16) ,
HomePhone varchar(30) ,
WorkPhone varchar(30) ,
MobilePhone varchar(30) ,
PagerPhone varchar(30) ,
Address1 varchar(200) ,
Address2 varchar(200) ,
City varchar(100) ,
State varchar(100) ,
Zip varchar(16) ,
Country varchar(50) ,
Creator integer ,
Created timestamp ,
LastUpdatedBy integer ,
LastUpdated timestamp ,
Disabled int2 NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘users_id_seq’ for
SERIAL column 'users.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'users_pkey’
for table ‘users’
CREATE UNIQUE INDEX Users1 ON Users (Name)
CREATE INDEX Users2 ON Users (Name)
CREATE INDEX Users3 ON Users (id, EmailAddress)
CREATE INDEX Users4 ON Users (EmailAddress)
CREATE TABLE Tickets (
id serial NOT NULL ,
EffectiveId integer ,
Queue integer ,
Type varchar(16) ,
IssueStatement integer ,
Resolution integer ,
Owner integer ,
Subject varchar(200) DEFAULT ‘[no subject]’ ,
InitialPriority integer ,
FinalPriority integer ,
Priority integer ,
Status varchar(10) ,
TimeWorked integer ,
TimeLeft integer ,
Told timestamp ,
Starts timestamp ,
Started timestamp ,
Due timestamp ,
Resolved timestamp ,
LastUpdatedBy integer ,
LastUpdated timestamp ,
Creator integer ,
Created timestamp ,
Disabled int2 NOT NULL DEFAULT 0 ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘tickets_id_seq’ for
SERIAL column ‘tickets.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index ‘tickets_pkey’
for table ‘tickets’
CREATE INDEX Tickets1 ON Tickets (Queue, Status)
CREATE INDEX Tickets2 ON Tickets (Owner)
CREATE INDEX Tickets3 ON Tickets (EffectiveId)
CREATE INDEX Tickets4 ON Tickets (id, Status)
CREATE INDEX Tickets5 ON Tickets (id, EffectiveId)
CREATE TABLE ScripActions (
id serial NOT NULL ,
Name varchar(255) ,
Description varchar(255) ,
ExecModule varchar(60) ,
Argument varchar(255) ,
Creator integer ,
Created timestamp ,
LastUpdatedBy integer ,
LastUpdated timestamp ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘scripactions_id_seq’
for SERIAL column ‘scripactions.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
’scripactions_pkey’ for table ‘scripactions’
CREATE TABLE Templates (
id serial NOT NULL ,
Queue integer NOT NULL DEFAULT 0 ,
Name varchar(40) NOT NULL ,
Description varchar(120) ,
Type varchar(16) ,
Language varchar(16) ,
TranslationOf integer ,
Content TEXT ,
LastUpdated timestamp ,
LastUpdatedBy integer ,
Creator integer ,
Created timestamp ,
PRIMARY KEY (id)
)
NOTICE: CREATE TABLE will create implicit sequence ‘templates_id_seq’ for
SERIAL column ‘templates.id
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
’templates_pkey’ for table ‘templates’
schema sucessfully inserted
cp etc/acl.Pg ‘//opt/rt2/etc/acl.Pg’
/usr/bin/perl -p -i -e " s’!!DB_TYPE!!’“Pg”‘g;
s’!!DB_HOST!!’“localhost”‘g;
s’!!DB_RT_PASS!!’“rt_pass”‘g;
s’!!DB_RT_HOST!!’“localhost”‘g;
s’!!DB_RT_USER!!’“rt_user”‘g;
s’!!DB_DATABASE!!’“rt2”‘g;"
file://opt/rt2/etc/acl.Pg
bin/initacls.Pg ‘/usr’ ‘localhost’ ‘’ ‘postgres’ ‘hithere’ ‘rt2’
’//opt/rt2/etc/acl.Pg’
Enter the postgres administrator’s database password to create a new user
for rt
psql -h localhost -d rt2 -f file://opt/rt2/etc/acl.Pg -U postgres
psql: connectDBStart() – connect() failed: Connection refused
Is the postmaster running (with -i) at 'localhost’
and accepting connections on TCP/IP port 5432?
make: *** [acls] Error 2

============== modified initacls.Pg to echo psql call ================
PATH=$PATH:$BINDIR
export PATH

echo “Enter the postgres administrator’s database password to create a new
user for rt”

if [ “fnord$PORT” != “fnord” ]; then
PORT="-p $PORT"
fi;

if [ “fnord$HOSTNAME” != “fnord” ]; then
HOSTNAME="-h $HOSTNAME"
fi;

echo psql $HOSTNAME $PORT -d $DATABASENAME -f $DATABASEACLS -U
$DATABASEADMIN
psql $HOSTNAME $PORT -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN

=======Makefile=========
[root@localhost rt-2-0-9]# view Makefile

$Header: /raid/cvsroot/rt/Makefile,v 1.142 2001/11/14 19:28:25 jesse Exp $

Request Tracker is Copyright 1996-2001 Jesse Vincent

<jessebestpractical.com>

RT is distributed under the terms of the GNU General Public License,

version 2

PERL = /usr/bin/perl

RT_VERSION_MAJOR = 2
RT_VERSION_MINOR = 0
RT_VERSION_PATCH = 9

RT_VERSION = $(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH)
TAG =
rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH)

BRANCH = HEAD

RTGROUP = rt

User which should own rt binaries

BIN_OWNER = root

User that should own all of RT’s libraries. generally root.

LIBS_OWNER = root

Group that should own all of RT’s libraries. generally root.

LIBS_GROUP = bin

{{{ Files and directories

DESTDIR allows you to specify that RT be installed somewhere other than

where it will eventually reside

DESTDIR =

[root@localhost rt-2-0-9]# cat Makefile

$Header: /raid/cvsroot/rt/Makefile,v 1.142 2001/11/14 19:28:25 jesse Exp $

Request Tracker is Copyright 1996-2001 Jesse Vincent

<jessebestpractical.com>

RT is distributed under the terms of the GNU General Public License,

version 2

PERL = /usr/bin/perl

RT_VERSION_MAJOR = 2
RT_VERSION_MINOR = 0
RT_VERSION_PATCH = 9

RT_VERSION = $(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH)
TAG =
rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH)

BRANCH = HEAD

RTGROUP = rt

User which should own rt binaries

BIN_OWNER = root

User that should own all of RT’s libraries. generally root.

LIBS_OWNER = root

Group that should own all of RT’s libraries. generally root.

LIBS_GROUP = bin

{{{ Files and directories

DESTDIR allows you to specify that RT be installed somewhere other than

where it will eventually reside

DESTDIR =

RT_PATH is the name of the directory you want make to install RT in

RT must be installed in its own directory (don’t set this to /usr/local)

RT_PATH = /opt/rt2

The rest of these paths are all configurable, but you probably don’t want

to

put them elsewhere

RT_LIB_PATH = $(RT_PATH)/lib
RT_ETC_PATH = $(RT_PATH)/etc
RT_BIN_PATH = $(RT_PATH)/bin
RT_MAN_PATH = $(RT_PATH)/man
MASON_HTML_PATH = $(RT_PATH)/WebRT/html

RT allows sites to overlay the default web ui with

local customizations Those files can be placed in MASON_LOCAL_HTML_PATH

MASON_LOCAL_HTML_PATH = $(RT_PATH)/local/WebRT/html

RT needs to be able to write to MASON_DATA_PATH and MASON_SESSION_PATH

RT will create and chown these directories. Don’t just set them to /tmp

MASON_DATA_PATH = $(RT_PATH)/WebRT/data
MASON_SESSION_PATH = $(RT_PATH)/WebRT/sessiondata

RT_LOG_PATH = /tmp

RT_READABLE_DIR_MODE is the mode of directories that are generally meant

to be

accessable

RT_READABLE_DIR_MODE = 0755

The location of your rt configuration file

RT_CONFIG = $(RT_ETC_PATH)/config.pm

RT_MODPERL_HANDLER is the mason handler script for mod_perl

RT_MODPERL_HANDLER = $(RT_BIN_PATH)/webmux.pl

RT_FASTCGI_HANDLER is the mason handler script for FastCGI

THIS HANDLER IS NOT CURRENTLY SUPPORTED

RT_FASTCGI_HANDLER = $(RT_BIN_PATH)/mason_handler.fcgi

RT_SPEEDYCGI_HANDLER is the mason handler script for SpeedyCGI

THIS HANDLER IS NOT CURRENTLY SUPPORTED

RT_SPEEDYCGI_HANDLER = $(RT_BIN_PATH)/mason_handler.scgi

The following are the names of the various binaries which make up RT

RT_CLI_BIN = $(RT_BIN_PATH)/rt
RT_CLI_ADMIN_BIN = $(RT_BIN_PATH)/rtadmin
RT_MAILGATE_BIN = $(RT_BIN_PATH)/rt-mailgate

}}}

{{{ Database setup

DB_TYPE defines what sort of database RT trys to talk to

“mysql” is known to work.

“Pg” is known to work

“Oracle” is in the early stages of working.

DB_TYPE = Pg

DB_HOME is where the Database’s commandline tools live

Note: $DB_HOME/bin is where the database binary tools are installed.

DB_HOME = /usr

Set DBA to the name of a unix account with the proper permissions and

environment to run your commandline SQL tools

Set DB_DBA to the name of a DB user with permission to create new

databases

Set DB_DBA_PASSWORD to that user’s password (if you don’t, you’ll be

prompted

later)

For mysql, you probably want ‘root’

For Pg, you probably want ‘postgres’

For oracle, you want ‘system’

DB_DBA = postgres
DB_DBA_PASSWORD = hithere

Set this to the Fully Qualified Domain Name of your database server.

If the database is local, rather than on a remote host, using “localhost”

will greatly enhance performance.

DB_HOST = localhost

If you’re not running your database server on its default port,

specifiy the port the database server is running on below.

It’s generally safe to leave this blank

DB_PORT =

Set this to the canonical name of the interface RT will be talking to the

database on. # If you said that the RT_DB_HOST above was “localhost,” this

should be too. This value will be used to grant rt access to the database.

If you want to access the RT database from multiple hosts, you’ll need

to grant those database rights by hand.

DB_RT_HOST = localhost

set this to the name you want to give to the RT database in

your database server. For Oracle, this should be the name of your sid

DB_DATABASE = rt2

Set this to the name of the rt database user

DB_RT_USER = rt_user

Set this to the password used by the rt database user

*** Change This Before Installation***

DB_RT_PASS = rt_pass

}}}

{{{ Web configuration

The user your webserver runs as. needed so that webrt can cache mason

objectcode

WEB_USER = nobody
WEB_GROUP = rt

}}}