SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
Geoserver Shell
Administer Geoserver using a CLI

Jared Erickson
CUGOS July 2013
Outline
• What is Geoserver Shell?
• Why does Geoserver need a CLI?
• What are we administering with CLI?
• How does it work?
• What does it look like in action?
What is it?
• Administer Geoserver from a command
line interface (CLI)

• Uses Geoserver Rest interface
• Based on Spring Shell
• Uses GeoServer Manager and GeoTools
• Written in Java
• Open Source MIT License
• Hosted on Github
Why a CLI?
• Web UI is a major feature
• Non developers can load data and styles
• CLI is quick, efficient and scriptable
• Once a script is written it can be replayed

on other Geoservers (set up dev, then test,
then production)
Geoserver UI
Geoserver Catalog
• Workspace
• Namespace
• DataStore
• FeatureType
• CoverageStore
• Coverage

• Layer
• LayerGroups
• Style
• WMSStore
Geoserver Rest
•
•
•
•
•

Administer GeoServer without GUI

•

Integrate with 3rd party applications

Multiple representations: HTML, JSON, XML
HTTP Verbs: GET, POST, PUT, DELETE
HATEOS - linking
http://docs.geoserver.org/stable/en/user/rest/
index.html
Verbs
Commands

Verbs

list

GET

get

GET

create

POST

modify

PUT

delete

DELETE
Geoserver Rest UI
/geoserver/rest/layers
Client #1 = curl
•

Upload a Shapefile

curl -v -u admin:geoserver -XPUT -H "Content-type: application/zip" --data-binary
@roads.zip http://localhost:8080/geoserver/rest/workspaces/acme/datastores/roads/
file.shp

•

Create a Workspace

curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d
"<workspace><name>acme</name></workspace>" http://localhost:8080/geoserver/rest/
workspaces
Client #2 = Python
• gsconfig.py
• https://github.com/dwins/gsconfig.py/wiki
• Used by GeoNode
>>> from geoserver.catalog import Catalog
>>> cat = Catalog("http://localhost:8080/geoserver/rest", "admin",
"geoserver")
>>> cat.get_layers()
[Layer[Arc_Sample], Layer[Pk50095], Layer[Img_Sample], ...
>>> that_layer = cat.get_layer("roads")
>>> that_layer.enabled = False
>>> cat.save(that_layer)
Client #3 = Java
• Geoserver Manager Library
• https://github.com/geosolutions-it/
geoserver-manager

GeoServerRESTReader reader = new GeoServerRESTReader(url, user, password);
RESTStyleList styleList = reader.getStyles();
List<String> names = styleList.getNames();
GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(url, user, password);
publisher.createWorkspace(name);
Github

https://github.com/jericks/geoserver-shell
Install
• Download 0.1 release
• https://github.com/jericks/geoserver-shell/
releases

• Put bin directory on path
• run gs-shell
• Requires Java
Spring Shell
• Open source project from Spring Source
• Shell extracted from Spring Roo
• Spring Roo is a Java RAD tool for creating
web apps
Spring Shell
• Interactive shell environment
• Tab completion for commands, arguments,
and files

• History support (up and down arrows)
• Knows your commands and when you can
use them
Geoserver Shell
• Commands for each major Geoserver
Catalog item

• Methods in command construct a URL,

create a request body (xml, file) and make
an Http Request to Geoserver. The
Geoserver response is parsed and displayed
to the user
Commands
geoserver

datastore

ows

workspace

shapefile

settings

version

postgis

gwc

manifest

featuretype

wmsstore

namespace

coverage stores

style

coverage

template

worldimage

font

layers
Workspace Commands
• workspace list
• workspace create --name test
• workspace get --name test
• workspace delete --name test
• workspace default get
• workspace default set --name test
Workspace
gs-shell> geoserver set --url http://localhost:8080/geoserver
gs-shell> workspace create --name naturalearth
true
gs-shell> workspace list
topp
nurc
gs-shell> workspace get --name naturalearth
naturalearth
Shapefile
gs-shell> geoserver set --url http://localhost:8080/geoserver
gs-shell> workspace create --name naturalearth
true
gs-shell> shapefile zip --shapefile 110m_admin_0_countries.shp
true
gs-shell> shapefile publish --file 110m_admin_0_countries.zip -workspace naturalearth
true
PostGIS
gs-shell> geoserver set --url http://localhost:8080/geoserver
gs-shell> workspace create --name post
gs-shell> postgis datastore create --workspace post --datastore postgis -host localhost --port 5432 --database postgres --schema public --user
postgres --password postgres
true
gs-shell> featuretype list --workspace post --datastore postgis --list available
states
countries
cities
gs-shell> postgis featuretype publish --workspace post --datastore postgis -table 110m-admin-0-countries
true
GeoTiff
gs-shell> geoserver set --url http://localhost:8080/geoserver
gs-shell> coverage store upload --workspace naturalearth --file
GRAY_50M_SR_OB.zip --coveragestore world --type worldimage -configure first
true
gs-shell> coverage list --workspace naturalearth --coveragestore world
GRAY_50M_SR_OB
BLUE_MARBLE
gs-shell> coverage modify --workspace naturalearth --coveragestore world
--coverage GRAY_50M_SR_OB --srs EPSG:4326 --enabled true
true
Styles
gs-shell> style create --file 110m_admin_0_countries.sld --name
110m_admin_0_countries
true
gs-shell> layer style add --name 110m_admin_0_countries --style
110m_admin_0_countries
true
gs-shell> layer get --name 110m_admin_0_countries
110m_admin_0_countries
Title: null
Type:VECTOR
Abstract: null
Default Style: 110m_admin_0_countries
Namespace: Type String:VECTOR

gs-shell> layer modify --name 110m_admin_0_countries --defaultStyle
110m_admin_0_countries
true
Scripts
• Scripts contain the same commands entered
interactively

• History support saves session to geoservershell.log

$ gs-shell --cmdfile mycommands.gs
gs-shell> script --file naturalearth_countries.gs
Thank you!
Jared Erickson
jared.erickson@gmail.com
https://github.com/jericks

Más contenido relacionado

La actualidad más candente

Ground water hydrology
Ground water hydrologyGround water hydrology
Ground water hydrologySandra4Smiley
 
measurement of infiltration
measurement of infiltrationmeasurement of infiltration
measurement of infiltrationTharun Reddy
 
1 module run off (1)
1 module run off (1)1 module run off (1)
1 module run off (1)Riya Susan
 
Extrapolation of Stage Discharge Rating Curve
Extrapolation of Stage Discharge Rating CurveExtrapolation of Stage Discharge Rating Curve
Extrapolation of Stage Discharge Rating CurveBiswajit Dey
 
Infiltration equations and index
Infiltration equations and indexInfiltration equations and index
Infiltration equations and indexTharun Reddy
 
(Part ii)- open channels
(Part ii)- open channels(Part ii)- open channels
(Part ii)- open channelsMohsin Siddique
 
Reservoir capacity
Reservoir capacityReservoir capacity
Reservoir capacityonyx3
 
3 A’S Of Pediatric Compartment syndrome
3 A’S Of Pediatric Compartment syndrome3 A’S Of Pediatric Compartment syndrome
3 A’S Of Pediatric Compartment syndromeVasu Rao kaza
 
hydro chapter_11_hydrology_by louy al hami
hydro  chapter_11_hydrology_by louy al hami hydro  chapter_11_hydrology_by louy al hami
hydro chapter_11_hydrology_by louy al hami Louy Alhamy
 

La actualidad más candente (20)

Groundwater Hydrology
Groundwater HydrologyGroundwater Hydrology
Groundwater Hydrology
 
Biogeometry of flaps.ppt
Biogeometry of flaps.pptBiogeometry of flaps.ppt
Biogeometry of flaps.ppt
 
Ground water hydrology
Ground water hydrologyGround water hydrology
Ground water hydrology
 
Idf
IdfIdf
Idf
 
measurement of infiltration
measurement of infiltrationmeasurement of infiltration
measurement of infiltration
 
design of weirs
design of weirsdesign of weirs
design of weirs
 
1 module run off (1)
1 module run off (1)1 module run off (1)
1 module run off (1)
 
gilgel gibe dam
gilgel gibe damgilgel gibe dam
gilgel gibe dam
 
Extrapolation of Stage Discharge Rating Curve
Extrapolation of Stage Discharge Rating CurveExtrapolation of Stage Discharge Rating Curve
Extrapolation of Stage Discharge Rating Curve
 
Infiltration equations and index
Infiltration equations and indexInfiltration equations and index
Infiltration equations and index
 
Introduction to Engineering Hydrology
Introduction to Engineering HydrologyIntroduction to Engineering Hydrology
Introduction to Engineering Hydrology
 
Soil strength
Soil strengthSoil strength
Soil strength
 
(Part ii)- open channels
(Part ii)- open channels(Part ii)- open channels
(Part ii)- open channels
 
Reservoir capacity
Reservoir capacityReservoir capacity
Reservoir capacity
 
Flood routing
Flood routingFlood routing
Flood routing
 
03 darcys law
03 darcys law03 darcys law
03 darcys law
 
Irrigation Engineering
Irrigation EngineeringIrrigation Engineering
Irrigation Engineering
 
3 A’S Of Pediatric Compartment syndrome
3 A’S Of Pediatric Compartment syndrome3 A’S Of Pediatric Compartment syndrome
3 A’S Of Pediatric Compartment syndrome
 
hydro chapter_11_hydrology_by louy al hami
hydro  chapter_11_hydrology_by louy al hami hydro  chapter_11_hydrology_by louy al hami
hydro chapter_11_hydrology_by louy al hami
 
CE-235 EH Lec 3
CE-235 EH Lec 3CE-235 EH Lec 3
CE-235 EH Lec 3
 

Similar a Administer GeoServer from the command line with GeoServer Shell

WildFly v9 - State of the Union Session at Voxxed, Istanbul, May/9th 2015.
WildFly v9 - State of the Union Session at Voxxed, Istanbul, May/9th 2015.WildFly v9 - State of the Union Session at Voxxed, Istanbul, May/9th 2015.
WildFly v9 - State of the Union Session at Voxxed, Istanbul, May/9th 2015.Dimitris Andreadis
 
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...seleniumconf
 
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...44CON
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache UsergridDavid M. Johnson
 
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...J V
 
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
MariaDB 10.1   what's new and what's coming in 10.2 - Tokyo MariaDB MeetupMariaDB 10.1   what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB MeetupColin Charles
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS偉格 高
 
Introduction to Node (15th May 2017)
Introduction to Node (15th May 2017)Introduction to Node (15th May 2017)
Introduction to Node (15th May 2017)Lucas Jellema
 
Running Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on HadoopRunning Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on Hadoopclairvoyantllc
 
JS - The Unknown Basics.pptx
JS - The Unknown Basics.pptxJS - The Unknown Basics.pptx
JS - The Unknown Basics.pptxParveenSoni21
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersRob Windsor
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and ActivatorKevin Webber
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure DataTaro L. Saito
 

Similar a Administer GeoServer from the command line with GeoServer Shell (20)

WildFly v9 - State of the Union Session at Voxxed, Istanbul, May/9th 2015.
WildFly v9 - State of the Union Session at Voxxed, Istanbul, May/9th 2015.WildFly v9 - State of the Union Session at Voxxed, Istanbul, May/9th 2015.
WildFly v9 - State of the Union Session at Voxxed, Istanbul, May/9th 2015.
 
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
 
JSF2
JSF2JSF2
JSF2
 
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
 
GoDocker presentation
GoDocker presentationGoDocker presentation
GoDocker presentation
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
 
Javascript & Jquery
Javascript & JqueryJavascript & Jquery
Javascript & Jquery
 
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
 
Liberty Deep Dive
Liberty Deep DiveLiberty Deep Dive
Liberty Deep Dive
 
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
MariaDB 10.1   what's new and what's coming in 10.2 - Tokyo MariaDB MeetupMariaDB 10.1   what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
 
Introduction to Node (15th May 2017)
Introduction to Node (15th May 2017)Introduction to Node (15th May 2017)
Introduction to Node (15th May 2017)
 
Running Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on HadoopRunning Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on Hadoop
 
JS - The Unknown Basics.pptx
JS - The Unknown Basics.pptxJS - The Unknown Basics.pptx
JS - The Unknown Basics.pptx
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint Developers
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Nodejs web,db,hosting
Nodejs web,db,hostingNodejs web,db,hosting
Nodejs web,db,hosting
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure Data
 

Último

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Último (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Administer GeoServer from the command line with GeoServer Shell

  • 1. Geoserver Shell Administer Geoserver using a CLI Jared Erickson CUGOS July 2013
  • 2. Outline • What is Geoserver Shell? • Why does Geoserver need a CLI? • What are we administering with CLI? • How does it work? • What does it look like in action?
  • 3. What is it? • Administer Geoserver from a command line interface (CLI) • Uses Geoserver Rest interface • Based on Spring Shell • Uses GeoServer Manager and GeoTools • Written in Java • Open Source MIT License • Hosted on Github
  • 4. Why a CLI? • Web UI is a major feature • Non developers can load data and styles • CLI is quick, efficient and scriptable • Once a script is written it can be replayed on other Geoservers (set up dev, then test, then production)
  • 6. Geoserver Catalog • Workspace • Namespace • DataStore • FeatureType • CoverageStore • Coverage • Layer • LayerGroups • Style • WMSStore
  • 7. Geoserver Rest • • • • • Administer GeoServer without GUI • Integrate with 3rd party applications Multiple representations: HTML, JSON, XML HTTP Verbs: GET, POST, PUT, DELETE HATEOS - linking http://docs.geoserver.org/stable/en/user/rest/ index.html
  • 11. Client #1 = curl • Upload a Shapefile curl -v -u admin:geoserver -XPUT -H "Content-type: application/zip" --data-binary @roads.zip http://localhost:8080/geoserver/rest/workspaces/acme/datastores/roads/ file.shp • Create a Workspace curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d "<workspace><name>acme</name></workspace>" http://localhost:8080/geoserver/rest/ workspaces
  • 12. Client #2 = Python • gsconfig.py • https://github.com/dwins/gsconfig.py/wiki • Used by GeoNode >>> from geoserver.catalog import Catalog >>> cat = Catalog("http://localhost:8080/geoserver/rest", "admin", "geoserver") >>> cat.get_layers() [Layer[Arc_Sample], Layer[Pk50095], Layer[Img_Sample], ... >>> that_layer = cat.get_layer("roads") >>> that_layer.enabled = False >>> cat.save(that_layer)
  • 13. Client #3 = Java • Geoserver Manager Library • https://github.com/geosolutions-it/ geoserver-manager GeoServerRESTReader reader = new GeoServerRESTReader(url, user, password); RESTStyleList styleList = reader.getStyles(); List<String> names = styleList.getNames(); GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(url, user, password); publisher.createWorkspace(name);
  • 15. Install • Download 0.1 release • https://github.com/jericks/geoserver-shell/ releases • Put bin directory on path • run gs-shell • Requires Java
  • 16. Spring Shell • Open source project from Spring Source • Shell extracted from Spring Roo • Spring Roo is a Java RAD tool for creating web apps
  • 17. Spring Shell • Interactive shell environment • Tab completion for commands, arguments, and files • History support (up and down arrows) • Knows your commands and when you can use them
  • 18. Geoserver Shell • Commands for each major Geoserver Catalog item • Methods in command construct a URL, create a request body (xml, file) and make an Http Request to Geoserver. The Geoserver response is parsed and displayed to the user
  • 20. Workspace Commands • workspace list • workspace create --name test • workspace get --name test • workspace delete --name test • workspace default get • workspace default set --name test
  • 21. Workspace gs-shell> geoserver set --url http://localhost:8080/geoserver gs-shell> workspace create --name naturalearth true gs-shell> workspace list topp nurc gs-shell> workspace get --name naturalearth naturalearth
  • 22. Shapefile gs-shell> geoserver set --url http://localhost:8080/geoserver gs-shell> workspace create --name naturalearth true gs-shell> shapefile zip --shapefile 110m_admin_0_countries.shp true gs-shell> shapefile publish --file 110m_admin_0_countries.zip -workspace naturalearth true
  • 23. PostGIS gs-shell> geoserver set --url http://localhost:8080/geoserver gs-shell> workspace create --name post gs-shell> postgis datastore create --workspace post --datastore postgis -host localhost --port 5432 --database postgres --schema public --user postgres --password postgres true gs-shell> featuretype list --workspace post --datastore postgis --list available states countries cities gs-shell> postgis featuretype publish --workspace post --datastore postgis -table 110m-admin-0-countries true
  • 24. GeoTiff gs-shell> geoserver set --url http://localhost:8080/geoserver gs-shell> coverage store upload --workspace naturalearth --file GRAY_50M_SR_OB.zip --coveragestore world --type worldimage -configure first true gs-shell> coverage list --workspace naturalearth --coveragestore world GRAY_50M_SR_OB BLUE_MARBLE gs-shell> coverage modify --workspace naturalearth --coveragestore world --coverage GRAY_50M_SR_OB --srs EPSG:4326 --enabled true true
  • 25. Styles gs-shell> style create --file 110m_admin_0_countries.sld --name 110m_admin_0_countries true gs-shell> layer style add --name 110m_admin_0_countries --style 110m_admin_0_countries true gs-shell> layer get --name 110m_admin_0_countries 110m_admin_0_countries Title: null Type:VECTOR Abstract: null Default Style: 110m_admin_0_countries Namespace: Type String:VECTOR gs-shell> layer modify --name 110m_admin_0_countries --defaultStyle 110m_admin_0_countries true
  • 26. Scripts • Scripts contain the same commands entered interactively • History support saves session to geoservershell.log $ gs-shell --cmdfile mycommands.gs gs-shell> script --file naturalearth_countries.gs