2. 部署 CubicWeb 应用¶
2.1. uwsgi部署¶
uWSGI 通常用于部署CubicWeb应用程序。
安装短版本 uwsgi :
apt install uwsgi
为应用程序部署配置文件 /etc/uwsgi/apps-enabled/example.ini :
[uwsgi]
master = true
http = 0.0.0.0:8080
env = CW_INSTANCE=example
wsgi-file = /etc/cubicweb.d/example/wsgiapp.py
processes = 8
threads = 1
plugins = http,python3
auto-procname = true
lazy-apps = true
log-master = true
# disable uwsgi request logging
disable-logging = true
stats = 127.0.0.1:1717
这个 wsgiapp.py 文件如下所示:
import os
from cubicweb.pyramid import wsgi_application_from_cwconfig
from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
appid = os.environ['CW_INSTANCE'] # instance name
cwconfig = cwcfg.config_for(appid)
cwconfig.log_format = ('{0} pid:{1} (%(name)s) %(levelname)s: %(message)s'
.format(appid, os.getpid()))
application = wsgi_application_from_cwconfig(cwconfig)
repo = application.application.registry['cubicweb.repository']
2.2. 使用SaltStack部署¶
使用SaltStack部署可以参考 cubicweb-formula .
2.3. 与Kubernetes部署¶
要在Kubernetes集群中部署,您可以从 the fresh cube 以及 deployment yaml files .