gpt4 book ai didi

docker - OpenMapTiles docker 无法使用之前的配置启动

转载 作者:行者123 更新时间:2023-12-01 23:49:52 25 4
gpt4 key购买 nike

我创建了一个 OpenMapTiles 容器:

  • 使用 /data 目录的卷
  • 使用图像klokantech/openmaptiles-server:1.6

容器启动良好。我下载了星球文件。而且服务运行良好。

因为我要把它推向生产:如果容器死机,我的编排系统(Kubernetes)将自动重新启动它,我希望它选择以前的配置(所以它不需要再次下载行星文件或设置任何配置)。

所以我杀死了我的容器并使用之前的相同卷重新启动它。

问题:当我的容器重新启动时,我重新启动的 MapTiles 没有以前的配置,并且我在 UI 中收到此错误:

OpenMapTiles Server is designed to work with data downloaded from OpenMapTiles.com, the following files are unknown and will not be used: osm-2018-04-09-v3.8-planet.mbtiles

此外,我的日志显示:

 /usr/lib/python2.7/dist-packages/supervisor/options.py:298: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
2018-05-09 09:20:18,359 CRIT Supervisor running as root (no user in config file)
2018-05-09 09:20:18,359 INFO Included extra file "/etc/supervisor/conf.d/openmaptiles.conf" during parsing
2018-05-09 09:20:18,382 INFO Creating socket tcp://localhost:8081
2018-05-09 09:20:18,383 INFO Closing socket tcp://localhost:8081
2018-05-09 09:20:18,399 INFO RPC interface 'supervisor' initialized
2018-05-09 09:20:18,399 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2018-05-09 09:20:18,399 INFO supervisord started with pid 1
2018-05-09 09:20:19,402 INFO spawned: 'wizard' with pid 11
2018-05-09 09:20:19,405 INFO spawned: 'xvfb' with pid 12
2018-05-09 09:20:20,407 INFO success: wizard entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2018-05-09 09:20:20,407 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
Starting OpenMapTiles Map Server (action: run)
Existing configuration found in /data/config.json
Data file "undefined" not found!
Starting installation...
Installation wizard started at http://:::80/
List of available downloads ready.

我想可能是配置中的未定义导致了问题:

Existing configuration found in /data/config.json Data file "undefined" not found!

这是我的配置文件:

 root@maptiles-0:/#  cat /data/config.json
{
"styles": {
"standard": [
"dark-matter",
"klokantech-basic",
"osm-bright",
"positron"
],
"custom": [],
"lang": "",
"langLatin": true,
"langAlts": true
},
"settings": {
"serve": {
"vector": true,
"raster": true,
"services": true,
"static": true
},
"raster": {
"format": "PNG_256",
"hidpi": 2,
"maxsize": 2048
},
"server": {
"title": "",
"redirect": "",
"domains": []
},
"memcache": {
"size": 23.5,
"servers": [
"localhost:11211"
]
}
}

我应该在其他地方安装新卷吗?我应该更改我的 /data/config.json 吗?我不知道如何使它可以被杀死

最佳答案

我使用图像 klokantech/tileserver-gl:v2.3.1 修复了此问题。通过此图像,您可以下载 MBTiles 文件形式的矢量切片 OpenMapTiles Downloads

您可以在此处找到说明:https://openmaptiles.org/docs/host/tileserver-gl/

另外:我使用以下 StatefulSet 将其部署到 kubernetes:

apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
labels:
name: maptiles
name: maptiles
spec:
replicas: 2
selector:
matchLabels:
name: maptiles
serviceName: maptiles
template:
metadata:
labels:
name: maptiles
spec:
containers:
- name: maptiles
command: ["/bin/sh"]
args:
- -c
- |
echo "[INFO] Startingcontainer"; if [ $(DOWNLOAD_MBTILES) = "true" ]; then
echo "[INFO] Download MBTILES_PLANET_URL";
rm /data/*
cd /data/
wget -q -c $(MBTILES_PLANET_URL)
echo "[INFO] Download finished";
fi; echo "[INFO] Start app in /usr/src/app"; cd /usr/src/app && npm install --production && /usr/src/app/run.sh;
env:
- name: MBTILES_PLANET_URL
value: 'https://openmaptiles.com/download/W...'
- name: DOWNLOAD_MBTILES
value: 'true'
livenessProbe:
failureThreshold: 120
httpGet:
path: /health
port: 80
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 5
ports:
- containerPort: 80
name: http
protocol: TCP
readinessProbe:
failureThreshold: 120
httpGet:
path: /health
port: 80
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 5
resources:
limits:
cpu: 500m
memory: 4Gi
requests:
cpu: 100m
memory: 2Gi
volumeMounts:
- mountPath: /data
name: maptiles
volumeClaimTemplates:
- metadata:
creationTimestamp: null
name: maptiles
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 60Gi
storageClassName: standard

我首先使用 DOWNLOAD_MBTILES='true' 部署它,然后将其更改为 DOWNLOAD_MBTILES='false' (因此下次它不会清理 map )已部署)。

我测试了它,当它有 DOWNLOAD_MBTILES='false' 时,您可以终止容器,它们会在一分钟左右重新启动。

关于docker - OpenMapTiles docker 无法使用之前的配置启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50251081/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com