diff --git a/README.md b/README.md index 4cbdf62..d247b6b 100644 --- a/README.md +++ b/README.md @@ -73,23 +73,44 @@ Initialize the database using [tracimcli](doc/cli.md) tool tracimcli db init -### Run Tracim_backend ### +create wsgidav configuration file for webdav: -Run your project: + cp wsgidav.conf.sample wsgidav.conf - pserve development.ini +## Run Tracim_backend ## -### Configure and Run Webdav Server (Unstable) ### +### With Uwsgi ### -create wsgidav configuration file : +Run all services with uwsgi - cp wsgidav.conf.sample wsgidav.conf + # install uwsgi with pip ( unneeded if you already have uwsgi with python3 plugin enabled) + sudo pip3 install uwsgi + # set tracim_conf_file path + export TRACIM_CONF_PATH="$(pwd)/development.ini" + export TRACIM_WEBDAV_CONF_PATH="$(pwd)/wsgidav.conf" + # pyramid webserver + uwsgi -d /tmp/tracim_web.log --http-socket :6543 --wsgi-file wsgi/web.py -H env --pidfile /tmp/tracim_web.pid + # webdav wsgidav server + uwsgi -d /tmp/tracim_webdav.log --http-socket :3030 --wsgi-file wsgi/webdav.py -H env --pidfile /tmp/tracim_webdav.pid + +to stop them: + + # pyramid webserver + uwsgi --stop /tmp/tracim_web.pid + # webdav wsgidav server + uwsgi --stop /tmp/tracim_webdav.pid + +### With Waitress (legacy way, usefull for debug) ### + +run tracim_backend web api: + + pserve developement.ini run wsgidav server: tracimcli webdav start -### Run Tests and others checks ### +## Run Tests and others checks ## Run your project's tests: diff --git a/wsgi/web.py b/wsgi/web.py new file mode 100644 index 0000000..34f45a6 --- /dev/null +++ b/wsgi/web.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# Runner for uwsgi +import os +import pyramid.paster + +config_uri = os.environ['TRACIM_CONF_PATH'] + +pyramid.paster.setup_logging(config_uri) +application = pyramid.paster.get_app(config_uri) diff --git a/wsgi/webdav.py b/wsgi/webdav.py new file mode 100644 index 0000000..5dd2d1b --- /dev/null +++ b/wsgi/webdav.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# Runner for uwsgi +from tracim.lib.webdav import WebdavAppFactory +import os + +config_uri = os.environ['TRACIM_CONF_PATH'] +webdav_config_uri = os.environ['TRACIM_WEBDAV_CONF_PATH'] +app_factory = WebdavAppFactory( + tracim_config_file_path=config_uri, + webdav_config_file_path=webdav_config_uri, +) +application = app_factory.get_wsgi_app()