
pcic/pdpThe PCIC Data Portal contains the frontend code required for the PCIC Data Portal as well as WSGI callables to deploy the entire application within a WSGI container.
The following guide assumes an ubuntu/debian based system.
The pdp requires that pip and tox be installed.
bashsudo apt-get install python-pip python-dev build-essential sudo pip install tox ## or pip install tox --user
Some of the required python libraries have system-level dependencies.
bashsudo apt-get install libhdf5-dev libnetcdf-dev libgdal-dev
And GDAL doesn't properly source it's own lib paths when installing the python package:
bashexport CPLUS_INCLUDE_PATH=/usr/include/gdal export C_INCLUDE_PATH=/usr/include/gdal
With the prerequisites, creating a development environment should be as simple as:
bashgit clone [***] cd pdp tox -e devenv
It could take 5-30 minutes since tox will not use system packages and needs to build any package which requires it.
It is best practice to maintain a consistent virtual environment for production.
bashgit clone [***] cd pdp virtualenv pyenv
The pdp will run in any WSGI container. This guide uses gunicorn.
bashpyenv/bin/pip install -i [***] -r requirements.txt -r data_format_requirements.txt -r test_requirements.txt -r deploy_requirements.txt
Install and build the docs. Building the docs requires the package to be installed, then installed again after the docs are built.
bashpyenv/bin/python setup.py install pyenv/bin/python setup.py build_sphinx pyenv/bin/python setup.py install
Configuration of the PDP is accomplished through a set of environment variables. A sample environment file is stored in pdp/config.env. This environment file can be sourced in before you run the pdp, included in a Docker deployment or used in any other flexible way.
bashsource pdp/config.env export $(grep -v '^#' pdp/config.env | cut -d= -f1)
app_root
Root location where data portal will be exposed. This location will need to be proxied to whatever port the server will be running on.
data_root
Root location of backend data server. Probably <app_root>/data. If you are running in production, this location will need to be proxied to whatever port the data server will be running on. When running a development server, this is redirected internally.
dsn
Raster metadata database url of the form dialect[+driver]://username:password@host:port/database. Password must either be supplied or available in the user's ~/.pgpass file.
pcds_dsn
PCDS database URL of the form dialect[+driver]://username:password@host:port/database. Password must either be supplied or available in the user's ~/.pgpass file.
js_min
Determine's use of javascript bundling/minification.
geoserver_url
PCDS Geoserver URL
ncwms_url
Raster portal ncWMS URL
tilecache_url
Tileserver URLs (space separated list) for base maps
use_analytics
Enable or disable Google Analytics reporting
analytics
Google Analytics ID
When correctly configured, all the tests should now pass.
bashpyenv/bin/py.test -vv --tb=short tests
Provided you installed everything with tox, you should be able to run a development server with
bashdevenv/bin/python scripts/rast_serve -p <port> [-t]
A production install should be run in a production ready WSGI container with proper process monitoring. We use gunicorn as the WSGI container, Supervisord for process monitoring, and Apache as a reverse proxy.
In production, the frontend and backend are ran in seperate WSGI containers. This is because the front end serves short, non-blocking requests, whereas the back end serves fewer long, process blocking requests.
Running in gunicorn can be tested with a command similar to the following:
bashpyenv/bin/gunicorn -b 0.0.0.0:<port1> pdp.wsgi:frontend pyenv/bin/gunicorn -b 0.0.0.0:<port2> pdp.wsgi:backend
Note: this is only an example process monitoring setup. Details can and will be different depending on your particular deployment stragety
Set up the Supervisord config file using
bashpyenv/bin/echo_supervisord_conf > /install/location/supervisord.conf
In order to run Supervisord, the config file must have a [supervisord] section. Here's a sample section:
ini[supervisord] logfile=/install/location/etc/<supervisord_logfile> ; (main log file;default $CWD/supervisord.log) loglevel=info ; (log level;default info; others: debug,warn,trace) nodaemon=true ; (start in foreground if true; useful for debugging)
Supervisorctl is a command line utility that lets you see the status and output of processes and start, stop and restart them. The following will set up supervisorctl using a unix socket file, but it is also possible to monitor processes using a web interface if you wish to do so.
ini[unix_http_server] file = /tmp/supervisord.sock [supervisorctl] serverurl = unix:///tmp/supervisord.sock [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
Front end config
ini[program:pdp_frontend-v.v.v] command=/install/location/pyenv/bin/gunicorn -b 0.0.0.0:<port> --access-logfile=<access_logfile> --error-logfile=<error_logfile> pdp.wsgi:frontend directory=/install/location/ user=www-data environment=OPTION0="",OPTION2=""... autostart=true autorestart=true redirect_stderr=True killasgroup=True
Back end config
ini[program:pdp_backend-v.v.v] command=/install/location/pyenv/bin/gunicorn -b 0.0.0.0:<port> --workers 10 --worker-class gevent -t 3600 --access-logfile=<access_logfile> --error-logfile=<error_logfile> pdp.wsgi:backend directory=/install/location/ user=www-data environment=OPTION0="",OPTION2=""... autostart=true autorestart=true redirect_stderr=True killasgroup=True
To make starting/stop easier, add a group to supervisord.conf
ini[group:v.v.v] programs=pdp_frontend-v.v.v,pdp_backend-v.v.v
Once the config file has been set up, start the processes with the following command:
bashpyenv/bin/supervisord -c path/to/supervisord.conf
After invoking Supervisord, use supervisorctl to monitor and update the running processes
bashpyenv/bin/supervisorctl
When upgrading, it's easiest to simply copy the existing config and update the paths/version number.
IMPORTANT: When adding a new version, make sure to set the old version autostart and autorestart to false.
Using supervisorctl, you should then be able to reread the new config, update the old version config (so it stops, picks up new autostart/autorestart=false), and update the new version.
If there are any errors, they can be found in the supervisord_logfile. Errors starting gunicorn can be found in the error_logfile.




探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
MacOS OrbStack 容器配置
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务