CanDIG / rnaget_service

Implementation of GA4GH rnaget API
GNU General Public License v3.0
1 stars 2 forks source link

No way to configure application if using WSGI #26

Open davidlougheed opened 5 years ago

davidlougheed commented 5 years ago

Most of the configuration / setup occurs in the main() function of app.py. If WSGI is used, there doesn't seem to be an easy way to initialize the database, set up logging, set up the db teardown, etc.

alipski commented 5 years ago

Yea currently you have to write your own wsgi entry point and pass in a config file, which isn't necessarily difficult but it does take some extra steps. I'll send over some examples of a uwsgi server config. Do you think it would be useful to ship with a run wsgi server option?

davidlougheed commented 5 years ago

Passing a config file might be fine. The use case here is for CHORD; I'm writing a script which automatically installs multiple microservices using pip and sets them up with uWSGI behind an NGINX proxy, all within a single Singularity container (a GenAP limitation). I'd like to ideally just be able to pass configuration as uWSGI options (i.e. arguments or env variables), but I could do a config file too -- I'd just need to expand my mini-orchestration script to be able to generate config files (which wouldn't take long at all). CHORD repo: https://github.com/davidlougheed/chord_server/ ; see the microservice configuration file here: https://github.com/davidlougheed/chord_server/blob/master/chord_services.json (relevant scripts are the 2 python scripts and the bash script in the repo)

alipski commented 5 years ago

Do you have an example configuration you are using for other uWSGI apps? Are you running uWSGI in emperor mode or does each app have it's own master? It might be that you have to pass in a predefined config file?

davidlougheed commented 5 years ago

I can pregenerate a config file using the python scripts I use to construct the container's file structure. I'm using uWSGI in emperor mode, and I only started the project on Friday so this is the first microservice I'm working with.

davidlougheed commented 5 years ago

(i do generate uwsgi ini files on the fly using the python scripts)