UNMAINTAINED NOTICE
We stopped using capistrano to deploy our applicacions, so this project is not longer maintained.
Negroku is an opinionated collection of recipes for capistrano.
The goal is to be able to deploy ruby applications without the hassle of configure and define all the stuff involved in an application deployment.
Installation
Install negroku as a global gem.
$ gem install negroku --pre
Add the negroku gem to your Gemfile
development group to lock the version your are going to use.
group :development do
gem 'negroku', '~> 2.0.0.pre3'
end
Then run
$ bundle install
Prepare your application
-
Create your app executing the following command, and just follow the on-screen questions.
Before you begin, if you're using Negroku 1.X, rename the following files with .old or .bak extension.
- your_app/Capfile
- your_app/config/deploy.rb
- your_app/config/deploy/production.rb (and any other environment)
$ negroku app create
-
Give your application a name
This will be used to create the app folder structure in the server.
-
Please choose your repository url
You'll need to choose the git respository where your are going deploy your project from. Typically a GitHub repository.
If you have already initializated your git repository for the project, you'll be offered to choose the remotes of the current repo.
The
app create
command will bootpstrap your app (behind the scenes it will run thecap install
command and add some customizations)Some files and folders will be added to your project. ```ruby project_root |--- Capfile # Capistrano load file +--- config |--- deploy.rb # Global setting for all environments ```
-
Add a new stage for your deployment.
$negroku stage add
-
Stage Name
This will be used to create de stage configuration files
-
Select the branch to use
Here you'll be presented with your remote branches (git branch -r) so you can choose which one you want to deploy the stage you are creating.
-
Type the domains to use
You can pass comma separated domains you want to use in the application
-
Type the server ur to deploy to
Set the server where you are going to deploy this stage
-
Do you want to add rbenv-vars to the server now?
If you choose 'y'es you wil able to create a
.rbenv-vars
file in the server with the KEYS and VALUES you choose from your local.rbenv-vars
The
stage add
command will create the stage configuration file and run therbenv:vars:add
capistrano task if you chosen to add environmental variables to the applicatinproject_root +--- config +--- deploy +--- production.rb # Specific settings for production server
-
-
In the
Capfile
you can enable and disabled the tasks you need in your application. You only have to comment out the stuff you don't need.# Node require 'capistrano/nodenv' # require 'capistrano/bower' # App server require 'capistrano3/unicorn' # require 'capistrano/puma' # Static server require 'capistrano/nginx'
-
Configure your specific settings in the files created above
-
Common settings for all stages
deploy.rb
Here you can add all the settings that are common to all the stage severs. For example:
set :unicorn_workers, 1 set :unicorn_workers_timeout, 30
-
Per-stage settings
staging.rb
production.rb
Here you can add all the settings that are specific to the stage. For example:
set :branch, "production" # Optional, defaults to master set :rails_env, "production"
-
-
Commit and push the changes to the repository
Deploy you application
To deploy your application you just need to run capistrano task to do so.
$ cap staging deploy # to deploy to the staging stage
Supports
Web server
- nginx
App servers
- puma
- unicorn
Tools
- bower
- bundler
- delayed jobs
- eye process monitoring
- thinking sphinx
- Whenever
Other features
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
Thank you contributors!
negroku is maintained by platanus.
License
Guides is © 2014 platanus, spa. It is free software and may be redistributed under the terms specified in the LICENSE file.