Closed macosforgebot closed 12 years ago
ian@… originally submitted this as attachment:error.log:ticket:441
error.log
@dreness originally submitted this as comment:1:ticket:441
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 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 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 helper tool that wraps postgres command-line tools, and it 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
ian@… originally submitted this as comment:2:ticket:441
It turns out that it didn't have permission to create the postgres.log and crashed.
@wsanchez originally submitted this as comment:3:ticket:441
So, config change fixed it?
ian@… originally submitted this as ticket:441
I've been trying to get this running as a production server on the standard ports. When I try to start the installed caldavd everything seems to be working until I actually send it a request, at which point I can see that postgres process has crashed and there is an error in the log.
Any help would be appreciated.