Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
software:postgres:12 [2020/07/29 22:55] – ↷ Page moved and renamed from software:postgresql11 to software:postgres:12 christiansoftware:postgresql:pg12 [2020/12/30 01:42] – [Compiling PostgreSQL] christian
Line 1: Line 1:
 ====== PostgreSQL & PostGIS ====== ====== PostgreSQL & PostGIS ======
  
-Installing/upgrading to [[https://www.postgresql.org|PostgreSQL]] version 12.x and [[http://postgis.net|PostGIS]] version 3.0.1 on MacOS High Sierra (10.14.x).+Installing/upgrading to [[https://www.postgresql.org|PostgreSQL]] version 12.x and [[http://postgis.net|PostGIS]] version 3.0.1 on MacOS High Sierra (10.14.x and higher).
  
 <note important>This note is in draft stage and currently just a dump of snippets</note> <note important>This note is in draft stage and currently just a dump of snippets</note>
Line 10: Line 10:
  
 ===== Preparation ===== ===== Preparation =====
- 
  
 So I am leaving the dependencies to [[http://brew.sh|homebrew]] apart from GDAL (where I still use [[http://www.kyngchaos.com/software/frameworks/|William Kyngesbury's formidable GDAL Framework]] - at v 2.4.1 at time of writing) and [[https://python.org|Python.org's Python framework]] distribution - v.3.8. So I am leaving the dependencies to [[http://brew.sh|homebrew]] apart from GDAL (where I still use [[http://www.kyngchaos.com/software/frameworks/|William Kyngesbury's formidable GDAL Framework]] - at v 2.4.1 at time of writing) and [[https://python.org|Python.org's Python framework]] distribution - v.3.8.
Line 32: Line 31:
 After an upgrade of the OS it seems that the LaunchDaemon is broken. After an upgrade of the OS it seems that the LaunchDaemon is broken.
  
-On their [[http://opensource.apple.com|OpenSource pages]] Apple provides a template for one of the [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/|older included PostgreSQL versions (here: 9.0.4)]]. This deviates a bit from what I used previously for the LaunchDaemon file.+The issues I encounter are related to file permissions for the log file. In this case the user ''_postgresql'' does not have permissions to write to ''/var/log/Postgresql.log'' as only ''root'' as access here. This has likely changed between earlier Mac OS versions and Catalina (which is where the issue popped up).  
 + 
 +So there seems to be two options going forward: 
 + 
 +  - have ''pgsql'' directly log to the ''syslog'' 
 +  - use conventional ''stdout'' and ''stderr'' as log output directions, but change the logfile location  and permissions. 
 + 
 +On first sight is look as if option 1 is more elegant, but there is very little information as to how this should be set up and I have very little experience with ''syslog''
 + 
 +Here's a few links to get started: 
 + 
 +  * ''man asl.conf'' - manpage for Apple's system log tool 
 +  * [[https://nozaki.me/roller/kyle/entry/articles-postgres-log|Kohei Nozaki's blog entry]] on Postgresql using ''syslog'' 
 +  * [[https://superuser.com/questions/278231/how-to-disable-set-logging-level-preferences-per-mac-os-x-application| SO: log level prefs per OS X application]] 
 +  * [[https://superuser.com/questions/932013/asl-conf-doesnt-take-an-effect-on-my-enviroment-os-x-yosemite]] 
 +  * [[https://apple.stackexchange.com/questions/6559/setting-a-custom-log]] 
 +  * [[https://www.loggly.com/ultimate-guide/linux-logging-basics/|Linux logging basics]] 
 +  * [[https://apple.stackexchange.com/questions/338213/how-to-run-a-launchagent-that-runs-a-script-which-causes-failures-because-of-sys]] 
 +  * [[https://apple.stackexchange.com/questions/387592/how-to-use-launchd]] 
 +  * [[https://www.linuxwave.info/2018/12/send-postgresql-log-to-syslog.html|Getting postgresql write to syslog]] 
 +  * [[https://apple.stackexchange.com/questions/195997/running-postgres-as-launch-daemon]] 
 +  * [[https://developer.apple.com/documentation/os/logging]] 
 +  * [[https://apple.stackexchange.com/questions/357179/unified-logs-macos-high-sierra?rq=1]] 
 +  * [[https://apple.stackexchange.com/questions/162487/how-can-one-start-a-process-and-monitor-its-syslog-messages?rq=1]] 
 +  * [[https://apple.stackexchange.com/questions/390986/can-i-have-launchctl-output-stdout-stderr-from-my-application-to-the-system-wide?rq=1]] 
 +  * [[https://ilostmynotes.blogspot.com/2011/11/os-x-logging-aslconf-syslogconf-and.html]] 
 +  * [[https://www.unixtutorial.org/syslog-and-asl-in-macos/]] 
 +  * [[https://www.launchd.info]] 
 +  * [[https://superuser.com/questions/943983/os-x-launchdaemon-not-running-service-could-not-initialize]] 
 +  * [[https://stackoverflow.com/questions/27700596/homebrew-postgres-broken]] 
 +  * [https://apple.stackexchange.com/questions/322078/what-are-all-the-available-acl-attributes-in-mac-os-10-13-high-sierra]] 
 +  * [[https://unix.stackexchange.com/questions/479890/permission-to-write-to-log]] 
 +  * [[https://stackoverflow.com/questions/32160108/os-x-launchd-script-fails-to-run-at-startup?rq=1]] 
 +  *  
 + 
 + 
 + 
 + 
 +==== Setting up the LaunchDaemon ==== 
 + 
 +On their [[http://opensource.apple.com|OpenSource pages]] Apple provides a template for one of the  [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/|older included PostgreSQL versions (here: 9.0.4)]]. This deviates a bit from what I used previously for the LaunchDaemon file.
  
-Verbatim copy of [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/org.postgresql.postgres.plist.auto.html|of Apple's org.postgresql.postgres.plist on their opensource site]] :+[[https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html| Verbatim copy of [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/org.postgresql.postgres.plist.auto.html|of Apple's org.postgresql.postgres.plist on their opensource site]]:
  
 <file org.postgresql.postgres.plist> <file org.postgresql.postgres.plist>
Line 115: Line 154:
 </code> </code>
  
 +==== Starting the new PostgreSQL service ====
  
 +Once the 
  
 ===== PostGIS ===== ===== PostGIS =====
  
 <code> <code>
- ./configure --prefix=/usr/local/pgsql/11.x/ --with-projdir=/Library/Frameworks/PROJ.framework/unix/ --with-raster --with-topology --with-pgconfig=/usr/local/pgsql/11.x/bin/pg_config --with-geosconfig=/Library/Frameworks/GEOS.framework/unix/bin/geos-config + ./configure --prefix=/usr/local/pgsql/x.x/ --with-projdir=/Library/Frameworks/PROJ.framework/unix/ --with-raster --with-topology --with-pgconfig=/usr/local/pgsql/x.x/bin/pg_config --with-geosconfig=/Library/Frameworks/GEOS.framework/unix/bin/geos-config 
 </code> </code>
  
 {{tag>GIS Database MacOS PostGIS PostgreSQL compilation software}} {{tag>GIS Database MacOS PostGIS PostgreSQL compilation software}}