[CalendarServer-dev] [Calendar and Contacts Server] #441: Postgres is crashing on first request

Calendar and Contacts Server trac at macosforge.org
Thu Apr 28 00:39:36 PDT 2011


#441: Postgres is crashing on first request
----------------------------------------+-----------------------------------
 Reporter:  ian@…                       |       Owner:  wsanchez@…        
     Type:  Defect                      |      Status:  new               
 Priority:  3: Important                |   Milestone:  Linux Port        
Component:  Calendar Server             |    Severity:  Serious           
 Keywords:                              |       Radar:                    
----------------------------------------+-----------------------------------

Comment(by dre@…):

 Do you know for sure that postgres is crashing, or just never starting at
 all? The error.log only indicates that calendar server could not connect
 to postgres, but not why. Check for postgres.log and attach it to this
 ticket; maybe there's something obvious problem we can spot. If you're
 running the server out of svn checkout, the log should be at
 data/Logs/postgres.log, otherwise consult your postgres config to find the
 log location. In any case, if it is a real postgres crash, a bug should
 also be file against postgres.

 When running the server out of an svn checkout (using the 'run' script and
 the provided sample config files), the postgres lifecycle, database, and
 configuration are managed for you. This makes it easy to test in a
 sandbox, but this is not highly integrated with the host OS (which is kind
 of the point).

 When installing system-wide, you are responsible for all the postgres
 stuff (although we do have some tools to help). We haven't published any
 docs on this yet, so I'll discuss it a bit here for now.

 Check [https://trac.calendarserver.org/browser/CalendarServer/trunk/conf
 /caldavd-test.plist#L97 caldavd-test.plist] for an example of the config
 on the calendar server side; basically we just need details about which
 postgres server, database, and username to use. Ask your local postgres
 administrator for this info. If you are the local postgres administrator,
 you can use calendarserver_manage_postgres to help you create and manage
 the lifecycle of a new postres cluster (the postgres term for a set of
 databases), or you can use calendarserver_bootstrap_database to configure
 an existing postgres cluster for use by calendar server.

 calendarserver_manage_postgres is mostly a wrapper around various postgres
 command line tools - you can see what it's doing
 [https://trac.calendarserver.org/browser/CalendarServer/trunk/calendarserver/tools/managepostgres.py
 here]. It needs to know the location of your postgres base directory, e.g.
 /usr/local/pgsql or equivalent. If you don't feel like doing this as root,
 feel free to operate on a user-owned copy of pgsql, supplying the path
 along with the -d option. The command-line help for this tool is shown
 below for reference.

 {{{
 Usage: calendarserver_manage_postgres [options] ACTION

 Tool to manage PostgreSQL

 Options:
   --version             show program's version number and exit
   -h, --help            show this help message and exit
   -v, --verbose         Use debug logging for PostgreSQL
   -d BASEDIR, --base-dir=BASEDIR
                         Base directory for PostgreSQL install

 ACTION is one of init|start|stop|run

   init:   initialize databases
   start:  start postgres daemon
   stop:   stop postgres daemon
   run:    run postgres (non-daemon)
   clean:  remove databases
 }}}


 calendarserver_bootstrap_database is also a help that boils down to
 basically this, assuming postgres is installed and running as _postgres,
 our schema file is in the shown location, and these are run as root:
 {{{
 /usr/bin/createuser --username=_postgres caldav --no-superuser --createdb
 --no-createrole
 /usr/bin/createdb --username=caldav caldav
 /usr/bin/psql -U caldav -f
 /usr/share/caldavd/lib/python/txdav/common/datastore/sql_schema_v1.sql
 }}}

-- 
Ticket URL: <http://trac.calendarserver.org/ticket/441#comment:1>
Calendar and Contacts Server </>
HTTP/WebDAV/CalDAV Server


More information about the calendarserver-dev mailing list