Note on PostgreSQL module on +Joyent

I have a client that chose +Joyent Accelerator as the hosting platform for their next generation web application. I was happily greeted by Virtualmin over there! Makes my job easier!

Only problem, I had quite a difficult time trying to get PostgreSQL to work on their server inside Virtualmin/Webmin. So here is a little rundown on what I did. On the Virtualmin System Information screen, I have the yellow check configuration notice. I run the check, and it errors with:

PostgreSQL does not appear to be installed and running on your system, or has not yet been set up properly in Webmin’s PostgreSQL Database module. If your system does not use PostgreSQL, it should be disabled in Virtualmin’s module configuration page.

… your system is not ready for use by Virtualmin.

I got to the PostgreSQL Database module… and it says the following:

The PostgreSQL host configuration file /opt/csw/var/pgdata/pg_hba.conf was not found on your system. Maybe PostgreSQL has not been initialised, or your module configuration is incorrect.

So I find out that the cluster hasn’t been initialized. So i set it up (from some recommendations http://forum.textdrive.com/viewtopic.php?pid=146460 ) in /home/postgres/data. I go in and configure the postgres module to now point to all the correct info.

Now I’m happily greeted with the button to start up PostgreSQL server. I fire her up, and I’m then thrown this message.

Failed to start database server :
FATAL: parameter "work_mem" requires an integer value

Turns out, the default command used for starting postgres on Webmin is postmater. it appears that Postmaster is a deprecated alias to postgres command. And one change is that -S flag, which used to mean silent mode, is now to set sort memory size.
Here is a link on it.
http://archives.postgresql.org/pgsql-admin/2006-12/msg00341.php

So I changed my startup command to
su postgres -c “/opt/csw/postgresql/bin/pg_ctl start -D /home/postgres/data -l /home/postgres/log/postgres.log -o -i”
and my stop command to
su postgres -c ‘/opt/csw/postgresql/bin/pg_ctl stop -D /home/postgres/data’

Works like a champ now!

Hey Sean,

You’re a gentleman and a scholar, and that’s some awe-inspiring troubleshooting.

I’ll file a bug about this mismatch in Webmin and it’ll get fixed soon.

Yeah, that’s some impressive work to debug this!

However, it can’t be fully fixed in Webmin - it looks like Joyent have modified the default configuration of Webmin’s PostgreSQL module to suit their environment, so you should suggest to them that they make the same change to that config…

Updated Joyent’s document Wiki

http://wiki.joyent.com/accelerators:setup_postgresql