OGo needs a working PostgreSQL database to store its groupware data. Before
you can run OGo, you need to start the server, load the database schema and
ensure that the server can be connected using TCP/IP.
Below we assume that you installed the necessary PostgreSQL server packages
(different name on all distributions) and that the server is up and running
(is started using the distribution specific init script in /etc/).
Create Database and Database User
The first step is to create a new database for OGo. To do this, you need
to login as the Unix user "postgres" and create a database as well as a new
database user.
Be careful not to mix up the three different types of users, which are
a) the Unix user (eg 'postgres', 'ogo' or root),
b) the PostgreSQL database user (eg 'OGo')
and
c) the actual OGo login user (eg 'root', 'donald').
The first two are required for the infrastructure and the last is the
user login used for authentication.
$ su - root
# su - postgres
$ createdb OGo
$ createuser -A -D OGo
Load Database Schema
When this is done, you need to load the OGo database schema which is stored
in a file called pg-build-schema.psql.
In OGo 1.0a this is currently hidden in the OGo.model bundle:
/usr/local/lib/opengroupware.org-1.0a/commands/OGo.model/Resources/pg-build-schema.psql.
$ pushd /usr/local/lib/opengroupware.org-1.0a/commands/OGo.model
$ psql -h localhost OGo OGo
Welcome to psql 7.3.3, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
OGo=> \i Resources/pg-build-schema.psql
[output cut]
OGo=> \q
Ensure that TCP/IP Connect Works
In some PostgreSQL installations TCP/IP connect is not enabled per default
and sometimes the connect permissions are mixed up.
Ensure that TCP/IP connect works by issuing:
psql -h localhost OGo OGo
Do not continue until this works! (the -h localhost makes psql use
TCP/IP, the same mode OGo uses).
Configure OGo to use the Database
OGo 1.0a installations are preconfigured to connect the database 'OGo' as
user 'OGo' on localhost. So the configuration below is not strictly required
anymore.
Note that for deployment you should assign a password to the OGo DB user in
PostgreSQL and configure that in the LSConnectionDictionary.
# su - ogo
$ Defaults write NSGlobalDomain LSConnectionDictionary \
'{databaseName = OGo; hostName = localhost; password = \
""; port = 5432; userName = OGo}' # on one line
$ Defaults write NSGlobalDomain LSAdaptor PostgreSQL
Ensure that the write was successful using read:
$ Defaults read NSGlobalDomain LSConnectionDictionary
{
databaseName = OGo;
hostName = localhost;
password = "";
port = 5432;
userName = OGo;
}
Again: ensure TCP/IP is on! ;-)
It is important that you can connect PostgreSQL using TCP/IP because that
is the only mechanism supported by the OGo database adaptor in the moment.
So if you run into "cannot connect database" issues, you are probably missing
some PostgreSQL configuration.
To check whether TCP/IP properly works for your installation use that:
$ psql -h localhost OGo OGo
The -h localhost will trigger an TCP/IP connect. If the above does
not work for you, you may need to fix ~postgres/data/postgresql.conf
and enable the tcpip_socket option and you may need to setup
authentication in ~postgres/data/pg_hba.conf.
Note that ident authentication does not work with TCP/IP!