浏览代码

Merge pull request #68 from tracim/feature/67_use_uwsgi

Damien Accorsi 7 年前
父节点
当前提交
74c1813eec
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 49 次插入7 次删除
  1. 28 7
      README.md
  2. 9 0
      wsgi/web.py
  3. 12 0
      wsgi/webdav.py

+ 28 - 7
README.md 查看文件

73
 
73
 
74
     tracimcli db init
74
     tracimcli db init
75
 
75
 
76
-### Run Tracim_backend ###
76
+create wsgidav configuration file for webdav:
77
 
77
 
78
-Run your project:
78
+    cp wsgidav.conf.sample wsgidav.conf
79
 
79
 
80
-    pserve development.ini
80
+## Run Tracim_backend ##
81
 
81
 
82
-### Configure and Run Webdav Server (Unstable) ###
82
+### With Uwsgi ###
83
 
83
 
84
-create wsgidav configuration file :
84
+Run all services with uwsgi
85
 
85
 
86
-    cp wsgidav.conf.sample wsgidav.conf
86
+    # install uwsgi with pip ( unneeded if you already have uwsgi with python3 plugin enabled)
87
+    sudo pip3 install uwsgi
88
+    # set tracim_conf_file path
89
+    export TRACIM_CONF_PATH="$(pwd)/development.ini"
90
+    export TRACIM_WEBDAV_CONF_PATH="$(pwd)/wsgidav.conf"
91
+    # pyramid webserver
92
+    uwsgi -d /tmp/tracim_web.log --http-socket :6543 --wsgi-file wsgi/web.py -H env --pidfile /tmp/tracim_web.pid
93
+    # webdav wsgidav server
94
+    uwsgi -d /tmp/tracim_webdav.log --http-socket :3030 --wsgi-file wsgi/webdav.py -H env --pidfile /tmp/tracim_webdav.pid
95
+
96
+to stop them:
97
+
98
+    # pyramid webserver
99
+    uwsgi --stop /tmp/tracim_web.pid
100
+    # webdav wsgidav server
101
+    uwsgi --stop /tmp/tracim_webdav.pid
102
+
103
+### With Waitress (legacy way, usefull for debug) ###
104
+
105
+run tracim_backend web api:
106
+
107
+    pserve developement.ini
87
 
108
 
88
 run wsgidav server:
109
 run wsgidav server:
89
 
110
 
90
     tracimcli webdav start
111
     tracimcli webdav start
91
 
112
 
92
-### Run Tests and others checks ###
113
+## Run Tests and others checks ##
93
 
114
 
94
 Run your project's tests:
115
 Run your project's tests:
95
 
116
 

+ 9 - 0
wsgi/web.py 查看文件

1
+# coding=utf-8
2
+# Runner for uwsgi
3
+import os
4
+import pyramid.paster
5
+
6
+config_uri = os.environ['TRACIM_CONF_PATH']
7
+
8
+pyramid.paster.setup_logging(config_uri)
9
+application = pyramid.paster.get_app(config_uri)

+ 12 - 0
wsgi/webdav.py 查看文件

1
+# coding=utf-8
2
+# Runner for uwsgi
3
+from tracim.lib.webdav import WebdavAppFactory
4
+import os
5
+
6
+config_uri = os.environ['TRACIM_CONF_PATH']
7
+webdav_config_uri = os.environ['TRACIM_WEBDAV_CONF_PATH']
8
+app_factory = WebdavAppFactory(
9
+    tracim_config_file_path=config_uri,
10
+    webdav_config_file_path=webdav_config_uri,
11
+)
12
+application = app_factory.get_wsgi_app()