https://github.com/editd/ansible-uwsgi_app
An ansible role to run (via supervisor and nginx) a uwsgi app
https://github.com/editd/ansible-uwsgi_app
Last synced: 7 months ago
JSON representation
An ansible role to run (via supervisor and nginx) a uwsgi app
- Host: GitHub
- URL: https://github.com/editd/ansible-uwsgi_app
- Owner: EDITD
- License: mit
- Created: 2014-09-16T17:00:54.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-07-12T13:01:56.000Z (about 10 years ago)
- Last Synced: 2025-05-07T10:44:20.166Z (over 1 year ago)
- Size: 9.77 KB
- Stars: 0
- Watchers: 39
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ansible-uwsgi_app
An ansible role to run (via supervisor and nginx) a uwsgi app.
## But why?
Often there is a repository that sets up python uwsgi apps. However, in order to run the api reliably, we need
* a way to control it and keep it running (supervisor)
* a webserver so that things don't directly access it
To (hopefully!) simplify the app code, this role will simply take a uwsgi app and set up everything needed to run it.
## An example
Imagine a we have a file `/opt/app/my_app.py` that has a [flask](http://flask.pocoo.org) `app`.
I've set this up so that `app_bin_dir` should be your virtualenv bin directory.
If you aren't using virtualenv, I suppose you could use `/usr/local/bin` (or wherever your `python` and `pip` commands are).
```yaml
- role: EDITD.uwsgi_api
app_name: my_app
app_bin_dir: location-of-virtualenv/bin
app_port: 5000
app_callable: "my_app:app"
app_num_processes: 4
app_user: user-to-run-as
app_directory: /opt/app
app_env_vars: {"PRODUCTION_MODE": "true"}
max_body_size: 1024m # sets the maximum size of data that can be posted to the nginx server
restart_app: yes # optional, ungracefully restarts the app's supervisor task after installing it
uwsgi_version: 2.0.12 # optional, specify the exact version of uwsgi to be installed
```
If needed, `app_uwsgi_params` can be specified to pass extra params to uwsgi.
e.g.
```yaml
app_uwsgi_params: '--close-on-exec'
```