地结核¶
概述¶
The following steps will guide you to a fresh setup of GeoNode. All guides will first install and configure the system to run it in DEBUG
mode (also known as DEVELOPMENT
mode) and then by configuring an HTTPD server to serve GeoNode through the standard HTTP
(80
) port.
那些向导 不是 用于生产系统。会有专门的章节向你展示 提示 为准备生产的机器优化geonode。无论如何,我们强烈建议 DevOp 或 系统管理员 在将服务器公开给 WEB
.
Ubuntu 18.04¶
这部分文档描述了在Ubuntu18.0464位干净环境(桌面或服务器)上geonode的完整安装过程。所有示例都使用必须在本地终端或远程shell上输入的shell命令。-如果您有图形桌面环境,则可以在登录后打开终端应用程序;如果您在远程服务器上工作,则提供商或系统管理员应通过ssh客户端授予您访问权限。
安装依赖项¶
在本节中,我们将安装完成geonode安装所需的所有基本软件包和工具。要遵循本指南,您需要了解有关ubuntu服务器配置和使用shell的基本知识。本指南使用 vim
作为编辑;免费使用 nano
, gedit
或者其他人。
软件包安装¶
注解
您不需要安装 系统包 如果要使用Docker运行项目
我们将使用 example.org 作为虚拟域名。
首先,我们将安装所有 系统包 地理节点设置所需的。登录到目标计算机并执行以下命令:
# Install packages from GeoNode core
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 libgdal20
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 libsqlite3-dev
# Install Openjdk
sudo -i apt update
sudo apt install openjdk-8-jdk-headless default-jdk-headless -y
sudo update-java-alternatives --jre-headless --jre --set java-1.8.0-openjdk-amd64
# Install VIM
sudo apt install -y vim
sudo apt update -y
sudo apt upgrade -y
sudo apt autoremove -y
sudo apt autoclean -y
sudo apt purge -y
sudo apt clean -y
警告
geonode3.x与Python不兼容<3.7请使用以下命令检查当前Python版本
python --version
如果小于3.7,请遵循以下附加步骤
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
cd /tmp
wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz
tar -xf Python-3.8.6.tar.xz
cd Python-3.8.6
./configure --enable-optimizations --enable-loadable-sqlite-extensions
make -j 1
sudo make altinstall
python3.8 --version
创建专用用户¶
在以下步骤中,名为 geonode
创建(如果需要)并使用:要运行安装命令,用户必须在 sudo
组。
Create User geonode
if not present:
# Follow the prompts to set the new user's information.
# It is fine to accept the defaults to leave all of this information blank.
sudo adduser geonode
# The following command adds the user geonode to group sudo
sudo usermod -aG sudo geonode
# make sure the newly created user is allowed to login by ssh
# (out of the scope of this documentation) and switch to User geonode
su geonode
地理节点安装¶
这是geonode最基本的安装。它不会使用任何外部服务器 Apache Tomcat
, PostgreSQL
或 HTTPD
.
它将在基于文件系统的本地运行 SQLite
数据库。
首先,我们需要准备一个新的python虚拟环境
由于geonode需要大量不同的python库和包,因此建议使用python虚拟环境,以避免与系统范围的python包和其他已安装软件的依赖性冲突。另请参阅 Virtualenvwrapper 包以获取更多信息
警告
geonode3.x与Python不兼容<3.7请使用以下命令检查当前Python版本
python --version
如果小于3.7,请遵循以下附加步骤
which python3.8 # copy the path of python executable
# Create the GeoNode Virtual Environment (first time only)
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
# Use the python path from above
mkvirtualenv --python=/usr/local/bin/python3.8 geonode
# Create the GeoNode Virtual Environment (first time only)
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
mkvirtualenv --python=/usr/bin/python3 geonode
此时,命令提示符显示 (geonode)
前缀,这表示您的virtualenv处于活动状态。
注解
下次需要访问虚拟环境时,只需运行
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
workon geonode
注解
为了永久保存virtualenvwrapper环境
nano ~/.bashrc
# Write to the bottom of the file the following lines
export WORKON_HOME=/home/geonode/.virtualenvs
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
# Let's create the GeoNode core base folder and clone it
sudo mkdir -p /opt/geonode/
sudo usermod -a -G www-data geonode
sudo chown -Rf geonode:www-data /opt/geonode/
sudo chmod -Rf 775 /opt/geonode/
# Clone the GeoNode source code on /opt/geonode
cd /opt
git clone https://github.com/GeoNode/geonode.git geonode
警告
如果在安装Twisted依赖项时遇到问题
python --version
如果高于3.8.5,很可能没有适合您系统的版本。
按照下面的说明删除依赖项
vim requirements.txt
# --> comment or remove Twisted
vim setup.cfg
# --> comment or remove Twisted
在调试模式下首次运行geonode¶
警告
确保您已成功完成本节的所有步骤 安装依赖项 .
准备好sqlite数据库后,此命令将在本地运行geonode和geoserver。服务器将在中启动 DEBUG
(或) DEVELOPMENT
)模式,它将启动以下服务:
地理节点打开
http://localhost:8000/
GeoServer打开
http://localhost:8080/geoserver/
这种模式有利于调试问题和/或开发新功能,但不能用于生产系统。
# Prepare the GeoNode SQLite database (the first time only)
paver setup
paver sync
注解
如果你想从一个干净的环境重新开始,就跑吧
paver reset_hard
警告
这会把你的 local_settings
,删除sqllite数据库并删除geoserver data dir。
# Run the server in DEBUG mode
paver start
一旦服务器完成初始化并在控制台上打印语句 GeoNode is now available.
,您可以打开浏览器并转到:
http://localhost:8000/
登录:
user: admin
password: admin
postgis数据库设置¶
警告
确保您已成功完成本节的所有步骤 安装依赖项 .
在本节中,我们将在postgresql中为geonode设置用户和数据库。
安装和配置PostgreSQL数据库系统¶
在本节中,我们将安装 PostgreSQL
包裹连同 PostGIS
分机。这些步骤必须完成 only 如果您的系统上还没有安装数据库。
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo wget --no-check-certificate --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install -y postgresql-11 postgresql-11-postgis-2.5 postgresql-11-postgis-2.5-scripts postgresql-contrib-11 postgresql-client-11
我们现在必须创建两个数据库, geonode
和 geonode_data
,属于角色 geonode
.
注解
这是我们的默认配置。您可以使用所需的任何数据库或角色。必须在上正确配置连接参数 settings
,我们将在本节后面看到。
数据库和权限¶
首先,创建geonode用户。geonode将使用此用户访问数据库
sudo -u postgres createuser -P geonode
系统将提示您为用户设置密码。进入 geonode
作为密码。
警告
为了简单起见,这是一个示例密码。这个密码非常 weak 应该在生产环境中进行更改。
创建数据库 geonode
和 geonode_data
拥有者 geonode
sudo -u postgres createdb -O geonode geonode
sudo -u postgres createdb -O geonode geonode_data
接下来让我们创建postgis扩展
sudo -u postgres psql -d geonode_data -c 'CREATE EXTENSION postgis;'
sudo -u postgres psql -d geonode_data -c 'GRANT ALL ON geometry_columns TO PUBLIC;'
sudo -u postgres psql -d geonode_data -c 'GRANT ALL ON spatial_ref_sys TO PUBLIC;'
sudo -u postgres psql -d geonode_data -c 'GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO geonode;'
最后一步是更改文件中本地连接的用户访问策略 pg_hba.conf
sudo vim /etc/postgresql/11/main/pg_hba.conf
向下滚动到文档底部。我们只需要编辑一行。
# "local" is for Unix domain socket connections only
# local all all peer
local all all trust
警告
如果你 PostgreSQL
数据库位于 separate/remote machine ,你必须 允许 远程访问中的数据库 /etc/postgresql/11/main/pg_hba.conf
到 geonode
用户并告诉postgresql 接受 您的非本地连接 /etc/postgresql/11/main/postgresql.conf
文件
重新启动postgresql以使更改生效。
sudo service postgresql restart
PostgreSQL现在准备好了。要测试配置,请尝试连接到 geonode
数据库为 geonode
角色。
psql -U geonode geonode
\q
安装GeoServer¶
运行命令时 paver start
,如我们之前所见,脚本自动运行 Jetty
运行的Servlet Java容器 GeoServer
使用默认设置。
警告
在执行下一步之前,请确保 GeoNode
和 GeoServer
摊铺机服务已停止。为了做到这一点
workon geonode
cd /opt/geonode/
paver stop
这不是最佳的跑步方式 GeoServer
是的。这是 GeoNode
我们必须确保它以稳定可靠的方式运行。
在本节中,我们将安装 Apache Tomcat 8
Servlet Java容器,默认情况下将在内部端口上启动 8080
.
我们还将执行一些优化以:
正确设置java vm选项,比如可用堆内存和垃圾收集器选项。
外部化
GeoServer
和GeoWebcache
目录以便允许进一步更新,而不存在删除我们的数据集的风险。
注解
这仍然是这些组件的基本设置。有关在生产环境中强化系统的文档部分将提供更多详细信息。不过,您需要根据当前系统对这些设置进行一些调整。作为一个实例,如果您的计算机没有足够的内存,则需要降低可用堆内存的初始数量。 警告 和 笔记 将放在需要你注意的陈述下面。
# Install Openjdk
sudo -i apt update
sudo apt install openjdk-8-jdk-headless default-jdk-headless -y
sudo update-java-alternatives --jre-headless --jre --set java-1.8.0-openjdk-amd64
# Check Java version
java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
# Install Apache Tomcat 8
sudo wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.57/bin/apache-tomcat-8.5.57.tar.gz
sudo tar xzf apache-tomcat-8.5.57.tar.gz
sudo mv apache-tomcat-8.5.57 /usr/local/apache-tomcat8
sudo useradd -m -U -s /bin/false tomcat
sudo usermod -a -G www-data tomcat
sudo sed -i -e 's/xom-\*\.jar/xom-\*\.jar,bcprov\*\.jar/g' /usr/local/apache-tomcat8/conf/catalina.properties
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
echo 'JAVA_HOME='$JAVA_HOME | sudo tee --append /usr/local/apache-tomcat8/bin/setenv.sh
# Add Tomcat user to www-data group !important!
sudo usermod -a -G www-data tomcat
sudo sh -c 'chmod +x /usr/local/apache-tomcat8/bin/*.sh'
sudo chown -Rf tomcat:www-data /usr/local/apache-tomcat8
让我们创建一个系统服务来管理tomcat的启动
sudo vim /etc/systemd/system/tomcat.service
[Unit]
Description=Tomcat 8.5 servlet container
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="JAVA_HOME=/usr/lib/jvm/default-java"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"
Environment="CATALINA_BASE=/usr/local/apache-tomcat8"
Environment="CATALINA_HOME=/usr/local/apache-tomcat8"
Environment="CATALINA_PID=/usr/local/apache-tomcat8/temp/tomcat.pid"
ExecStart=/usr/local/apache-tomcat8/bin/startup.sh
ExecStop=/usr/local/apache-tomcat8/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
要测试服务:
sudo systemctl daemon-reload
sudo systemctl restart tomcat
sudo systemctl status tomcat.service
使其在默认情况下启用
sudo systemctl enable tomcat
地理服务器优化¶
让我们把 GEOSERVER_DATA_DIR
和 logs
# Create the target folders
sudo mkdir -p /opt/data
sudo chown -Rf geonode:www-data /opt/data
sudo chmod -Rf 775 /opt/data
sudo mkdir -p /opt/data/logs
sudo chown -Rf geonode:www-data /opt/data/logs
sudo chmod -Rf 775 /opt/data/logs
# Download and extract the default GEOSERVER_DATA_DIR
sudo wget --no-check-certificate https://build.geo-solutions.it/geonode/geoserver/latest/data-2.17.2.zip
sudo unzip data-2.17.2.zip -d /opt/data/
sudo mv /opt/data/data/ /opt/data/geoserver_data
sudo chown -Rf tomcat:www-data /opt/data/geoserver_data
sudo chmod -Rf 775 /opt/data/geoserver_data
sudo mkdir -p /opt/data/geoserver_logs
sudo chown -Rf tomcat:www-data /opt/data/geoserver_logs
sudo chmod -Rf 775 /opt/data/geoserver_logs
sudo mkdir -p /opt/data/gwc_cache_dir
sudo chown -Rf tomcat:www-data /opt/data/gwc_cache_dir
sudo chmod -Rf 775 /opt/data/gwc_cache_dir
# Download and install GeoServer
sudo wget --no-check-certificate https://build.geo-solutions.it/geonode/geoserver/latest/geoserver-2.17.2.war
sudo mv geoserver-2.17.2.war /usr/local/apache-tomcat8/webapps/geoserver.war
现在让我们配置 JAVA_OPTS
,即运行servlet容器的参数,如堆内存、垃圾收集器等。
sudo sed -i -e "s/JAVA_OPTS=/#JAVA_OPTS=/g" /usr/local/apache-tomcat8/bin/setenv.sh
echo 'GEOSERVER_DATA_DIR="/opt/data/geoserver_data"' | sudo tee --append /usr/local/apache-tomcat8/bin/setenv.sh
echo 'GEOSERVER_LOG_LOCATION="/opt/data/geoserver_logs/geoserver.log"' | sudo tee --append /usr/local/apache-tomcat8/bin/setenv.sh
echo 'GEOWEBCACHE_CACHE_DIR="/opt/data/gwc_cache_dir"' | sudo tee --append /usr/local/apache-tomcat8/bin/setenv.sh
echo 'GEOFENCE_DIR="$GEOSERVER_DATA_DIR/geofence"' | sudo tee --append /usr/local/apache-tomcat8/bin/setenv.sh
echo 'TIMEZONE="UTC"' | sudo tee --append /usr/local/apache-tomcat8/bin/setenv.sh
echo 'JAVA_OPTS="-server -Djava.awt.headless=true -Dorg.geotools.shapefile.datetime=false -XX:+UseParallelGC -XX:ParallelGCThreads=4 -Dfile.encoding=UTF8 -Duser.timezone=$TIMEZONE -Xms512m -Xmx4096m -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -DGEOSERVER_CSRF_DISABLED=true -DPRINT_BASE_URL=http://geoserver:8080/geoserver/pdf -DGEOSERVER_DATA_DIR=$GEOSERVER_DATA_DIR -Dgeofence.dir=$GEOFENCE_DIR -DGEOSERVER_LOG_LOCATION=$GEOSERVER_LOG_LOCATION -DGEOWEBCACHE_CACHE_DIR=$GEOWEBCACHE_CACHE_DIR"' | sudo tee --append /usr/local/apache-tomcat8/bin/setenv.sh
注解
执行完上述语句后,您应该能够看到在文件底部写入的新选项 /usr/local/apache-tomcat8/bin/setenv.sh
.
...
# If you run Tomcat on port numbers that are all higher than 1023, then you
# do not need authbind. It is used for binding Tomcat to lower port numbers.
# (yes/no, default: no)
#AUTHBIND=no
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/
GEOSERVER_DATA_DIR="/opt/data/geoserver_data"
GEOSERVER_LOG_LOCATION="/opt/data/geoserver_logs/geoserver.log"
GEOWEBCACHE_CACHE_DIR="/opt/data/gwc_cache_dir"
GEOFENCE_DIR="$GEOSERVER_DATA_DIR/geofence"
TIMEZONE="UTC"
JAVA_OPTS="-server -Djava.awt.headless=true -Dorg.geotools.shapefile.datetime=false -XX:+UseParallelGC -XX:ParallelGCThreads=4 -Dfile.encoding=UTF8 -Duser.timezone=$TIMEZONE -Xms512m -Xmx4096m -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -DGEOSERVER_CSRF_DISABLED=true -DPRINT_BASE_URL=http://geoserver:8080/geoserver/pdf -DGEOSERVER_DATA_DIR=$GEOSERVER_DATA_DIR -Dgeofence.dir=$GEOFENCE_DIR -DGEOSERVER_LOG_LOCATION=$GEOSERVER_LOG_LOCATION -DGEOWEBCACHE_CACHE_DIR=$GEOWEBCACHE_CACHE_DIR"
根据您的需要,可以随时手动更新或更改这些选项。
警告
我们将要添加到servlet容器的默认选项,假设您至少可以保留 4GB
属于 RAM
到 GeoServer
(参见选项 -Xmx4096m
)中。你必须确保你的机器有足够的内存来运行这两个 GeoServer
和 GeoNode
,在本例中至少意味着 4GB
对于 GeoServer
加上至少 2GB
对于 GeoNode
是的。总共至少 6GB
属于 RAM
在你的机器上可用。如果你没有足够的钱 RAM
可用时,可以降低值 -Xms512m -Xmx4096m
是的。少考虑一下 RAM
如果可以,您的服务性能将受到很大影响。
为了使更改生效,您需要重新启动servlet容器。
# Restart the server
sudo systemctl daemon-reload
sudo systemctl restart tomcat
sudo systemctl status tomcat.service
# Follow the startup logs
sudo tail -F -n 300 /opt/data/geoserver_logs/geoserver.log
如果你能在日志上看到类似的东西,没有错误
...
2019-05-31 10:06:34,190 INFO [geoserver.wps] - Found 5 bindable processes in GeoServer specific processes
2019-05-31 10:06:34,281 INFO [geoserver.wps] - Found 89 bindable processes in Deprecated processes
2019-05-31 10:06:34,298 INFO [geoserver.wps] - Found 31 bindable processes in Vector processes
2019-05-31 10:06:34,307 INFO [geoserver.wps] - Found 48 bindable processes in Geometry processes
2019-05-31 10:06:34,307 INFO [geoserver.wps] - Found 1 bindable processes in PolygonLabelProcess
2019-05-31 10:06:34,311 INFO [geoserver.wps] - Blacklisting process ras:ConvolveCoverage as the input kernel of type class javax.media.jai.KernelJAI cannot be handled
2019-05-31 10:06:34,319 INFO [geoserver.wps] - Blacklisting process ras:RasterZonalStatistics2 as the input zones of type class java.lang.Object cannot be handled
2019-05-31 10:06:34,320 INFO [geoserver.wps] - Blacklisting process ras:RasterZonalStatistics2 as the input nodata of type class it.geosolutions.jaiext.range.Range cannot be handled
2019-05-31 10:06:34,320 INFO [geoserver.wps] - Blacklisting process ras:RasterZonalStatistics2 as the input rangeData of type class java.lang.Object cannot be handled
2019-05-31 10:06:34,320 INFO [geoserver.wps] - Blacklisting process ras:RasterZonalStatistics2 as the output zonal statistics of type interface java.util.List cannot be handled
2019-05-31 10:06:34,321 INFO [geoserver.wps] - Found 18 bindable processes in Raster processes
2019-05-31 10:06:34,917 INFO [ows.OWSHandlerMapping] - Mapped URL path [/TestWfsPost] onto handler 'wfsTestServlet'
2019-05-31 10:06:34,918 INFO [ows.OWSHandlerMapping] - Mapped URL path [/wfs/*] onto handler 'dispatcher'
2019-05-31 10:06:34,918 INFO [ows.OWSHandlerMapping] - Mapped URL path [/wfs] onto handler 'dispatcher'
2019-05-31 10:06:42,237 INFO [geoserver.security] - Start reloading user/groups for service named default
2019-05-31 10:06:42,241 INFO [geoserver.security] - Reloading user/groups successful for service named default
2019-05-31 10:06:42,357 WARN [auth.GeoFenceAuthenticationProvider] - INIT FROM CONFIG
2019-05-31 10:06:42,494 INFO [geoserver.security] - AuthenticationCache Initialized with 1000 Max Entries, 300 seconds idle time, 600 seconds time to live and 3 concurrency level
2019-05-31 10:06:42,495 INFO [geoserver.security] - AuthenticationCache Eviction Task created to run every 600 seconds
2019-05-31 10:06:42,506 INFO [config.GeoserverXMLResourceProvider] - Found configuration file in /opt/data/gwc_cache_dir
2019-05-31 10:06:42,516 INFO [config.GeoserverXMLResourceProvider] - Found configuration file in /opt/data/gwc_cache_dir
2019-05-31 10:06:42,542 INFO [config.XMLConfiguration] - Wrote configuration to /opt/data/gwc_cache_dir
2019-05-31 10:06:42,547 INFO [geoserver.importer] - Enabling import store: memory
你的 GeoServer
应该在
http://localhost:8080/geoserver/
警告
如果出现错误或文件 geoserver.log
不是创建的,请检查catalina日志以了解发生了什么。
sudo less /usr/local/apache-tomcat8/logs/catalina.out
可以测试新的运行 GeoServer
与 GeoNode
摊铺机服务 (DEBUG
模式)。这样做
workon geonode
cd /opt/geonode/
paver start_django
警告
这个 paver reset
从现在起命令 不会 清理 GeoServer
还有它的目录。因此,在这些测试期间上载的每个数据将保持在 GeoServer
即使 GeoNode
将被重置。
Web服务器¶
到现在为止我们已经看到了如何开始 GeoNode
在里面 DEBUG
从命令行通过 paver
公用事业。这当然不是最好的开始方式。而且你还需要一个 HTTPD
在端口上运行的服务器 80
如果你想向全世界公开你的服务器。
在本节中,我们将看到:
如何配置
NGINX
httpd服务器到主机GeoNode
和GeoServer
是的。在初始设置中,我们仍将在http://localhost
更新
settings
为了连接GeoNode
和GeoServer
到PostgreSQL
数据库。更新
settings
为了更新GeoNode
和GeoServer
在上运行的服务 公共IP 或 主机名 .安装并启用
HTTPS
通过Let's Encrypt
供应商。
安装和配置nginx¶
警告
在执行下一步之前,请确保 GeoNode
摊铺机服务已停止。这样做
workon geonode
cd /opt/geonode/
paver stop_django
# Install the services
sudo apt install -y nginx uwsgi uwsgi-plugin-python3
通过nginx服务{“geonode”,“geoserver”}¶
# Create the GeoNode UWSGI config
sudo vim /etc/uwsgi/apps-available/geonode.ini
[uwsgi]
socket = 0.0.0.0:8000
uid = geonode
gid = www-data
plugins = python3
virtualenv = /home/geonode/.virtualenvs/geonode
env = DEBUG=False
env = DJANGO_SETTINGS_MODULE=geonode.settings
env = SECRET_KEY='RanD0m%3cr3tK3y'
env = SITE_HOST_NAME=localhost
env = SITEURL=http://localhost/
env = LOCKDOWN_GEONODE=False
env = SESSION_EXPIRED_CONTROL_ENABLED=True
env = FORCE_SCRIPT_NAME=
env = EMAIL_ENABLE=False
env = DJANGO_EMAIL_HOST_USER=
env = DJANGO_EMAIL_HOST_PASSWORD=
env = DJANGO_EMAIL_HOST=localhost
env = DJANGO_EMAIL_PORT=25
env = DJANGO_EMAIL_USE_TLS=False
env = DJANGO_EMAIL_USE_SSL=False
env = DEFAULT_FROM_EMAIL=GeoNode <no-reply@localhost>
env = MONITORING_ENABLED=True
env = GEOSERVER_PUBLIC_HOST=localhost
env = GEOSERVER_PUBLIC_PORT=
env = GEOSERVER_ADMIN_PASSWORD=geoserver
env = GEOSERVER_LOCATION=http://localhost/geoserver/
env = GEOSERVER_PUBLIC_LOCATION=http://localhost/geoserver/
env = GEOSERVER_WEB_UI_LOCATION=http://localhost/geoserver/
env = RESOURCE_PUBLISHING=False
env = ADMIN_MODERATE_UPLOADS=False
env = GROUP_PRIVATE_RESOURCES=False
env = GROUP_MANDATORY_RESOURCES=False
env = OGC_REQUEST_TIMEOUT=60
env = OGC_REQUEST_MAX_RETRIES=3
env = OGC_REQUEST_POOL_MAXSIZE=100
env = OGC_REQUEST_POOL_CONNECTIONS=100
env = EXIF_ENABLED=True
env = CREATE_LAYER=False
env = FAVORITE_ENABLED=True
chdir = /opt/geonode
module = geonode.wsgi:application
processes = 4
threads = 2
enable-threads = true
master = true
# logging
# path to where uwsgi logs will be saved
logto = /opt/data/logs/geonode.log
daemonize = /opt/data/logs/geonode.log
touch-reload = /opt/geonode/geonode/wsgi.py
buffer-size = 32768
max-requests = 500
harakiri = 300 # respawn processes taking more than 5 minutes (300 seconds)
max-requests = 500 # respawn processes after serving 5000 requests
# limit-as = 1024 # avoid Errno 12 cannot allocate memory
harakiri-verbose = true
vacuum = true
thunder-lock = true
# Enable the GeoNode UWSGI config
sudo ln -s /etc/uwsgi/apps-available/geonode.ini /etc/uwsgi/apps-enabled/geonode.ini
# Restart UWSGI Service
sudo service uwsgi restart
# Backup the original NGINX config
sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
# Create the GeoNode Default NGINX config
sudo vim /etc/nginx/nginx.conf
# Make sure your nginx.config matches the following one
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_buffers 16 8k;
gzip_min_length 1100;
gzip_comp_level 6;
gzip_types video/mp4 text/plain application/javascript application/x-javascript text/javascript text/xml text/css image/jpeg;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
# Remove the Default NGINX config
sudo rm /etc/nginx/sites-enabled/default
# Create the GeoNode App NGINX config
sudo vim /etc/nginx/sites-available/geonode
uwsgi_intercept_errors on;
upstream geoserver_proxy {
server localhost:8080;
}
# Expires map
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
charset utf-8;
etag on;
expires $expires;
proxy_read_timeout 600s;
# set client body size to 2M #
client_max_body_size 50000M;
location / {
etag off;
uwsgi_pass 127.0.0.1:8000;
uwsgi_read_timeout 600s;
include uwsgi_params;
}
location /static/ {
alias /opt/geonode/geonode/static_root/;
}
location /uploaded/ {
alias /opt/geonode/geonode/uploaded/;
}
location /geoserver {
proxy_pass http://geoserver_proxy;
include proxy_params;
}
}
# Enable GeoNode NGINX config
sudo ln -s /etc/nginx/sites-available/geonode /etc/nginx/sites-enabled/geonode
# Restart the services
sudo systemctl restart tomcat
sudo service nginx restart
刷新 GeoNode
静态数据
workon geonode
cd /opt/geonode
python manage.py collectstatic --no-input
Refresh GeoNode
and GeoServer
OAuth2 settings
workon geonode
cd /opt/geonode
# This must be done the first time only
sudo cp package/support/geonode.binary /usr/bin/geonode
sudo cp package/support/geonode.updateip /usr/bin/geonode_updateip
sudo chmod +x /usr/bin/geonode
sudo chmod +x /usr/bin/geonode_updateip
pip install -e git+https://github.com/justquick/django-activity-stream.git#egg=django-activity-stream
# Update the GeoNode ip or hostname
sudo PYTHONWARNINGS=ignore VIRTUAL_ENV=$VIRTUAL_ENV DJANGO_SETTINGS_MODULE=geonode.settings GEONODE_ETC=/opt/geonode GEOSERVER_DATA_DIR=/opt/data/geoserver_data TOMCAT_SERVICE="service tomcat" APACHE_SERVICE="service nginx" geonode_updateip -p localhost
这个 GeoNode
服务现在应该在上运行 http://localhost/
这个 GeoServer
服务现在应该在上运行 http://localhost/geoserver/
您应该能够使用默认用户登录 admin
(普华永道) admin
)上传你的图层。
更新设置以便使用 PostgreSQL
数据库¶
警告
请确保已按照前面部分中的说明安装并配置了数据库。
workon geonode
cd /opt/geonode
cp geonode/local_settings.py.geoserver.sample geonode/local_settings.py
# In case you want to change the DB password, run the following
# sudo sed -i -e "s/'PASSWORD': 'geonode',/'PASSWORD': '<your_db_role_password>',/g" geonode/local_settings.py
# Stop Tomcat
sudo systemctl stop tomcat
# Initialize GeoNode
DJANGO_SETTINGS_MODULE=geonode.local_settings paver reset
DJANGO_SETTINGS_MODULE=geonode.local_settings paver setup
DJANGO_SETTINGS_MODULE=geonode.local_settings paver sync
DJANGO_SETTINGS_MODULE=geonode.local_settings python manage.py collectstatic --noinput
在完成配置之前,我们需要更新 UWSGI
设置
sudo vim /etc/uwsgi/apps-enabled/geonode.ini
变化 geonode.settings
到 geonode.local_settings
:%s/geonode.settings/geonode.local_settings/g
:wq
重新启动 UWSGI
更新 OAuth2
通过使用新的 geonode.local_settings
警告
啊!重要! 在下面的语句中,请确保使用 DJANGO_SETTINGS_MODULE=geonode.local_settings
# Restart UWSGI
sudo service uwsgi restart
# Update the GeoNode ip or hostname
sudo PYTHONWARNINGS=ignore VIRTUAL_ENV=$VIRTUAL_ENV DJANGO_SETTINGS_MODULE=geonode.local_settings GEONODE_ETC=/opt/geonode GEOSERVER_DATA_DIR=/opt/data/geoserver_data TOMCAT_SERVICE="service tomcat" APACHE_SERVICE="service nginx" geonode_updateip -p localhost
更新设置以更新在公用IP或主机名上运行的geonode和geoserver服务¶
警告
在将您的服务公开到Internet之前, 确保 你的系统是 硬化的 和 足够安全 是的。有关详细信息,请参阅特定文档部分。
假设您希望在公共IP或域上运行服务,例如。 www.example.org
是的。为了反映新的服务器名称,您需要稍微更新服务。
具体步骤如下:
更新
NGINX
为新域名服务的配置。
sudo vim /etc/nginx/sites-enabled/geonode # Update the 'server_name' directive server_name example.org www.example.org; # Restart the service sudo service nginx restart
更新
UWSGI
为新域名服务的配置。
sudo vim /etc/uwsgi/apps-enabled/geonode.ini # Change everywhere 'localhost' to the new hostname :%s/localhost/www.example.org/g :wq # Restart the service sudo service uwsgi restart
更新
OAuth2
配置以命中新主机名。
workon geonode cd /opt/geonode # Update the GeoNode ip or hostname sudo PYTHONWARNINGS=ignore VIRTUAL_ENV=$VIRTUAL_ENV DJANGO_SETTINGS_MODULE=geonode.local_settings GEONODE_ETC=/opt/geonode GEOSERVER_DATA_DIR=/opt/data/geoserver_data TOMCAT_SERVICE="service tomcat" APACHE_SERVICE="service nginx" geonode_updateip -l localhost -p www.example.org
更新现有
GeoNode
链接以命中新主机名。
workon geonode cd /opt/geonode # Update the GeoNode ip or hostname DJANGO_SETTINGS_MODULE=geonode.local_settings python manage.py migrate_baseurl --source-address=http://localhost --target-address=http://www.example.org
通过let's encrypt提供程序安装并启用https安全连接¶
# Install Let's Encrypt Certbot
sudo add-apt-repository ppa:certbot/certbot
sudo apt update -y; sudo apt install python-certbot-nginx -y
# Reload NGINX config and make sure the firewall denies access to HTTP
sudo systemctl reload nginx
sudo ufw allow 'Nginx Full'
sudo ufw delete allow 'Nginx HTTP'
# Create and dump the Let's Encrypt Certificates
sudo certbot --nginx -d example.org -d www.example.org
# ...choose the redirect option when asked for
Update the
GeoNode
OAuth2Redirect URIs
accordingly.
从
GeoNode Admin Dashboard
去Home › Django/GeoNode OAuth Toolkit › Applications › GeoServer
![]()
重定向uri¶
更新
GeoServer
Proxy Base URL
因此。
从
GeoServer Admin GUI
去About & Status > Global
![]()
代理基URL¶
更新
GeoServer
Role Base URL
因此。
从
GeoServer Admin GUI
去Security > Users, Groups, Roles > geonode REST role service
![]()
角色库URL¶
更新
GeoServer
OAuth2 Service Parameters
因此。
从
GeoServer Admin GUI
去Security > Authentication > Authentication Filters > geonode-oauth2
![]()
OAuth2服务参数¶
更新
UWSGI
配置
sudo vim /etc/uwsgi/apps-enabled/geonode.ini # Change everywhere 'http' to 'https' %s/http/https/g # Add three more 'env' variables to the configuration env = SECURE_SSL_REDIRECT=True env = SECURE_HSTS_INCLUDE_SUBDOMAINS=True env = AVATAR_GRAVATAR_SSL=True # Restart the service sudo service uwsgi restart![]()
uwsgi配置¶
CentOS 7.0版¶
TODO
Windows¶
在这一节中,我们将讨论geonode在windows中的安装过程。此进程将在windows计算机中安装geonode并在本地运行。
Python设置¶
从以下位置下载并安装python 3.7 this link
确保将python添加到环境变量path中。如果您不知道如何将python添加到环境变量中,可以检查 this tutorial
打开命令提示符并键入
python --version
检查是否添加转到您的工作目录并克隆geonode repo
使用创建vitrualenv
pip
命令
cd your/working/directory
pip install virtualenv
virtualenv ./venv
# Activate virtualenv
.\venv\Scripts\activate.bat
cd your/working/directory
git clone https://github.com/GeoNode/geonode.git
Gdal安装¶
这个 gdal
可以通过安装 OSGeo4W
. 但这次我们需要手动安装。这次我们需要在我们的 virtual environment
.
转到 Unofficial Windows Binaries for Python Extension Packages 并下载兼容的gdal wheel文件
注解
首先检查您的python版本 (python --version ). 下载相同版本的 whl file
. 如果安装了 python 3.7
,那么你应该下载 GDAL‑2.4.1‑cp37‑cp37m‑win_amd64.whl
文件。在这里 cp37
和 amd64
意味着它与 64 bit python 3.7
使用此工具安装gdal
whl file
# Activate virtualenv
cd your/working/directory
.\venv\Scripts\activate.bat
# install gdal inside your virtualenv
pip install <path/to/gdal//wheel/file/GDAL‑2.4.1‑cp37‑cp37m‑win_amd64.whl>
安装所需的库并在本地运行¶
对于所需库的安装,应遵循以下步骤:,
编辑
requirement.txt
文件
cd your/working/directory
notepad requirement.txt
它会打开要求.txt记事本中的文件。改变 Shapely==1.7.0
到 Shapely==1.6.3
. 由于我们不打算在windows中部署geonode,请从要求.txt文件,
#生产uWSGI==2.0.18 gunicorn==20.0.4 ipython==7.14.0 docker==4.2.0 invoke==1.4.1
安装要求.txt文件
# Activate virtualenv
cd your/working/directory
.\venv\Scripts\activate.bat
# Install requirement.txt file inside virtualenv
pip install -r requirements.txt --upgrade --no-cache --no-cache-dir
pip install -e .
在中运行geonode
DEBUG (DEVELOPMENT)
模式
# Prepare the GeoNode SQLite database (the first time only)
paver setup
paver sync
python manage.py runserver
现在geonode将在您的windows上运行。
Postgresql数据库设置¶
在本节中,我们将安装安装程序 PostgreSQL
GeoNode上的数据库。GeoNode使用 PostgreSQL 11
数据库。
安装后
PostgreSQL 11
,打开stack builder
并安装名为postgis
警告
请确保从stack builder安装postgis扩展,否则它将无法工作。
现在是时候创建数据库和添加用户了
警告
请确保已将postgresql添加到 environment variable path
. 否则 psql
将无法在命令提示符中识别。你也可以搜索 psql
并直接从 psql shell
# It will open the psql command line
psql -U postgres
# Create database named as geonode and geonode_data
CREATE DATABASE geonode;
CREATE DATABASE geonode_data;
# Create user named as geonode and password as geonode
CREATE USER geonode WITH ENCRYPTED PASSWORD 'geonode';
# Grant all the privileges of geonode and geonode_data database to user geonode
GRANT ALL PRIVILEGES ON DATABASE geonode TO geonode;
GRANT ALL PRIVILEGES ON DATABASE geonode_data TO geonode;
改变
pg_hba.conf
文件(C:Program FilesPostgreSQL11datapg_hba.conf)如下所示,以便您可以在本地计算机中无需密码即可访问数据库
# "local" is for Unix domain socket connections only
# local all all peer
local all all trust
重新启动
PostgreSQL
使更改生效
更新Django设置¶
现在是时候将postgres数据库与django连接起来了。你需要遵循以下步骤,
重命名文件
local_settings.py.geoserver.sample
到local_settings.py
(此文件位于GEONODE_INSTALLATION_DIR/GEONODE/)用local初始化GeoNode_设置.py文件。
# Initialize GeoNode
set DJANGO_SETTINGS_MODULE=geonode.local_settings paver reset
set DJANGO_SETTINGS_MODULE=geonode.local_settings paver setup
set DJANGO_SETTINGS_MODULE=geonode.local_settings paver sync
set DJANGO_SETTINGS_MODULE=geonode.local_settings python manage.py collectstatic --noinput
现在可以使用postgresql数据库在本地运行geonode。使用以下命令
python manage.py runserver --settings=geonode.local_settings
码头工人¶
在本节中,我们将列出需要:
安装
Docker
和docker-compose
ubuntu主机上的包部署香草
GeoNode 3.0
具有Docker
重写
ENV
要在上部署的变量public IP
或domain
访问
django4geonode
更新代码库和/或更改内部设置的Docker映像访问
geoserver4geonode
更新GeoServer版本的Docker映像
彻底摆脱旧的通道
Docker
图像和卷(彻底修剪环境)
在ubuntu主机上安装docker和docker compose包¶
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 geonode
su geonode
在centos主机上安装docker和docker compose包¶
Docker设置(仅限第一次)¶
警告
这个 centos-extras 必须启用存储库
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 usermod -aG docker geonode
su geonode
使用Docker部署一个vanilla Geonode3.0¶
克隆项目
# Let's create the GeoNode core base folder and clone it
sudo mkdir -p /opt/geonode/
sudo usermod -a -G www-data geonode
sudo chown -Rf geonode:www-data /opt/geonode/
sudo chmod -Rf 775 /opt/geonode/
# Clone the GeoNode source code on /opt/geonode
cd /opt
git clone https://github.com/GeoNode/geonode.git geonode
启动Docker实例 localhost
警告
第一次提取图像需要一些时间。你需要一个良好的互联网连接。
cd /opt/geonode
docker-compose -f docker-compose.yml -f docker-compose.override.localhost.yml pull
docker-compose -f docker-compose.yml -f docker-compose.override.localhost.yml up -d
注解
如果你想从头开始重建Docker图像,而不是 pulling
他们来自 Docker Hub
添加 --build
up命令的参数,例如:
docker-compose -f docker-compose.yml -f docker-compose.override.localhost.yml up --build
在这种情况下,您当然可以跳过 pull
步骤下载 pre-built
图像。
注解
要启动已守护的容器,这意味着它们将在后台启动(如果 log out
从服务器或关闭 shell
)添加 -d
选择权 up
命令如下。 docker-compose
如有必要(如启动后),请注意重新启动容器。
docker-compose -f docker-compose.yml -f docker-compose.override.localhost.yml up -d
# If you want to rebuild the images also
docker-compose -f docker-compose.yml -f docker-compose.override.localhost.yml up --build -d
测试实例并跟踪日志¶
如果运行已守护的容器(使用 -d
选项),您可以运行特定的docker命令来遵循 startup and initialization logs
或输入图像 shell
检查一下 GeoNode logs
.
为了遵循 startup and initialization logs
,需要从存储库文件夹运行以下命令
cd /opt/geonode
docker logs -f django4geonode
或者:
cd /opt/geonode
docker-compose logs -f django
您应该能够看到几个初始化消息。一旦容器启动并运行,您将看到以下语句
...
789 static files copied to '/mnt/volumes/statics/static'.
static data refreshed
Executing UWSGI server uwsgi --ini /usr/src/app/uwsgi.ini for Production
[uWSGI] getting INI configuration from /usr/src/app/uwsgi.ini
刚退出 CTRL+C
.
此消息表示geonode容器已启动。浏览到 http://localhost/
将显示geonode主页。您应该能够使用默认管理员用户成功登录 (admin
/ admin
)马上开始使用。
使用Docker,还可以在容器中运行shell,并按照与在物理主机上部署的完全相同的日志进行操作。为了完成这次跑步
docker exec -it django4geonode /bin/bash
# Once logged in the GeoNode image, follow the logs by executing
tail -F -n 300 /var/log/geonode.log
或者:
docker-compose exec django /bin/bash
刚退出 CTRL+C
和 exit
回到主人身边。
重写要部署在公用IP或域上的env变量¶
如果您想在 public IP
或 domain
,假设 www.example.org
你可以
cd /opt/geonode
# Stop the Containers (if running)
docker-compose stop
编辑 ENV
覆盖文件以便部署到 www.example.org
# Make a copy of docker-compose.override.localhost.yml
cp docker-compose.override.localhost.yml docker-compose.override.example-org.yml
到处替换 localhost
具有 www.example.org
vim docker-compose.override.example-org.yml
# e.g.: :%s/localhost/www.example.org/g
version: '2.2'
services:
django:
build: .
# Loading the app is defined here to allow for
# autoreload on changes it is mounted on top of the
# old copy that docker added when creating the image
volumes:
- '.:/usr/src/app'
environment:
- DEBUG=False
- GEONODE_LB_HOST_IP=www.example.org
- GEONODE_LB_PORT=80
- SITEURL=http://www.example.org/
- ALLOWED_HOSTS=['www.example.org', ]
- GEOSERVER_PUBLIC_LOCATION=http://www.example.org/geoserver/
- GEOSERVER_WEB_UI_LOCATION=http://www.example.org/geoserver/
celery:
build: .
volumes:
- '.:/usr/src/app'
environment:
- DEBUG=False
- GEONODE_LB_HOST_IP=www.example.org
- GEONODE_LB_PORT=80
- SITEURL=http://www.example.org/
- ALLOWED_HOSTS=['www.example.org', ]
- GEOSERVER_PUBLIC_LOCATION=http://www.example.org/geoserver/
- GEOSERVER_WEB_UI_LOCATION=http://www.example.org/geoserver/
geoserver:
environment:
- GEONODE_LB_HOST_IP=www.example.org
- GEONODE_LB_PORT=80
# - NGINX_BASE_URL=
注解
这里可以覆盖更多的变量来定制geonode实例。见 GeoNode Settings
以获取可用选项的列表。
在后台程序模式下运行容器
docker-compose -f docker-compose.yml -f docker-compose.override.example-org.yml up --build -d
访问django4geonode docker容器以更新代码库和/或更改内部设置¶
进入集装箱 bash
docker exec -i -t django4geonode /bin/bash
您将作为 root
是的。文件夹是 /usr/src/app/
克隆geonode项目的位置。在这里您可以找到github存储库中的geonode源代码。
注解
机器默认为空,否 Ubuntu
已安装程序包。如果需要安装文本编辑器或其他工具,则必须运行以下命令:
apt update
apt install <package name>
e.g.:
apt install vim
更新模板或 Django models
是的。一旦进入 bash
您可以编辑模板或django模型/类。从这里你可以运行任何标准 Django management command
.
每当你换一个 template/CSS/Javascript
记住以后再跑:
python manage.py collectstatic
为了将文件更新到 statics
Docker音量。
警告
这是一个外部卷,简单的重新启动不会更新它。你必须小心,并保持它与你的变化一致。
每当需要更改某些设置或环境变量时,最简单的做法是:
# Stop the container
docker-compose stop
# Restart the container in Daemon mode
docker-compose -f docker-compose.yml -f docker-compose.override.<whatever>.yml up -d
无论何时更改模型,请记住稍后在容器中通过 bash
:
python manage.py makemigrations
python manage.py migrate
访问geoserver4geonode docker容器以更新geoserver版本¶
此过程允许您访问geoserver容器。
这个概念与上面的完全相同,用 bash
.
# Access the container bash
docker exec -it geoserver4geonode /bin/bash
您将作为 root
.
geoserver部署在apache tomcat实例上,可以在这里找到
cd /usr/local/tomcat/webapps/geoserver
警告
地理服务器 DATA_DIR
部署在外部Docker卷上 geonode_gsdatadir
是的。此数据目录不会受geoserver应用程序更改的影响,因为它是 external
.
更新geoserver容器中的geoserver实例
警告
旧配置将保留,因为它是 external
docker exec -it geoserver4geonode bash
cd /usr/local/tomcat/
wget --no-check-certificate https://build.geo-solutions.it/geonode/geoserver/latest/geoserver-.2.17.2.war
mkdir tmp/geoserver
cd tmp/geoserver/
unzip /usr/local/tomcat/geoserver-2.17.2.war
rm -Rf data
cp -Rf /usr/local/tomcat/webapps/geoserver/data/ .
cd /usr/local/tomcat/
mv webapps/geoserver/ .
mv tmp/geoserver/ webapps/
exit
docker restart geoserver4geonode
警告
地理节点2.8.1是 NOT 与geoserver>2.13.x兼容
地理节点2.8.2/2.10.x NOT 与GeoServer兼容<2.14.x
Geonode3.x是 NOT 兼容GeoServer<2.16.x
删除所有数据并将正在运行的geonode部署带入初始阶段¶
此过程允许您停止所有容器并在删除所有卷后重置所有数据。
cd /opt/geonode
# stop containers and remove volumes
docker-compose down -v
彻底清除旧Docker图像和卷的通道(完全重置环境)¶
注解
有关docker命令的更多详细信息,请参阅docker官方文档。
可以让Docker显示当前正在运行的容器(添加 -a
对于所有容器,也包括停止的容器)
# Show the currently running containers
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3b232931f820 geonode/nginx:production "nginx -g 'daemon of…" 26 minutes ago Up 26 minutes 0.0.0.0:80->80/tcp nginx4geonode
ff7002ae6e91 geonode/geonode:latest "/usr/src/app/entryp…" 26 minutes ago Up 26 minutes 8000/tcp django4geonode
2f155e5043be geonode/geoserver:2.17.2 "/usr/local/tomcat/t…" 26 minutes ago Up 26 minutes 8080/tcp geoserver4geonode
97f1668a01b1 geonode_celery "/usr/src/app/entryp…" 26 minutes ago Up 26 minutes 8000/tcp geonode_celery_1
1b623598b1bd geonode/postgis:10 "docker-entrypoint.s…" About an hour ago Up 26 minutes 5432/tcp db4geonode
通过运行停止所有容器
docker-compose stop
通过运行强制杀死所有容器
docker kill $(docker ps -q)
如果您想清理所有容器和图像,而不删除静态卷(即 DB
以及 GeoServer catalog
),发出以下命令
# Remove all containers
docker rm $(docker ps -a -q)
# Remove all docker images
docker rmi $(docker images -q)
# Prune the old images
docker system prune -a
如果要删除 volume
也
# List of the running volumes
docker volume ls
# Remove the GeoServer catalog by its name
docker volume rm -f geonode-gsdatadir
# Remove all dangling docker volumes
docker volume rm $(docker volume ls -qf dangling=true)
# update all images, should be run regularly to fetch published updates
for i in $(docker images| awk 'NR>1{print $1":"$2}'| grep -v '<none>'); do docker pull "$i" ;done