Discussion:
[Geoserver-users] Cloning a workspace
Charles Galpin
2012-04-27 11:43:08 UTC
Permalink
I know I have asked this before, but far more often than I'd like I have the need to clone a workspace. Yes, essentially everything is identical except the DB name on the store (and the name of the workspace of course). I know there is a rest api but haven't been given time to automate this, nor do I have time myself otherwise I would do this for sure.

Can anyone who knows about the internals tell me if featureType ids are globally unique, or just unique per workspace? Because if not globally unique, I think I can just copy the workspace and change the namespace id, and store ids in all featuretype.xml and be done.

I just don't want to break anything while doing this :)

Thanks,
charles
Gabriel Roldan
2012-04-27 12:34:54 UTC
Permalink
Post by Charles Galpin
I know I have asked this before, but far more often than I'd like I have the need to clone a workspace. Yes, essentially everything is identical except the DB name on the store (and the name of the workspace of course). I know there is a rest api but haven't been given time to automate this, nor do I have time myself otherwise I would do this for sure.
Can anyone who knows about the internals tell me if featureType ids are globally unique, or just unique per workspace? Because if not globally unique, I think I can just copy the workspace and change the namespace id, and store ids in all featuretype.xml and be done.
they're globally unique, as per what the geoserver instance concerns.
They're going to become _globally_ unique when Andrea changes the
usage of UID by UUID.

It wouldn't be hard to create a "tool" (like in the tools menu in the
user interface) to copy or clone a workspace and all its contents.
Post by Charles Galpin
I just don't want to break anything while doing this :)
Thanks,
charles
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.
Andrea Aime
2012-04-27 16:08:13 UTC
Permalink
Post by Charles Galpin
Post by Charles Galpin
I know I have asked this before, but far more often than I'd like I have
the need to clone a workspace. Yes, essentially everything is identical
except the DB name on the store (and the name of the workspace of course).
I know there is a rest api but haven't been given time to automate this,
nor do I have time myself otherwise I would do this for sure.
Post by Charles Galpin
Can anyone who knows about the internals tell me if featureType ids are
globally unique, or just unique per workspace? Because if not globally
unique, I think I can just copy the workspace and change the namespace id,
and store ids in all featuretype.xml and be done.
they're globally unique, as per what the geoserver instance concerns.
They're going to become _globally_ unique when Andrea changes the
usage of UID by UUID.
Mind, if we are talking about a single instance of GeoServer, then the ids
need to be globally
unique inside of it. The change I proposed on trunk will make the ids
unique among different installations
of GeoSErver running on different machines, so that a central catalog can
use the id to collect info
among these different instances

Cheers
Andrea
--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------
Charles Galpin
2012-04-27 16:33:25 UTC
Permalink
Mind, if we are talking about a single instance of GeoServer, then the ids need to be globally
unique inside of it. The change I proposed on trunk will make the ids unique among different installations
of GeoSErver running on different machines, so that a central catalog can use the id to collect info
among these different instances
In my case, per instance unique is fine. Gabriel suggested there was nothing special about the format of the ids, so I went ahead and gave it a try. I I added a postfix to the *InfoImpl- in all the id names and it seems to have done the trick (without exhaustive testing). I perused the source code before doing so but honestly couldn't find anything dealing specifically with the id formats.

thanks,
charles
Ragnvald Larsen
2012-04-27 21:21:11 UTC
Permalink
Workspace cloning is a challenge we also are seeing in our work. We keep our geoservers running in a pool of currently two servers. Since we only have two servers running we are comfortable by duplicating the setup from geoserver1 to geoserver 2 manually through the GUI. We are however continuously considering adding more virtual "iron" to our setup should this be necessary. This is when the request from Charles Galpin becomes relevant.

What if we suddenly wanted to copy our complete setup to another server? I would suggest two command line level functions: exportsetup -f filename.zip and importsetup -filename.zip.

The functionality should be able to handle all dependencies so that one in theory could script the whole thing.

Cheers!

Ragnvald
Charles Galpin
2012-04-27 21:46:07 UTC
Permalink
Actually right now since UIDs are not universally global this case is easy - you just copy your workspaces directory to the new server and [re]start it.

I think in general a "copy" function at any level would be useful.

charles
Workspace cloning is a challenge we also are seeing in our work. We keep our geoservers running in a pool of currently two servers. Since we only have two servers running we are comfortable by duplicating the setup from geoserver1 to geoserver 2 manually through the GUI. We are however continuously considering adding more virtual “iron” to our setup should this be necessary. This is when the request from Charles Galpin becomes relevant.
What if we suddenly wanted to copy our complete setup to another server? I would suggest two command line level functions: exportsetup –f filename.zip and importsetup –filename.zip.
The functionality should be able to handle all dependencies so that one in theory could script the whole thing.
Cheers!
Ragnvald
maw269
2014-11-17 21:22:23 UTC
Permalink
Here is what worked for me:

Workspace Copying instructions
- Copy and rename existing workspace folder
- Open namespace.xml and fix <prefix> and <uri> params to match new
workspace folder name
- i.e. if you renamed the workspace from "wsp-myproject" to
"wsp-yourproject" the <prefix> becomes "wsp-yourproject" and the <uri>
becomes "http://yourdomain.com/wsp-yourproject"
- Open the workspace.xml and fix <name> param to match new workspace folder
name
- Open the datastore.xml files of any Database connections and delete the
Password and fix the rest of the params
- Delete any cached gwc tiles
- Open all the remaining *.xml files from new workspace folder
- Do a universal Find and Replace in all open documents using Notepad++:
Find: </id>
Replace: xyz</id>
Basically, add any unique identifier before the </id>
- Save all
- Restart GeoServer or reload configuration



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Cloning-a-workspace-tp4933664p5173396.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Joel Harris
2014-11-17 22:04:29 UTC
Permalink
I've written a java client that utilizes the rest interface to copy the
entire geoserver instance. I'm still improving it, but that this point it
can copy all of the configuration from one server instance, and distribute
that configuration to N number of other instances. It also creates a zip
file of the configuration which it can also distribute from as if it was
the source server. This is helpful for roll-back operations, or
distributing to other networks. I'm currently running over 12 instances of
geoserver on desperate networks and nodes, this allows me to setup one
geoserver instance with the GUI, then run the script and makes all other
instances on that network mirror the config. There are a couple
limitations at this point:

1) it doesn't get shapefiles
2) it is a copy of the config so if you want to specify a different
database connection you have to use JNDI which is perfect for me, but
perhaps not everyone.

https://github.com/GEOINT/geoserver-configuration-manager
Post by maw269
Workspace Copying instructions
- Copy and rename existing workspace folder
- Open namespace.xml and fix <prefix> and <uri> params to match new
workspace folder name
- i.e. if you renamed the workspace from "wsp-myproject" to
"wsp-yourproject" the <prefix> becomes "wsp-yourproject" and the <uri>
becomes "http://yourdomain.com/wsp-yourproject"
- Open the workspace.xml and fix <name> param to match new workspace folder
name
- Open the datastore.xml files of any Database connections and delete the
Password and fix the rest of the params
- Delete any cached gwc tiles
- Open all the remaining *.xml files from new workspace folder
Find: </id>
Replace: xyz</id>
Basically, add any unique identifier before the </id>
- Save all
- Restart GeoServer or reload configuration
--
http://osgeo-org.1560.x6.nabble.com/Cloning-a-workspace-tp4933664p5173396.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Loading...