Capistrano::Uwsgi
This gem provides two capistrano tasks:
-
uwsgi:setup- creates/etc/uwsgi/apps-enabled/#{application}-#{stage}.ini -
uwsgi:restart- touchesuwsgi_ini(see below)
And uWSGI configuration file generator, that will create local copy of default uWSGI config for customization.
Installation
Add this line to your application's Gemfile:
gem 'capistrano-uwsgi'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-uwsgi
Usage
Add this to your config/deploy.rb file:
require 'capistrano/uwsgi/tasks'
Make sure, following variables are defined in your config/deploy.rb:
-
application- application name -
stage- the stage (usually fromcapistrano/ext/multistage) -
user- remote user name -
group- remote group name -
rack_env- RACK_ENV used to run the app -
deploy_to- deployment path -
uwsgi_mode- can be either:standaloneor:emperor -
app_port- application port (required by the:standalonemode) -
rvm_path- set this var to enable rvm usage inside uWSGI (optional) -
uwsgi_ini- the path of the compiled uwsgi.ini config file (optional, defaults to:/etc/uwsgi/apps-enabled/#{application}-#{stage}.ini)
Launch new tasks:
$ cap uwsgi:setup
$ cap uwsgi:restart
Or you can add hook to call this tasks after deploy:setup. Add to your config/deploy.rb:
after 'deploy:setup', 'uwsgi:setup', 'uwsgi:restart'
If you want to customize uWSGI configuration, just generate local uWSGI config before running uwsgi:setup:
$ rails generate capistrano:uwsgi:config
And then edit file config/uwsgi.ini.erb as you like.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Credits
Original project structure and README from Ivan Tkalin's capistrano-nginx.