[CalendarServer-changes] [12031] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:17:34 PDT 2014
Revision: 12031
http://trac.calendarserver.org//changeset/12031
Author: sagen at apple.com
Date: 2013-12-04 10:02:33 -0800 (Wed, 04 Dec 2013)
Log Message:
-----------
Use a fixed path for postgres socket directory on OS X Server
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/util.py
CalendarServer/trunk/calendarserver/tools/backup_pg.py
CalendarServer/trunk/conf/caldavd-apple.plist
CalendarServer/trunk/twistedcaldav/stdconfig.py
CalendarServer/trunk/txdav/base/datastore/subpostgres.py
Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py 2013-12-04 03:47:41 UTC (rev 12030)
+++ CalendarServer/trunk/calendarserver/tap/util.py 2013-12-04 18:02:33 UTC (rev 12031)
@@ -130,7 +130,7 @@
databaseName=config.Postgres.DatabaseName,
clusterName=config.Postgres.ClusterName,
logFile=config.Postgres.LogFile,
- socketDir=config.RunRoot,
+ socketDir=config.Postgres.SocketDirectory,
listenAddresses=config.Postgres.ListenAddresses,
sharedBuffers=config.Postgres.SharedBuffers,
maxConnections=config.Postgres.MaxConnections,
Modified: CalendarServer/trunk/calendarserver/tools/backup_pg.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/backup_pg.py 2013-12-04 03:47:41 UTC (rev 12030)
+++ CalendarServer/trunk/calendarserver/tools/backup_pg.py 2013-12-04 18:02:33 UTC (rev 12031)
@@ -35,7 +35,7 @@
PSQL = "%s/usr/bin/psql" % (SIPP,)
PGDUMP = "%s/usr/bin/pg_dump" % (SIPP,)
-PGSOCKETDIR = "/Library/Server/PostgreSQL For Server Services/Socket"
+PGSOCKETDIR = "/var/run/caldavd/PostgresSocket"
def usage(e=None):
name = os.path.basename(sys.argv[0])
Modified: CalendarServer/trunk/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-apple.plist 2013-12-04 03:47:41 UTC (rev 12030)
+++ CalendarServer/trunk/conf/caldavd-apple.plist 2013-12-04 18:02:33 UTC (rev 12031)
@@ -123,6 +123,8 @@
<string>cluster.pg</string>
<key>LogFile</key>
<string>xpg_ctl.log</string>
+ <key>SocketDirectory</key>
+ <string>/var/run/caldavd/PostgresSocket</string>
</dict>
<!-- Data root -->
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2013-12-04 03:47:41 UTC (rev 12030)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2013-12-04 18:02:33 UTC (rev 12031)
@@ -950,6 +950,7 @@
"DatabaseName": "caldav",
"ClusterName": "cluster",
"LogFile": "postgres.log",
+ "SocketDirectory": "",
"ListenAddresses": [],
"SharedBuffers": 0, # BuffersToConnectionsRatio * MaxConnections
# Note: don't set this, it will be computed dynamically
Modified: CalendarServer/trunk/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/trunk/txdav/base/datastore/subpostgres.py 2013-12-04 03:47:41 UTC (rev 12030)
+++ CalendarServer/trunk/txdav/base/datastore/subpostgres.py 2013-12-04 18:02:33 UTC (rev 12031)
@@ -167,7 +167,7 @@
def __init__(self, dataStoreDirectory, subServiceFactory,
schema, resetSchema=False, databaseName='subpostgres',
clusterName="cluster",
- logFile="postgres.log", socketDir="/tmp",
+ logFile="postgres.log", socketDir="",
listenAddresses=[], sharedBuffers=30,
maxConnections=20, options=[],
testMode=False,
@@ -223,20 +223,15 @@
self.host, self.port = listenAddresses[0].split(":") if ":" in listenAddresses[0] else (listenAddresses[0], None,)
self.listenAddresses = [addr.split(":")[0] for addr in listenAddresses]
else:
- if socketDir:
- # Unix socket length path limit
- self.socketDir = CachingFilePath("%s/ccs_postgres_%s/" %
- (socketDir, md5(dataStoreDirectory.path).hexdigest()))
- if len(self.socketDir.path) > 64:
- socketDir = "/tmp"
- self.socketDir = CachingFilePath("/tmp/ccs_postgres_%s/" %
- (md5(dataStoreDirectory.path).hexdigest()))
- self.host = self.socketDir.path
- self.port = None
- else:
- self.socketDir = None
- self.host = "localhost"
- self.port = None
+ if not socketDir:
+ # Socket directory was not specified, so come up with one
+ # in /tmp and based on a hash of the data store directory
+ digest = md5(dataStoreDirectory.path).hexdigest()
+ socketDir = "/tmp/ccs_postgres_" + digest
+
+ self.socketDir = CachingFilePath(socketDir)
+ self.host = self.socketDir.path
+ self.port = None
self.listenAddresses = []
self.sharedBuffers = sharedBuffers if not testMode else 16
self.maxConnections = maxConnections if not testMode else 4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/74ccd1cd/attachment.html>
More information about the calendarserver-changes
mailing list