[PATCH 12 of 15 cubicweb] [doc/book/admin] initial version of deploy cubicweb page in documentation

Arthur Lutz arthur.lutz at logilab.fr
Fri Jan 31 17:26:41 CET 2020


# HG changeset patch
# User Arthur Lutz <arthur.lutz at logilab.fr>
# Date 1580486845 -3600
#      Fri Jan 31 17:07:25 2020 +0100
# Node ID 2603db42720a4607bfdc428492ba037c4ceef4c8
# Parent  75ee2ceeeb6c3d013d2a7c9ec3e754c94693c900
# EXP-Topic doc-cleanup
[doc/book/admin] initial version of deploy cubicweb page in documentation

diff --git a/doc/book/admin/deploy.rst b/doc/book/admin/deploy.rst
new file mode 100644
--- /dev/null
+++ b/doc/book/admin/deploy.rst
@@ -0,0 +1,62 @@
+.. -*- coding: utf-8 -*-
+
+Deploy a *CubicWeb* application
+===============================
+
+Deployment with uwsgi
+---------------------
+
+`uWSGI <https://uwsgi-docs.readthedocs.io/>`_ is often used to deploy CubicWeb
+applications.
+
+Short version is install `uwsgi` ::
+
+  apt install uwsgi
+
+Deploy a configuration file for your application
+`/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
+
+The `wsgiapp.py` file looks like this ::
+
+    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}'.format(appid, os.getpid()) +
+                                ' (%(name)s) %(levelname)s: %(message)s')
+
+    application = wsgi_application_from_cwconfig(cwconfig,)
+    repo = application.application.registry['cubicweb.repository']
+
+
+Deployment with SaltStack
+-------------------------
+
+To deploy with SaltStack one can refer themselves to the
+`cubicweb-formula <https://hg.logilab.org/master/salt/cubicweb-formula/>`_.
+
+Deployment with Kubernetes
+--------------------------
+
+To deploy in a Kubernetes cluster, you can take inspiration from the
+instructions included in
+`the fresh cube  <https://hg.logilab.org/master/cubes/fresh/file/tip/README.rst#l20>`_
+and the `deployment yaml files <https://hg.logilab.org/master/cubes/fresh/file/tip/deploy>`_.
diff --git a/doc/book/admin/index.rst b/doc/book/admin/index.rst
--- a/doc/book/admin/index.rst
+++ b/doc/book/admin/index.rst
@@ -14,6 +14,7 @@
    :numbered:
 
    setup
+   deploy
    config
    cubicweb-ctl
    create-instance



More information about the cubicweb-devel mailing list