geonode icon indicating copy to clipboard operation
geonode copied to clipboard

Improve migrate_baseurl for mapstore2 and geoserver data_dir

Open t-book opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

  1. migrate the URL of a geonode instance
  2. try to add a map on a geostory
  3. The result is that mapfeatures are not loaded as the resource is still pointing to the old domain. (can be easily checked via the /mapstore/rest/ endpoint)

Describe the solution you'd like

To fix this problem I'm currently doing the following:

Replace URLs in postgres

UPDATE 
   mapstore2_adapter_mapstoredata 
SET 
   "blob" = REPLACE("blob"::text,'A.csgis.de','B.csgis.de')::jsonb;

Replace metadatalinks in geoserver data dir

find /geoserver_data -type f -name "*.xml" -print0 | xargs -0 sed -i 's#A.csgis.de#B.csgis.de#g'
curl -u admin:password -v -XPOST http://localhost:8080/geoserver/rest/reload

While this is working, I'd like to suggest extending the migrate_baseurl management command to also update mapstore2_adapter_mapstoredata next to geoserver data directory

t-book avatar Jun 04 '21 11:06 t-book

With GeoNode 4 now you have the "sync" button for maps, geostories and dashboards. Unfortunately there's no easy way to automate this, since GeoNode completely ignores the MapStore config content. We might consider to add a flag to the resource models to notify the client that a sync is required, and let the client sync automatically without user intervention.

giohappy avatar May 09 '22 11:05 giohappy