live and let live
Wednesday, 18 May 2016
Chef WSGI Cookbooks
This is a set of cookbooks for configuring a server to deploy and run an arbitrary WSGI application. Most of the cookbooks come from the main Opscode repository or are inspired by such.
This set of cookbooks was originally collected and developed to test out the use of Vagrant to easily deploy Flask applications to a standard environment. It assumes the following things:
You're developing a standard WSGI application
You want to use uWSGI to run your application
You want to use nginx as a proxy to uWSGI
In addition to the standard Chef deploy resource this setup does the following:
Creates a folder named etc within the shared folder for holding configuration files. Specifically the applicatin's uWSGI configuration.
Creates a folder named logs within the shared folder for holding the nginx and uWSGI logs.
Creates a folder named run to hold the uWSGI socket file.
Installs dependencies into a virtualenv if a file named requirements.txt exists in your application's root folder.
Using with Vagrant
You can quickly deploy your WSGI application to a local, virtual Ubuntu server by setting up a quick recipe for your application. For instance, you would create the following file relative to your project:
If necessary, modify the values for repository, wsgi_file, and callable to match that of your project.
Then edit your Vagrantfile to look like the following: