13

Geoserver is running on a development and production environment. I would like to migrate just one workspace, store, layer, style, etc from development to production. How can I do this?

I know I can copy the entire data-dir to production and restart geoserver; but than all workspaces, stores, etc are migrated. The point is I want just one workspace, store, etc.

In the development environment I have several test workspace, store, and layers, which I do not want on production.

In the data-dir I see a directory gwc-layers, with a lot of xml-files. But how do I know which xml is which layer?

13

This is fairly simple to do and there's little risk. But be sure to have a backup of your production data directory anyway.

Just copy the following directories/files:

/workspaces/YOUR_WORKSPACE_NAME/ The workspace directory that you copy over actually contains the store and layer declarations as well as the workspace itself. Ideally in your setup you'll keep the "destined for production" and "testing" layers in separate workspaces, which will make this really easy in the future.

/layergroups/your_layer_group.xml - If you have a layergroup you want to copy.

styles\stylename.sld - styles\stylename.xml- This is the potentially tricky one; if you've renamed your style since you created it, the XML name and the SLD name won't be the same. The XML will be the current name, the SLD name will be whatever it was when you originally created it. You can look into the XML to see what SLD file it is referencing.

Once it's all copied, restart GeoServer.

Using this method I've previously manually transferred dozens of layers and a 200+ styles with little trouble.

  • 1
    yet another trick if the migration of datastores and layers do not work, just empty the password tag in datastore.xml in each datastore folder, i had a bug when migrating from 2.8 to 2.9, because of a problem in the hash of the passwords. – geogeek Apr 25 '17 at 21:27
  • I had to reapply the default style for layers that didn't have a custom style, but I didn't encounter any other problems. – Stijn Jul 6 '17 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.