Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

No way to configure application if using WSGI #26

Open
davidlougheed opened this issue Jul 8, 2019 · 5 comments
Open

No way to configure application if using WSGI #26

davidlougheed opened this issue Jul 8, 2019 · 5 comments

Comments

@davidlougheed
Copy link
Contributor

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
Copy link
Contributor

alipski commented Jul 8, 2019

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
Copy link
Contributor Author

davidlougheed commented Jul 8, 2019

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
Copy link
Contributor

alipski commented Jul 8, 2019

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants