GeoNode基本安装¶
概述¶
以下是在您的主机上部署全堆栈GeoNode服务器的最简单且推荐的方法。
第一步 :部署 GeoNode on a local server ,以下列身份运行
http://localhost/
服务。 GeoServer 也可通过以下网址获得http://localhost/geoserver/
第二步 :部署 GeoNode on a production server ,以下列身份运行
https://my_geonode.geonode.org/
服务。 GeoServer 也可通过以下网址获得https://my_geonode.geonode.org/geoserver/
第三步 :自定义 .env 来满足您的需求
第四步 :保护您的生产部署;更改 admin 密码和 OAUth2 钥匙
进一步提高产量
第一步:在本地服务器上部署地理节点(例如:http://localhost/)¶
Ubuntu(20.04)¶
注解
推荐版本20.04(焦点Fossa)。
软件包安装¶
首先,我们要安装所有 系统包 GeoNode设置所需的。登录到目标计算机并执行以下命令:
sudo apt install -y gdal-bin
sudo apt install -y python3-pip python3-dev python3-virtualenv python3-venv virtualenvwrapper
sudo apt install -y libxml2 libxml2-dev gettext
sudo apt install -y libxslt1-dev libjpeg-dev libpng-dev libpq-dev libgdal-dev
sudo apt install -y software-properties-common build-essential
sudo apt install -y git unzip gcc zlib1g-dev libgeos-dev libproj-dev
sudo apt install -y sqlite3 spatialite-bin libsqlite3-mod-spatialite
# If the following does not work, you can skip it
sudo apt install -y libgdal-dev
Docker设置(仅限第一次)¶
sudo add-apt-repository universe
sudo apt-get update -y
sudo apt-get install -y git-core git-buildpackage debhelper devscripts
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose
sudo apt autoremove --purge
sudo usermod -aG docker ${USER}
su ${USER}
CentOS(7.0+)¶
注解
建议使用7.0或更高版本。
警告
根据您使用的版本,软件包安装可能会略有不同。
软件包安装¶
首先,我们要安装所有 系统包 GeoNode设置所需的。登录到目标计算机并执行以下命令:
sudo yum -y install epel-release
sudo yum install -y gdal
sudo yum install -y python3-pip python3-dev python3-virtualenv python3-venv virtualenvwrapper
sudo pip3 install -U pip
sudo pip3 install -U virtualenv
sudo yum install -y libxml2 libxml2-dev gettext
sudo yum install -y libxslt1-dev libjpeg-dev libpng-dev libpq-dev libgdal-dev
sudo yum install -y git unzip gcc zlib1g-dev libgeos-dev libproj-dev
# If the following does not work, you can skip it
sudo apt install -y libgdal-dev
Docker设置(仅限第一次)¶
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo usermod -aG docker ${USER}
su ${USER}
创建您的 geonode-project
¶
假设您的项目名为 my_geonode 执行以下步骤:
git clone https://github.com/GeoNode/geonode-project.git -b 3.2.x
# Ubuntu
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
mkvirtualenv --python=/usr/bin/python3 my_geonode
Alterantively you can also create the virtual env like below
python3.8 -m venv /home/geonode/dev/.venvs/my_geonode
source /home/geonode/dev/.venvs/my_geonode/bin/activate
pip install Django==3.2
# CentOS
virtualenv -p python3 my_geonode
source my_geonode/bin/activate
django-admin startproject --template=./geonode-project -e py,sh,md,rst,json,yml,ini,env,sample,properties -n monitoring-cron -n Dockerfile my_geonode
# If the previous command does not work for some reason, try the following one
python -m django startproject --template=./geonode-project -e py,sh,md,rst,json,yml,ini,env,sample,properties -n monitoring-cron -n Dockerfile my_geonode
启动容器¶
cd my_geonode
./docker-build.sh
您可以通过从以下位置运行以下命令来跟随容器启动
my_geonode
根文件夹:# GeoNode Container docker-compose logs -f django # GeoServer Container docker-compose logs -f geoserver # DB Container docker-compose logs -f db # NGINX Container docker-compose logs -f geonode
如果发生任何错误,请尝试通过从以下位置运行以下命令来捕获错误堆栈跟踪
my_geonode
根文件夹:# GeoNode “entrypoint.sh” Logs tail -F -n 300 invoke.log
连接到 http://localhost/¶
启动通常需要一些时间,所以要有耐心…
如果一切顺利,你应该可以从 geonode startup logs
类似于下面一行的行:
<some date> [UWSGI] Uwsgi running...
连接到 http://localhost/
默认凭据为:
GeoNode (http://localhost/ ) admin :
username: admin
password: admin
GeoServer (http://localhost/geoserver/ ) admin :
username: admin
password: geoserver
第二步:在生产服务器上部署地理节点(例如:https://my_geonode.geonode.org/)¶
在你想要部署到的情况下,比方说, https://my_geonode.geonode.org/ ,你将需要改变 .env
具体如下:
--- geonode-project\.env
+++ my_geonode\.env
@@ -1,7 +1,7 @@
-COMPOSE_PROJECT_NAME={{project_name}}
+COMPOSE_PROJECT_NAME=my_geonode
BACKUPS_VOLUME_DRIVER=local
DOCKER_HOST_IP=
DOCKER_ENV=production
# See https://github.com/geosolutions-it/geonode-generic/issues/28
# to see why we force API version to 1.24
@@ -9,40 +9,40 @@
C_FORCE_ROOT=1
IS_CELERY=false
IS_FIRST_START=true
FORCE_REINIT=false
-SITEURL=http://localhost/
+SITEURL=https://my_geonode.geonode.org/
ALLOWED_HOSTS=['django',]
# LANGUAGE_CODE=pt
# LANGUAGES=(('en','English'),('pt','Portuguese'))
GEONODE_INSTANCE_NAME=geonode
-DJANGO_SETTINGS_MODULE={{project_name}}.settings
-UWSGI_CMD=uwsgi --ini /usr/src/{{project_name}}/uwsgi.ini
+DJANGO_SETTINGS_MODULE=my_geonode.settings
+UWSGI_CMD=uwsgi --ini /usr/src/my_geonode/uwsgi.ini
# #################
# backend
# #################
-GEONODE_DATABASE={{project_name}}
+GEONODE_DATABASE=my_geonode
GEONODE_DATABASE_PASSWORD=geonode
-GEONODE_GEODATABASE={{project_name}}_data
+GEONODE_GEODATABASE=my_geonode_data
GEONODE_GEODATABASE_PASSWORD=geonode
-DATABASE_URL=postgis://{{project_name}}:geonode@db:5432/{{project_name}}
-GEODATABASE_URL=postgis://{{project_name}}_data:geonode@db:5432/{{project_name}}_data
+DATABASE_URL=postgis://my_geonode:geonode@db:5432/my_geonode
+GEODATABASE_URL=postgis://my_geonode_data:geonode@db:5432/my_geonode_data
DEFAULT_BACKEND_DATASTORE=datastore
BROKER_URL=amqp://guest:guest@rabbitmq:5672/
# #################
# geoserver
# #################
-GEOSERVER_WEB_UI_LOCATION=http://localhost/geoserver/
-GEOSERVER_PUBLIC_LOCATION=http://localhost/geoserver/
+GEOSERVER_WEB_UI_LOCATION=https://my_geonode.geonode.org/geoserver/
+GEOSERVER_PUBLIC_LOCATION=https://my_geonode.geonode.org/geoserver/
GEOSERVER_LOCATION=http://geoserver:8080/geoserver/
GEOSERVER_ADMIN_PASSWORD=geoserver
OGC_REQUEST_TIMEOUT=30
OGC_REQUEST_MAX_RETRIES=1
OGC_REQUEST_BACKOFF_FACTOR=0.3
@@ -58,50 +58,50 @@
MOSAIC_ENABLED=False
# #################
# nginx
# HTTPD Server
# #################
-GEONODE_LB_HOST_IP=localhost
+GEONODE_LB_HOST_IP=my_geonode.geonode.org
GEONODE_LB_PORT=80
# IP or domain name and port where the server can be reached on HTTPS (leave HOST empty if you want to use HTTP only)
# port where the server can be reached on HTTPS
-HTTP_HOST=localhost
-HTTPS_HOST=
+HTTP_HOST=
+HTTPS_HOST=my_geonode.geonode.org
HTTP_PORT=80
HTTPS_PORT=443
# Let's Encrypt certificates for https encryption. You must have a domain name as HTTPS_HOST (doesn't work
# with an ip) and it must be reachable from the outside. This can be one of the following :
# disabled : we do not get a certificate at all (a placeholder certificate will be used)
# staging : we get staging certificates (are invalid, but allow to test the process completely and have much higher limit rates)
# production : we get a normal certificate (default)
-LETSENCRYPT_MODE=disabled
+# LETSENCRYPT_MODE=disabled
# LETSENCRYPT_MODE=staging
-# LETSENCRYPT_MODE=production
+LETSENCRYPT_MODE=production
RESOLVER=127.0.0.11
# #################
# Security
# #################
# Admin Settings
ADMIN_PASSWORD=admin
-ADMIN_EMAIL=admin@localhost
+ADMIN_EMAIL=admin@my_geonode.geonode.org
# EMAIL Notifications
EMAIL_ENABLE=False
DJANGO_EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
DJANGO_EMAIL_HOST=localhost
DJANGO_EMAIL_PORT=25
DJANGO_EMAIL_HOST_USER=
DJANGO_EMAIL_HOST_PASSWORD=
DJANGO_EMAIL_USE_TLS=False
DJANGO_EMAIL_USE_SSL=False
-DEFAULT_FROM_EMAIL='GeoNode <no-reply@geonode.org>'
+DEFAULT_FROM_EMAIL='GeoNode <no-reply@my_geonode.geonode.org>'
# Session/Access Control
LOCKDOWN_GEONODE=False
CORS_ORIGIN_ALLOW_ALL=True
SESSION_EXPIRED_CONTROL_ENABLED=True
DEFAULT_ANONYMOUS_VIEW_PERMISSION=True
重新启动容器¶
每当你换衣服的时候 .env 文件,您将需要重新构建容器
警告
注意! 以下命令将删除您可能在容器内手动进行的任何更改,静电卷除外。
docker-compose up -d
故障排除¶
如果由于某种原因无法访问上的服务器 HTTPS 频道,请查看 NGINX 以下配置文件:
输入 NGINX 集装箱
docker-compose exec geonode sh
如果不存在,请安装编辑器
apk add nano
仔细检查是否
nginx.https.enabled.conf
链接已正确创建ls -lah
如果列表与上图不完全匹配,请运行以下命令,然后再次检查
rm nginx.https.enabled.conf ln -s nginx.https.available.conf nginx.https.enabled.conf
检查
nginx.https.enabled.conf
目录nano nginx.https.enabled.conf
请确保内容与以下内容匹配
警告
更改 Hostname 相应地。 这只是一个例子!
# NOTE : $VARIABLES are env variables replaced by entrypoint.sh using envsubst # not to be mistaken for nginx variables (also starting with $, but usually lowercase) # This file is to be included in the main nginx.conf configuration if HTTPS_HOST is set ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; # this is the actual HTTPS host server { listen 443 ssl; server_name my_geonode.geonode.org; keepalive_timeout 70; ssl_certificate /certificate_symlink/fullchain.pem; ssl_certificate_key /certificate_symlink/privkey.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5; include sites-enabled/*.conf; } # if we try to connect from http, we redirect to https server { listen 80; server_name my_geonode.geonode.org; # TODO : once geoserver supports relative urls, we should allow access though both HTTP and HTTPS at the same time and hence remove HTTP_HOST from this line # Except for let's encrypt challenge location /.well-known { alias /geonode-certificates/.well-known; include /etc/nginx/mime.types; } # Redirect to https location / { return 302 https://my_geonode.geonode.org/$request_uri; # TODO : we should use 301 (permanent redirect, but not practical for debug) } }
警告
保存更改(如果有)并退出!
重新加载Nginx配置
nginx -s reload 2020/06/24 10:00:11 [notice] 112#112: signal process started /etc/nginx# exit
禁用https以隔离错误源可能会有所帮助。中恢复与HTTPS相关的更改之后 .env 文件中,重复上述步骤,并确保
nginx.http.enabled.conf
链接已正确创建。ln -s nginx.conf nginx.http.enabled.conf nano nginx.http.enabled.conf
第三步:自定义 .env 来满足您的需求¶
如果要修改GeoNode行为,请始终使用 .env 文件,以便更新 settings 。
如果需要更改中不存在的设置 .env ,您可以强制内部的值 my_geonode/settings.py
请参阅小节: 设置
您可以在此处添加任何引用为
环境:PROPERTY_NAME
重新启动容器¶
每当你换衣服的时候 .env 文件,您将需要重新构建容器。
警告
注意! 以下命令将删除您可能在容器内手动进行的任何更改,静电卷除外。
docker-compose up -d django
第四步:保护您的生产部署;更改 admin 密码和 OAUth2 钥匙¶
地理服务器设置¶
管理员密码更新¶
OAuth2睡觉接口密钥¶
注解
为了生成新的强随机密码,您可以使用像https://passwordsgenerator.net/这样的在线服务
避免使用符号(例如@#$%),因为它们可能与 .env 文件
Geoserver磁盘配额¶
更新上的密码和密钥 .env 文件¶
注解
为了生成新的强随机密码,您可以使用像https://passwordsgenerator.net/这样的在线服务
避免使用符号(例如@#$%),因为它们可能与 .env 文件
--- my_geonode\.env
+++ my_geonode\.prod.env
@@ -6,13 +6,13 @@
# See https://github.com/geosolutions-it/geonode-generic/issues/28
# to see why we force API version to 1.24
DOCKER_API_VERSION="1.24"
C_FORCE_ROOT=1
IS_CELERY=false
-IS_FIRST_START=true
+IS_FIRST_START=false
FORCE_REINIT=false
SITEURL=https://my_geonode.geonode.org/
ALLOWED_HOSTS=['django',]
# LANGUAGE_CODE=pt
@@ -38,13 +38,14 @@
# #################
# geoserver
# #################
GEOSERVER_WEB_UI_LOCATION=https://my_geonode.geonode.org/geoserver/
GEOSERVER_PUBLIC_LOCATION=https://my_geonode.geonode.org/geoserver/
GEOSERVER_LOCATION=http://geoserver:8080/geoserver/
-GEOSERVER_ADMIN_PASSWORD=geoserver
+GEOSERVER_ADMIN_USER=admin
+GEOSERVER_ADMIN_PASSWORD=<new_geoserver_admin_password>
OGC_REQUEST_TIMEOUT=30
OGC_REQUEST_MAX_RETRIES=1
OGC_REQUEST_BACKOFF_FACTOR=0.3
OGC_REQUEST_POOL_MAXSIZE=10
OGC_REQUEST_POOL_CONNECTIONS=10
@@ -84,13 +85,13 @@
RESOLVER=127.0.0.11
# #################
# Security
# #################
# Admin Settings
-ADMIN_PASSWORD=admin
+ADMIN_PASSWORD=<new_geonode_admin_password>
ADMIN_EMAIL=admin@my_geonode.geonode.org
# EMAIL Notifications
EMAIL_ENABLE=False
DJANGO_EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
DJANGO_EMAIL_HOST=localhost
@@ -114,15 +115,15 @@
ACCOUNT_CONFIRM_EMAIL_ON_GET=False
ACCOUNT_EMAIL_VERIFICATION=optional
ACCOUNT_EMAIL_CONFIRMATION_EMAIL=False
ACCOUNT_EMAIL_CONFIRMATION_REQUIRED=False
# OAuth2
-OAUTH2_API_KEY=
-OAUTH2_CLIENT_ID=Jrchz2oPY3akmzndmgUTYrs9gczlgoV20YPSvqaV
-OAUTH2_CLIENT_SECRET=rCnp5txobUo83EpQEblM8fVj3QT5zb5qRfxNsuPzCqZaiRyIoxM4jdgMiZKFfePBHYXCLd7B8NlkfDBY9HKeIQPcy5Cp08KQNpRHQbjpLItDHv12GvkSeXp6OxaUETv3
+OAUTH2_API_KEY=<new_OAUTH2_API_KEY>
+OAUTH2_CLIENT_ID=<new_OAUTH2_CLIENT_ID>
+OAUTH2_CLIENT_SECRET=<new_OAUTH2_CLIENT_SECRET>
# GeoNode APIs
API_LOCKDOWN=False
TASTYPIE_APIKEY=
# #################
警告
注意! 环境Geoserver_admin_password实际上不用于更改Geoserver管理员密码。您需要登录Geoserver UI并手动更改!
[可选] 更新您的SSL证书¶
在生产部署模式中,默认情况下,GeoNode使用 Let's Encrypt 证书
您可能希望向GeoNode提供您自己的证书
docker exec -it nginx4my_geonode_geonode sh -c 'mkdir /geonode-certificates/my_geonode'
wget --no-check-certificate 'http://<url_to_your_chain.crt>' \
-O chain.crt
wget --no-check-certificate 'http://<url_to_your_key.key>' \
-O my_geonode.key
docker cp chain.crt nginx4my_geonode_geonode:/geonode-certificates/my_geonode
docker cp my_geonode.key nginx4my_geonode_geonode:/geonode-certificates/my_geonode
docker-compose exec geonode sh
apk add vim
vim nginx.https.enabled.conf
-ssl_certificate /certificate_symlink/fullchain.pem;
-ssl_certificate_key /certificate_symlink/privkey.pem;
+ssl_certificate /geonode-certificates/my_geonode/chain.crt;
+ssl_certificate_key /geonode-certificates/my_geonode/my_geonode.key;
nginx -s reload
exit
重新启动GeoNode和Nginx容器¶
每当你换衣服的时候 .env 文件,您将需要重新构建容器
警告
注意! 以下命令将删除您可能在容器内手动进行的任何更改,静电卷除外。
docker-compose up -d django
docker-compose restart geonode
进一步提高产量¶
Geoserver生产设置¶
JVM设置:内存和Geoserver选项¶
这个 .env 文件提供了一种自定义Geoserver JVM选项的方法。
变量 GEOSERVER_JAVA_OPTS
允许您调整Geoserver容器并启用特定的Geoserver选项。
GEOSERVER_JAVA_OPTS=
-Djava.awt.headless=true -Xms2G -Xmx4G -XX:PerfDataSamplingInterval=500
-XX:SoftRefLRUPolicyMSPerMB=36000 -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC
-XX:+UseParNewGC -XX:ParallelGCThreads=4 -Dfile.encoding=UTF8 -Djavax.servlet.request.encoding=UTF-8
-Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT
-Dorg.geotools.shapefile.datetime=false -DGEOSERVER_CSRF_DISABLED=true -DPRINT_BASE_URL=http://geoserver:8080/geoserver/pdf
-Djava.awt.headless (true)
在没有实际显示器、键盘或鼠标的情况下,在Java中使用基于图形的应用程序在无头环境中运行的UI组件的典型用例可能是图像转换器应用程序。虽然它需要图形数据来进行图像处理,但实际上并不需要显示器。该应用程序可以在服务器上运行,并将转换后的文件保存或通过网络发送到另一台机器进行显示。
-Xms2G -Xmx4G
这意味着您的JVM将使用XMS内存量启动,并且将能够使用最大XMX内存量。上面将使用2 GB的内存启动类似的JVM,并允许进程使用最多4 GB的内存。您需要根据可用的RAM调整此值。
-DGEOSERVER_CSRF_DISABLED (True)
Geoserver网络管理员使用了一个跨站请求伪造(跨站请求伪造)保护过滤,它将挡路任何看起来不是源自Geoserver的表单提交。这有时会导致某些代理配置出现问题。可以通过将GEOSEVER_CSRF_DISABLED属性设置为TRUE来禁用CSRF过滤。https://docs.geoserver.org/stable/en/user/security/webadmin/csrf.html
每当需要更改一个或多个JVM选项时,都需要重新启动Geoserver Docker容器。
# Hard restart of the container: the only way to update the .env variables
docker-compose up -d geoserver
此命令将 保留 所有Geoserver配置和数据,因为 GEOSERVER_DATA_DIR
存储在码头静电卷上。
但是,您手动对容器所做的任何更改,例如将新插件添加到Geoserver或将一些JAR更新到 WEB-INF/lib
库文件夹,将会丢失。
您需要再次添加JAR并重启Geoserver 轻轻地
# Soft restart of the container: the .env variables won't be updated
docker-compose restart geoserver
全局和服务设置¶
检查Geoserver内存使用情况和状态;确保
GEOSERVER_DATA_DIR
路径指向静电卷
GeoServer Global Settings ;确保
Proxy Base Url
指向Publlc URL和LOGGING
级别设置为 Production Mode
GeoServer Image Processing Settings ;除非您正在使用某些特定的渲染器或Geoserver插件,否则请使用以下推荐选项
注解
欲了解更多详情,请访问https://docs.geoserver.org/stable/en/user/configuration/image_processing/index.html#image-processing。
调谐一下 GeoServer Services Configuration ; WCS , WFS , WMS 和 WPS ;
WCS :根据您的需要更新限制。不要使用过高的值,这会使Geoserver容易受到DoS攻击。
WMS :在此处指定您要使用的SRS列表。空是指Geoserver支持的所有版本,但请小心,因为
GetCapabilities
产量将变得巨大。
WMS : Raster Rendering Options 允许您调整WMS输出以获得更好的性能或质量。最佳性能:
Nearest Neighbour
-最佳质量:Bicubic
警告
栅格图像应始终在摄取到GeoNode之前进行优化。一般建议是 绝不可能 将未处理的GeoTIFF图像上传到GeoNode。
有关更多详细信息,请访问:
WMS :根据您的需要更新限制。不要使用过高的值,这会使Geoserver容易受到DoS攻击。
PostGIS上的GeoWebCache DiskQuota¶
默认情况下,GeoWebCache DiskQuota处于禁用状态。这意味着层缓存可能会无限增长。
生产系统上应始终启用GeoWebCache DiskQuota。在启用它的情况下,此 must 配置为使用Postgis之类的DB引擎来存储其索引。
首先要确保 Tile Caching 在所有可用图层上启用
注解
GeoNode会自动为您执行此操作。无论如何,值得仔细检查一下。
配置 Disk Quota 通过向DB Docker容器提供连接字符串(如 .env 文件
PostGIS上的GeoFence安全规则¶
默认情况下,GeoFence将安全规则存储在 H2 分贝。
在生产系统上,不建议这样做。您需要更新Geoserver Docker容器,以便启用GeoFence将规则存储到DB Docker容器中。
要做到这一点,请按照以下步骤操作:
# Enter the GeoServer Docker Container
docker-compose exec geoserver bash
# Install a suitable editor
apt update
apt install nano
# Edit the GeoFence DataStore .properties file
nano /geoserver_data/data/geofence/geofence-datasource-ovr.properties
注解
确保提供的连接参数与 .env 文件
geofenceVendorAdapter.databasePlatform=org.hibernatespatial.postgis.PostgisDialect
geofenceDataSource.driverClassName=org.postgresql.Driver
geofenceDataSource.url=jdbc:postgresql://db:5432/my_geonode_data
geofenceDataSource.username=my_geonode_data
geofenceDataSource.password=********
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=public
# Update the GeoServer WEB-INF/lib JARs accordingly
wget --no-check-certificate "https://www.dropbox.com/s/psolxleimaft0t7/postgis-jdbc-1.3.3.jar?dl=1" -O postgis-jdbc-1.3.3.jar && \
wget --no-check-certificate "https://www.dropbox.com/s/ilowu1vd27j2cs1/hibernate-spatial-postgis-1.1.3.2.jar?dl=1" -O hibernate-spatial-postgis-1.1.3.2.jar && \
rm /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/hibernate-spatial-h2-geodb-1.1.3.1.jar && \
mv hibernate-spatial-postgis-1.1.3.2.jar /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/ && \
mv postgis-jdbc-1.3.3.jar /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/
容器现在可以重新启动了。
警告
记得要做一个 软重启 否则,WEB-INF/lib JAR将重置为原始状态
# Exit the GeoServer container
exit
# Soft Restart GeoServer Docker Container
docker-compose restart geoserver
IMPORTANT :第一次执行此过程时,GeoFence将无法再检索旧的安全规则。
您将需要 修复地理节点数据集权限 以便重新生成安全规则。
修复地理节点数据集权限¶
GeoFence安全规则列表可从 GeoFence Data Rules 部分。
一定要仔细检查列表是否可访问,以及数据规则是否在那里。如果为空,则除admin之外,标准用户将无法访问任何层。
要重新同步GeoFence安全规则,请按照以下步骤操作:
# Enter the GeoNode Docker Container
docker-compose exec django bash
# Run the `sync_geonode_datasets` management command
./manage.sh sync_geonode_datasets --updatepermissions
重新生成地理节点数据集缩略图¶
以下过程允许您执行以下操作 批次 重新生成所有数据集缩略图:
# Enter the GeoNode Docker Container
docker-compose exec django bash
# Run the `sync_geonode_datasets` management command
./manage.sh sync_geonode_datasets --updatethumbnails
重新生成地理节点数据集BBOXES¶
以下过程允许您执行以下操作 批次 重新生成所有数据集BBOXES:
# Enter the GeoNode Docker Container
docker-compose exec django bash
# Run the `sync_geonode_datasets` management command
./manage.sh sync_geonode_datasets --updatebbox
修复GeoNode数据集元数据和下载链接¶
以下过程允许您修复损坏或不正确的元数据链接:
# Enter the GeoNode Docker Container
docker-compose exec django bash
# Run the `set_all_layers_metadata` management command
./manage.sh set_all_layers_metadata -d
此外,还可以执行以下操作 力 在重新生成之前清除链接:
# Enter the GeoNode Docker Container
docker-compose exec django bash
# Run the `set_all_layers_metadata` management command
./manage.sh set_all_layers_metadata -d --prune
将GeoNode迁移到新的主机名¶
在这种情况下,您将需要将实例移动到另一个域,如中的示例所示 https://my_geonode.geonode.org/
至 https://prod_geonode.geonode.org/
,请按照以下步骤操作:
更新 .env 通过指定相应的新名称来归档。
重新启动GeoNode Docker容器。
docker-compose up -d geonode
从GeoNode Docker容器内部运行以下管理命令。
# Enter the GeoNode Docker Container docker-compose exec django bash # Run the `migrate_baseurl` management command ./manage.sh migrate_baseurl --source-address=my_geonode.geonode.org --target-address=prod_geonode.geonode.org # Run the `set_all_layers_metadata` management command ./manage.sh set_all_layers_metadata -d
向您的实例添加巨型或DB数据集¶
将大型数据集或DB表从上传到GeoNode Web Upload Interface 有时候是不可能的。
在这种情况下,建议的程序如下:
将数据集添加到 GeoServer 第一个是直接的。
您必须先将数据上传到Geoserver Docker Container静电卷,然后通过手动添加图层 GeoServer Admin GUI 。
在Geoserver上正确配置数据集后,从GeoNode Docker Container内部运行以下管理命令
# Enter the GeoNode Docker Container docker-compose exec django bash # Run the `updatelayers` management command ./manage.sh updatelayers -w <workspace_name> -f <layer_name>
将GeoNode核心更新为最新提交¶
如果您需要将GeoNode核心代码库更新为特定版本或提交,请执行以下步骤:
# Enter the GeoNode Docker Container
docker-compose exec django bash
# Update GeoNode
cd /usr/src/geonode/
git fetch --all --prune
git checkout <commit or branch>
# Update the pip dependencies
pip install -r requirements.txt --upgrade --no-cache
pip install -e . --upgrade
# Synchronize the GeoNode Project
cd /usr/src/my_geonode/
./manage.sh makemigrations
./manage.sh migrate
./manage.sh collectstatic
# Refresh UWSGI Daemons
touch /usr/src/my_geonode/my_geonode/wsgi.py
# Follow the logs and make sure non errors occur
tail -F -n 30 /var/log/geonode.log