Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is there an easy way to empty out an install of a standalone Geoserver jar (i.e., delete all the examples) or do I have to do it through either the admin GUI or the RESTful interface? Can I just delete or munge some files in the work directory? Or is there a command line switch to tell it to never unpack the examples in the first place?

share|improve this question
    
Why do you want to do that btw and what version of Geoserver are you using? –  R.K. Sep 8 '12 at 7:40
    
I'm trying to create a Chef recipe to configure a Geoserver node for use in a production Web environment. I don't want to worry about serving up content that's not the content I intend to serve. I'm using Geoserver 2.1.4. –  gregsymons Sep 10 '12 at 15:09
    
Next time you ask a question, please do include that detail. What you've tried so far, too. We spend time trying to answer your question and it would be nice to know what you're going to use it for. –  R.K. Sep 11 '12 at 4:00

3 Answers 3

up vote 7 down vote accepted
  • If using the Web Archive:

download the war file and deploy it, then login and make all customizations (remove layers, adjust defaults, etc) until it suits you.

Now shutdown the servlet container, zip the geoserver directory and rename the resulting geoserver.zip as .war and you're done. A .war file in fact is just a .zip file in disguise.

IMPORTANT: when zipping the geoserver directory do it from inside the directory itself, not from the parent (which would be webapps if using tomcat). To check that you have done everything all right open the zip file: it should not have a lonely geoserver directory in the root folder.

  • If using the binary (OS independent) installer:

it works pretty much as above since the standalone installer is just an archive of geoserver deployed in a self-contained servlet container: unzip, start, customize, shutdown and zip again.

  • If you are using the os installers and want to keep using them, I'm afraid you will have to prep a custom build.

UPDATED AFTER USER COMMENT

Geoserver stores all its configuration in xml files in the data_dir directory. For the meaning of each folder and/or xml file see the official documentation.

After reading teh docs it seems clear that removing everything under the following directories will get you an empty geoserver:

  1. data_dir/workspaces : wipe the dir rm -rf data_dir/workspaces && mkdir data_dir/workspaces
  2. data_dir/layergroups : wipe the dir rm -rf data_dir/layergroups/*
  3. while not stritcly necessary, wipe the data directory too: rm -rf data_dir/data/*

Bootnote: The directions given at top still hold true, the above is just another way of clearing layer configuration data. I recommend that the the user also sets other important params like username/passwords, security and memory settings, logging, etc before going into production.

share|improve this answer
    
So basically, the only way to do it is to delete them in the GUI (or through the REST configuration interface) and then repackage the WAR? That's unfortunate. –  gregsymons Sep 10 '12 at 15:11
1  
You should have told us that you want to use chef. In that case how do you plan to install Geoserver in the first place (rpm, apt, wget&tar)? –  unicoletti Sep 10 '12 at 17:49
    
I'm downloading the "os-independent binary" from the website. I've got the basic cookbook to pull it down and start it up, I just want to empty it out before I start loading my layers. –  gregsymons Sep 10 '12 at 20:02
    
I've updated my answer –  unicoletti Sep 11 '12 at 6:57
    
Thanks. I think that covers all my options. I thought I might be able to do the deleting thing, but confirmation of my read of the documentation is helpful. –  gregsymons Sep 11 '12 at 14:48

I actually found a way that, at least in chef, is a little easier than any of the above. Rather than repackaging Geoserver to remove the examples or removing them after Geoserver unpacks them, you can create a minimal data directory with only the required files in it, and Geoserver will assume it's already unpacked the data directory.

The minimal data directory contains all the subdirectories in the documentation and the top level files. There may be less required, but I discovered this solution worked.

share|improve this answer

For what you want, I think it's best to build your own wars. According to this thread, a war with an empty data directory is the default behavior if you check out the sources and build it.

Here are some guides to get you started on building your own war.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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