Browse Source

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

Damien Accorsi 6 years ago
parent
commit
74c1813eec
No account linked to committer's email
3 changed files with 49 additions and 7 deletions
  1. 28 7
      README.md
  2. 9 0
      wsgi/web.py
  3. 12 0
      wsgi/webdav.py

+ 28 - 7
README.md View File

@@ -73,23 +73,44 @@ Initialize the database using [tracimcli](doc/cli.md) tool
73 73
 
74 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 109
 run wsgidav server:
89 110
 
90 111
     tracimcli webdav start
91 112
 
92
-### Run Tests and others checks ###
113
+## Run Tests and others checks ##
93 114
 
94 115
 Run your project's tests:
95 116
 

+ 9 - 0
wsgi/web.py View File

@@ -0,0 +1,9 @@
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 View File

@@ -0,0 +1,12 @@
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()