2

I'm trying to automate the process of reproducing an existing GeoServer instance in an 'infrastructure as code' scenario. Ideally I'd like the ability to re-publish the contents of an existing GeoServer instance from configuration files stored in GitHub.

I've written the code to create a workspace, data store and layers programatically based on a config file, so now I need to know how to keep the config file up-to-date.

How can I detect when any changes are made to GeoServer's contents?

For example when someone publishes a new layer, is there an event fired by any processes, etc? I would listen for this event, and back up the current configuration at that time.

Stephen Lead
  • 21,119
  • 17
  • 113
  • 240
  • Not sure about your 'for example', but I can't see there being a mechanism for GeoServer knowing about changes to the underlying data, providing a WMS, WFS, WCS... The data itself is referenced by GeoServer, it shouldn't be see as contents of GeoServer... – nmtoken Jun 19 '17 at 07:23
  • you could look in the capabilities response to see a new layer, but making use of the JDBCConfig module may be an easier way to solve your problem – Ian Turton Jun 19 '17 at 07:46
  • You can also check the version number from the beginning of GetCapabilities <WMS_Capabilities version="1.3.0" updateSequence="155" I do not know what all changes are increasing the version number and how reliable it is. @iant probably knows it better than me or can check it from the code. – user30184 Jun 19 '17 at 08:08
  • not sure if updateSequenece will be any use, because it only reflects changes to the capabilities document, not necessarily the addition or removal of layers, features, coverages – nmtoken Jun 19 '17 at 10:23
  • Any catalog (store, layers, workspaces, styles) change triggers an update of the update sequence number, as well as any service configuration change. However security changes won't trigger its update, along with several plugin config changes (all of them are sending no events whatsoever, not even inside the GeoServer code, so if you need them too, a API change will be required) – Andrea Aime Jun 19 '17 at 13:14
  • But lets say you use updateSequence to discover that something has changed, you won't be any wiser in determining what has changed. – nmtoken Jun 19 '17 at 13:44
  • @nmtoken that may not be an issue, since I don't particular care exactly what has changed, just that GitHub has a copy of the latest config – Stephen Lead Jun 19 '17 at 22:57

0 Answers0