Skip to content

a capistrano recipe to deploy python apps with virtualenv.

License

Notifications You must be signed in to change notification settings

jirafe/capistrano-virtualenv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capistrano-virtualenv

a capistrano recipe to deploy python apps with virtualenv.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-virtualenv'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-virtualenv

Usage

This recipe will create 2 kind of virtualenv during deploy task.

  • shared virtualenv
    • created in shared_path after deploy:setup
    • common libraries are installed here.
  • release virtualenv
    • created in release_path after deploy:finalize_update
    • per-release virtualenv that can be rolled back.

To deploy your application with virtualenv, add following in you config/deploy.rb.

# in "config/deploy.rb"
require 'capistrano-virtualenv'

Following options are available to manage your virtualenv.

  • :virtualenv_bootstrap_python - the python executable which will be used to craete virtualenv. by default "python".
  • :virtualenv_current_path - virtualenv path under :current_path.
  • :virtualenv_current_python - python path under :virtualenv_current_path.
  • :virtualenv_easy_install_options - options for easy_install. by defaul "--quiet".
  • :virtualenv_install_packages - apt packages dependencies for python.
  • :virtualenv_pip_options - options for pip. by default "--quiet".
  • :virtualenv_pip_install_options - options for pip install.
  • :virtualenv_release_path - virtualenv path under :release_path.
  • :virtualenv_release_python - python path under :virtualenv_release_path.
  • :virtualenv_requirements - the list of pip packages should be installed to virtualenv.
  • :virtualenv_requirements_file - the path to the file that describes library dependencies. by default "requirements.txt".
  • :virtualenv_script_url - the download URL of virtualenv.py.
  • :virtualenv_shared_path - virtualenv path under :shared_path.
  • :virtualenv_shared_python - python path under :virtualenv_shared_path
  • :virtualenv_use_system - controls whether virtualenv should be use system packages or not. false by default.

Examples

Upgrading base Python version

To upgrade base Python version of virtualenv, you must once remove existing shared virtualenv. Since the shared virtualenv is not referenced from release virtualenv after the creation, you can safely remove the shared virtualenv before and after the deployments.

$ cap virtualenv:destroy_shared # remove existing shared virtualenv
$ cap virtualenv:setup          # create virtualenv with new Python version
$ cap deploy

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Author

License

MIT

About

a capistrano recipe to deploy python apps with virtualenv.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 99.0%
  • Other 1.0%