Frequently Asked Questions#
Common questions about using GeoServer CLI.
General#
What is GeoServer CLI?#
GeoServer CLI is a command-line tool for managing GeoServer via its REST API. It’s written in Go and provides a fast, scriptable interface for common GeoServer operations.
Why use CLI instead of the web UI?#
- Automation: Script complex workflows
- Speed: Faster than clicking through the UI
- Repeatability: Same commands produce same results
- CI/CD: Integrate with deployment pipelines
- Bulk operations: Process many layers at once
What GeoServer versions are supported?#
GeoServer CLI is tested with GeoServer 2.20+ but should work with any version that supports the REST API.
Configuration#
Can I use multiple configurations?#
Yes! Create multiple config files and switch between them:
| |
Or use environment variables:
| |
How do I store passwords securely?#
Best practices for password management:
Environment variables (recommended):
1export GEOSRVCLI_PASSWORD=your-passwordSecure config file permissions:
1chmod 600 configs/prod.config.tomlVault integration (advanced):
1 2# Read from vault export GEOSRVCLI_PASSWORD=$(vault read -field=password secret/geoserver)Never commit passwords to git:
1 2# Add to .gitignore echo "configs/*.config.toml" >> .gitignore
Can I use the same config for multiple GeoServer instances?#
Yes, use environment variables to override:
| |
Workspaces and Datastores#
What’s the difference between a workspace and a datastore?#
- Workspace: Logical container for organizing layers (like a folder)
- Datastore: Connection to a data source (PostGIS, files, etc.)
A workspace can have multiple datastores, and each datastore belongs to one workspace.
Do I need to create a datastore before publishing layers?#
For PostGIS publishing, the CLI creates the datastore automatically if it doesn’t exist:
| |
For other data sources, create the datastore first:
| |
Can I delete a workspace with layers?#
No, you must delete layers and datastores first:
| |
Delete content through the GeoServer web UI or REST API first.
Publishing#
What data sources can I publish from?#
Currently supported:
- PostGIS - PostgreSQL with PostGIS extension
- Files - Shapefiles (.zip), GeoTIFF (.tif) via Importer extension
How do I publish all tables from a PostGIS database?#
| |
What happens if I publish the same layer twice?#
The CLI is idempotent - it skips layers that already exist:
| |
Can I publish layers in parallel?#
Yes! Use the --concurrency flag:
| |
Why is publishing slow?#
Several factors affect speed:
- GeoServer performance - Check server resources
- Network latency - Use
--timeoutto increase timeout - Table size - Large tables take longer to process
- Concurrent publishing - Use
--concurrencyto parallelize
Styles#
How do I create a style from an SLD file?#
| |
Can I use the same style for multiple layers?#
Yes, styles are global and can be reused:
| |
Where can I get SLD files?#
- GeoServer web UI: Preview layer → Layer Data tab → SLD
- Export from QGIS: Layer → Properties → Symbology → Style → Save as SLD
- Online galleries: GeoServer documentation, QGIS style library
QGIS Integration#
Do I need credentials in exported QGIS files?#
No! For security, credentials are NOT included by default. Configure QGIS Auth Manager instead:
| |
See QGIS Authentication Guide for setup.
Can QGIS edit layers published through the CLI?#
Yes, if you use WFS connections:
- Export with WFS:
./geoserver-cli qgis export connections - Configure QGIS Auth Manager
- Enable editing in QGIS layer properties
Why don’t layers show up in QGIS?#
Check these:
Layer is advertised:
1./geoserver-cli layer update my_layer --advertised trueLayer is enabled:
1./geoserver-cli layer update my_layer --enabled trueQGIS auth is configured - See QGIS auth guide
Performance#
How can I speed up bulk operations?#
Use concurrency:
1./geoserver-cli publish postgis --all -w test --concurrency 8Process in batches:
1 2# Instead of --all at once ./geoserver-cli publish postgis --layers table1,table2,table3 -w testIncrease timeout:
1./geoserver-cli publish postgis --all -w test --timeout 120s
Does the CLI support caching?#
No built-in caching, but you can script it:
| |
Automation and CI/CD#
Can I use this in CI/CD pipelines?#
Yes! The CLI is designed for automation:
| |
How do I handle failures in scripts?#
The CLI returns non-zero exit codes on failure:
| |
Can I run this in Docker?#
Yes, though there’s no official image yet. You can build your own:
| |
Development#
How do I contribute?#
See the Contributing Guide.
Can I add support for new data sources?#
Yes! The architecture supports adding new publishers:
- Create a new publisher in
internal/cli/publish_*.go - Implement the publishing logic
- Add tests
- Update documentation
- Submit a merge request
How does the pre-commit hook work?#
See Pre-commit Hooks for details.
Troubleshooting#
Command fails with “connection refused”#
“Config file not found” error#
Initialize the configuration:
| |
Pre-commit hook fails#
Install required tools:
| |
More Questions?#
- Check the Troubleshooting Guide
- Browse Command Reference
- Open an issue on GitLab