Geoserver cloud

From znlgis/opengis-skills · View interactive version

Geoserver cloud is an AI agent skill from the GitHub repository znlgis/opengis-skills. Use when deploying GeoServer Cloud 3.0.2.1 on Docker Compose or Kubernetes — gateway serving WMS/WFS/WCS/WPS/GWC microservices under /geoserver/cloud, PgConfig vs datadir backends, RabbitMQ config-bus sync, Helm chart geoservercloud 3.0.3, and diagnosing 502s via actuator/health and Consul registrat

How to use this skill

Skill file

项目地址: <https://github.com/geoserver/geoserver-cloud>

官方文档: <https://geoserver.org/geoserver-cloud/>

Docker Hub: <https://hub.docker.com/u/geoservercloud>(镜像标签形如 3.0.2.1,尾段为该版本线的补丁号)

最新版本: 3.0.2.1(2026-11-03,截至 2026-11,GitHub Releases);配套 Helm chart geoservercloud 3.0.3

许可证: GPL-2.0

概述

GeoServer Cloud(GS Cloud):


服务拆分

| 服务 | 镜像 | 用途 |

|------|------|------|

| gateway | geoservercloud/geoserver-cloud-gateway | 网关 |

| discovery | —(3.x 不再发布该镜像) | 服务发现:官方 compose/K8s 改用 hashicorp/consul,geoservercloud/geoserver-cloud-discovery 镜像在 Docker Hub 已 404 |

| config | geoservercloud/geoserver-cloud-config | 配置中心 |

| web-ui | geoservercloud/geoserver-cloud-webui | 管理界面 |

| rest | geoservercloud/geoserver-cloud-rest | REST API |

| wms | geoservercloud/geoserver-cloud-wms | WMS |

| wfs | geoservercloud/geoserver-cloud-wfs | WFS |

| wcs | geoservercloud/geoserver-cloud-wcs | WCS |

| wps | geoservercloud/geoserver-cloud-wps | WPS |

| gwc | geoservercloud/geoserver-cloud-gwc | 瓦片缓存 |


环境准备与快速启动(docker-compose)

# 官方 Quick Start:下载稳定版 compose 文件(仓库内的 compose/ 目录仅供开发调试)
wget "https://geoserver.org/geoserver-cloud/deploy/docker-compose/stable/pgconfig/compose.yml"
docker compose pull
docker compose up -d
docker compose ps

# Gateway: http://localhost:9090/geoserver/cloud   (Web UI)
# Consul : http://localhost:8500                   (服务发现与控制台)
curl -u admin:geoserver "http://localhost:9090/geoserver/cloud/rest/workspaces.json"

配置后端

| 后端 | 适用场景 |

|------|---------|

| datadir | 共享卷(NFS/PVC),简单 |

| pgconfig | 生产推荐,强一致 |

| jdbcconfig | 旧方案,已被替代 |

启用 PgConfig:

SPRING_PROFILES_ACTIVE: "pgconfig"   # 启用 PgConfig 后端
PGCONFIG_HOST: "geoserverdb"
PGCONFIG_PORT: "5432"
PGCONFIG_DATABASE: "geoserver"
PGCONFIG_USERNAME: "geoserver"
PGCONFIG_PASSWORD: "geoserver"
PGCONFIG_SCHEMA: "pgconfig"          # 启动时自动创建 schema

注意: 走 Spring Cloud Config Server 集中下发时,以上变量加前缀 SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_(如 SPRING_CLOUD_CONFIG_SERVER_OVERRIDES_PGCONFIG_HOST)配在 config 服务上;standalone profile(Kubernetes 常用)则直接写在各服务上。


Kubernetes(Helm)

# Chart:camptocamp/helm-geoserver-cloud(chart 名 geoservercloud,最新 3.0.3)
helm repo add geoserver-cloud https://camptocamp.github.io/helm-geoserver-cloud
helm repo update

官方要求把该 chart 作为子 chart(依赖)引入自己的 umbrella chart(不直接 helm install),副本数等参数写在子 chart 键 geoservercloud 下:

```yaml

# Chart.yaml

dependencies:

- name: geoservercloud

repository: https://camptocamp.github.io/helm-geoserver-cloud

version: 3.0.3

```

```yaml

# values.yaml

geoservercloud:

global:

profile: standalone,pgconfig

geoserver:

services:

wms:

replicaCount: 3

```

```bash

helm dependency update && helm install my-gsc . -n gis --create-namespace -f values.yaml

# 临时扩缩容也可直接改 Deployment(chart 默认 nameOverride 为 gsc)

kubectl -n gis get deploy | grep wms

```


核心 API:网关路由与端点

| 路径 | 转发到 |

|------|--------|

| /geoserver/cloud/wms | wms |

| /geoserver/cloud/wfs | wfs |

| /geoserver/cloud/wcs | wcs |

| /geoserver/cloud/wps | wps |

| /geoserver/cloud/gwc | gwc |

| /geoserver/cloud/rest | rest |

| /geoserver/cloud/web | web-ui |

前缀由 GEOSERVER_BASE_PATH(默认 compose 中为 /geoserver/cloud)控制,网关的 StripBasePath 过滤器去掉前缀后再转发(/geoserver/cloud/wms → 下游 /wms)。


配置同步

任意修改 → REST/web-ui 发送 RemoteApplicationEvent 到 RabbitMQ → 所有副本订阅刷新本地 Catalog,秒级一致。

# 环境变量形式(compose 中使用)
GEOSERVER_BUS_ENABLED: "true"
RABBITMQ_HOST: rabbitmq
RABBITMQ_PORT: "5672"

监控

management:
  endpoints.web.exposure.include: "*"
  metrics.export.prometheus.enabled: true

与单体兼容

直接挂载现有 GeoServer 数据目录平滑迁移:

docker run -e SPRING_PROFILES_ACTIVE=datadir \
  -v /mnt/gsdata:/opt/app/data_directory \
  geoservercloud/geoserver-cloud-wms:3.0.2.1

性能优化

  1. WMS 多副本 + Gateway 轮询;GWC 单独部署
  2. PgConfig 数据库独立 + 连接池调优
  3. RabbitMQ 设 delivery_limit 避免风暴
  4. 关闭未用服务(不部署 WPS/WCS)
  5. 配合 Caffeine + Redis 缓存(按需)
  6. 影像金字塔与瓦片预切片

典型工作流

工作流 1:从零部署高可用 GeoServer Cloud

# 下载稳定版 pgconfig compose(仓库内 compose/ 目录仅供开发调试)
wget "https://geoserver.org/geoserver-cloud/deploy/docker-compose/stable/pgconfig/compose.yml"

# 启动基础设施 + 所有微服务
docker compose pull
docker compose up -d

# 验证 Gateway 可访问
curl -u admin:geoserver http://localhost:9090/geoserver/cloud/rest/about/version.json

# 扩容 WMS 服务(3 副本)
docker compose up -d --scale wms=3

工作流 2:Kubernetes 生产部署 + 自动伸缩

# 添加 Helm 仓库(chart 名 geoservercloud,由 camptocamp 维护)
helm repo add geoserver-cloud https://camptocamp.github.io/helm-geoserver-cloud
helm repo update

# 在自己的 umbrella chart 中把 geoservercloud 声明为依赖(RabbitMQ/PostgreSQL 同样以依赖引入)
# values.yaml 里写 geoservercloud.geoserver.services.wms.replicaCount 等参数
helm dependency update
helm upgrade --install gs . -n gis --create-namespace -f values.yaml

# 手动伸缩 WMS(先查出 Deployment 名)
kubectl -n gis get deploy | grep wms
kubectl -n gis scale deploy <wms-deployment> --replicas=10

常见问题

| 问题 | 解决 |

|------|------|

| 配置不同步 | 检查 RabbitMQ 可达 + GEOSERVER_BUS_ENABLED=true |

| Web UI 改了 wms 没生效 | 检查事件订阅 |

| 启动顺序错乱 | depends_on + 健康检查;K8s 用 initContainers |

| OOM | 调整 -Xmx,按服务独立资源 |

| Gateway 502 / 服务不可达 | 检查目标服务健康状态与 Consul 注册(服务名解析:wms、wfs 等) |

| 瓦片 404 / 缓存未命中 | 确认 gwc 服务已部署、GEOSERVER_BASE_PATH 与请求路径一致,必要时重新 seed |

AI 使用建议

相关技能

参考资源

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.