Opened 5 months ago

Last modified 3 months ago

#5689 new enhancement

Set PostGIS windows bundle environment for service rather than machine.

Reported by: slefranc Owned by: robe
Priority: medium Milestone: PostGIS Packaging
Component: install Version: 3.4.x
Keywords: windows Cc:

Description (last modified by slefranc)

The PostGIS Windows bundle (postgis-bundle-pg15x64-setup-3.3.2-2.exe) asks the user if they want to set environment variables during installation.

The environment is set at the machine level. This works for PostGIS itself, but can cause conflicts with other geospatial software. In our case, the GDAL variables (GDAL_DATA and PROJ_LIB) were conflicting with R's own GDAL libraries.

I was able to set the environment at the service level instead using the registry:

path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\postgresql-x64-15
name: Environment
REG_MULTI_SZ:
      GDAL_DATA=C:\Program Files\PostgreSQL\15\gdal-data
      POSTGIS_ENABLE_OUTDB_RASTERS=1
      POSTGIS_GDAL_ENABLED_DRIVERS=GTiff PNG JPEG GIF XYZ DTED USGSDEM AAIGrid
      PROJ_LIB=C:\Program Files\PostgreSQL\15\share\contrib\postgis-3.3\proj

This has worked so far in our teaching lab setup, but I haven't done thorough testing of all PostGIS functions.

Would it be possible to have the installer set the environment like this instead of globally, assuming it passes broader tests?

Change History (5)

comment:1 by slefranc, 5 months ago

Description: modified (diff)

comment:2 by robe, 5 months ago

Version: 3.3.x3.4.x

@slefranc,

What you propose if it works I think is preferable to the system. To be honest I was uncomfortable with the system setup too as it also causes issues if you have multiple PostgreSQL versions and they happen to use different versions of GDAL, which I try to avoid.

But anyrate I'll try to test this out and incorporate into the next version of the installer I release. I'm assuming if it is set at this level it would override the system one.

I probably won't be releasing a 3.3 version, so this will be in the next micro of 3.4 I release which I'm a bit behind on.

comment:3 by robe, 5 months ago

Owner: changed from strk to robe

comment:4 by robe, 3 months ago

I'm prepping to release the PostGIS 3.4.2 bundle with updates GDAL 3.8.5, pgRouting 3.6.2, and mobilitydb 1.1.1. I really wanted to get this change in this cycle, but I'm running into challenges with this formulating this in my NSIS installer.

The main issue is the regular environment variables, I can specify one at a time, but looks like with services, I've got to put it all in a single entry and in binary format.

This poses two issues

1) Just getting it in there 2) How to not clobber entries e.g. put in by something else since it's just a single blob.

I think it's doable but given the difficulty, I may need to punt this to 3.5 so I can get the installers out soon and also given this may not be that trivial of a change and might have other consequences.

Last edited 3 months ago by robe (previous) (diff)

comment:5 by robe, 3 months ago

This looks like it might work - https://nsis.sourceforge.io/REG_MULTI_SZ_Editor

There is also the registry plugin - https://nsis.sourceforge.io/Registry_plug-in

Note: See TracTickets for help on using tickets.