3个版本
新 0.6.1 | 2024年8月23日 |
---|---|
0.6.0 | 2024年8月9日 |
0.6.0-beta1 | 2024年8月8日 |
#221 in 地理空间
228 每月下载量
2MB
7K SLoC
BBOX服务器
BBOX空间服务与QWC2地图查看器。
用法
cargo run
x-www-browser http://127.0.0.1:8080/
内置Swagger UI
https://127.0.0.1:8080/openapi/
在外部Swagger编辑器中查看API
https://editor.swagger.io/?url=https://127.0.0.1:8080/api
配置
配置从 bbox.toml
和环境变量中读取。
Web服务器
[webserver]
# Web server settings
# Environment variable prefix: BBOX_WEBSERVER__
# server_addr = "127.0.0.1:8080" # Default: 127.0.0.1:8080
# worker_threads = 4 # Default: number of CPU cores
[[assets.static]]
# Static file serving
# Env var example: BBOX_ASSETS__STATIC='[{dir="assets",path="assets"}]'
# ./assets/* -> https://127.0.0.1:8080/assets/
# dir = "./assets"
# path = "/assets"
[[assets.repo]]
# QGIS plugin repository
# Env var example: BBOX_ASSETS__REPO='[{dir="plugins",path="qgis"}]'
# ./plugins/*.zip -> https://127.0.0.1:8080/qgis/plugins.xml
# dir = "./plugins"
# path = "qgis"
[mapserver]
# Map server settings
# Environment variable prefix: BBOX_MAPSERVER__
path = "/wms" # Base path of WMS endpoints
# num_fcgi_processes = 4 # Default: number of CPU cores
# fcgi_client_pool_size = 1 # FCGI client pool size. Default: 1
search_projects = false # Scan directories and build inventory
[mapserver.qgis]
# QGIS Server settings
# Environment variable prefix: BBOX_MAPSERVER__QGIS_BACKEND__
# project_basedir = "." # Base dir for project files (.qgs, .qgz)
[mapserver.umn]
# UMN MapServer settings
# Environment variable prefix: BBOX_MAPSERVER__UMN_BACKEND__
# project_basedir = "." # Base dir for project files (.map)
[mapserver.mock]
# Enable FCGI mockup backend (for testing)
# Environment variable prefix: BBOX_MAPSERVER__MOCK_BACKEND__
[metrics.prometheus]
# Prometheus metrics endpoint
# Environment variable prefix: BBOX_METRICS__PROMETHEUS__
path = "/metrics"
[metrics.jaeger]
# Jaeger tracing
# Environment variable prefix: BBOX_METRICS__JAEGER__
agent_endpoint = "localhost:6831"
仪表
Prometheus
运行Prometheus
docker run --rm -p 127.0.0.1:9090:9090 -v $PWD/instrumentation/prometheus.yml:/etc/prometheus/prometheus.yml:ro prom/prometheus
测试表达式浏览器
x-www-browser http://localhost:9090/
表达式示例
http_requests_duration_bucket
Jaeger跟踪
在后台运行Jaeger
docker run --rm -d -p 6831:6831/udp -p 6832:6832/udp -p 16686:16686 jaegertracing/all-in-one:latest
查看跨度
x-www-browser http://localhost:16686/
Grafana
https://grafana.org.cn/docs/grafana/
运行Grafana
docker run -rm -p 127.0.0.1:3000:3000 grafana/grafana
打开Grafana
x-www-browser http://localhost:3000/
- 用户名和密码为
admin
- 添加具有URL http://172.17.0.1:9090/ 的Prometheus数据源
- 添加具有URL http://172.17.0.1:16686/ 的Jaeger数据源
平均请求持续时间
rate(http_requests_duration_sum[5m])/rate(http_requests_duration_count[5m])
请求持续时间90分位数
histogram_quantile(0.9, rate(http_requests_duration_bucket[5m]))
https://www.robustperception.io/how-does-a-prometheus-histogram-work
WMS端点
http_requests_duration_sum{endpoint="/qgis/{project:.+}"}
依赖项
~94MB
~1.5M SLoC