-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Add require "capistrano-cook"
to your deploy.rb file.
Then set following variables:
-
:db_server
: Options are:mysql
,:postgresql
or:none
. By default it is set to:mysql
. This determines which database engine and configuration will be included indeploy:install
anddeploy:setup
tasks. -
:rails_server
: Options are:unicorn
and:none
. By default it is set to:unicorn
. This determines which Rails application server and configuration will be included indeploy:install
anddeploy:setup
tasks. -
:http_server
: Options are:nginx
and:none
. By default it is set to:nginx
. This determines which HTTP server and configuration will be included indeploy:install
anddeploy:setup
tasks. -
:ruby_installer
: Options are:rbenv
and:none
. By default it is set to:rbenv
. This determines which Ruby versioning system and configuration will be included indeploy:install
anddeploy:setup
tasks. -
:nodejs
: Set this totrue
if you want nodejs to be installed automatically.
For more configuration options, please read on.
All recipes look first for templates in folder config/deploy/templates/
in your project directory. If there are no templates, then the default templates are loaded. It is also possible to set different template filenames. It is described in the sections below how to do this.
There are two recipes for database engines: mysql
and postgrelsql
. To select either, add one of the following lines to deploy.rb
:
require "capistrano-cook/mysql"
# OR
require "capistrano-cook/postgresql"
Then set the following variables according to your need:
-
:db_host
: host of the database server. By default set to 'localhost'. -
:db_user
: database user for the application. By default set to application name. -
:db_password
: password for the database user. By default it will ask for password or generate it. You shouldn't change this due to security issues. -
:db_name
: name of the database. By default set to#{application_name}_#{environment}
(e.g.my_blog_production
). -
:db_generate_password
indicate if database password will be automatically generated, or it will ask user to give it. Automatic generation doesn't overwrite:db_password
if it is set. By default is set totrue
For MySQL you can also change:
-
:db_root_password
: password for the root MySQL user. By default it will ask for password. You shouldn't change this due to security issues. -
:db_generate_root_password
: set if it will ask for root password or generate a random one. By default is set tofalse
, that mean it will ask for password. -
:mysql_template
: ERB template for the YAML database configuration file.
For postgresql you can also change:
-
:postgresql_template
<- erb template for yml database configuration file.
For installing ruby there are two recipes available:
require "capistrano-cook/rbenv"
# OR
require "capistrano-cook/rvm"
It uses rbenv or rvm to download and install the Ruby environment.
For these recipes you can set following values in your deploy.rb
-file:
-
:ruby_version
: the full version of Ruby you want to use. By default it is set to1.9.3-p125
.
For rvm you can set the following values in your deploy.rb
-file:
-
:rvm_path
: path where rvm will be installed. Shouldn't be changed. -
:rvm_install_ruby_params
: additional params for installing ruby. -
:rvm_install_with_sudo
: indicate if rvm should usesudo
for installing ruby. By default it is set tofalse
-
:rvm_install_shell
: sets shell for which rvm should by installed. By default it is set to:bash
-
:rvm_install_ruby_threads
: number of threads used for installing the ruby. By default is set to number of available processors/cores.
If one of your gems can't be installed, try to load some fixes:
require "capistrano-cook/fix-gems"
If you want fixes to run automatically with deploy commands, you can set one or more of these variables to true
:
:fix_libv8
:fix_nokogiri
:fix_patron
The current version supports installation and configuration of the Nginx server.
You can add it to your deploy.rb
-file with the following line:
require "capistrano-cook/nginx"
For this recipe you can set the following variables in your deploy.rb file:
-
:nginx_template
: ERB template for generating a nginx configuration file. The default configuration template works with Unicorn.
The current version supports installation and configuration of the unicorn server.
You can add it to your deploy.rb
-file with the following line:
require "capistrano-cook/unicorn"
For this recipe you can set following variables in your deploy.rb
-file:
-
:unicorn_user
: the system user who run unicorn process. Defaults to user. -
:unicorn_pid
: path where the unicorn pid file will be put. Defaults tocurrent_path/tmp/pids/unicorn.pid
. -
:unicorn_config
: path where unicorn configuration file will be put. Defaults toshared_path/config/unicorn.rb
. -
:unicorn_log
: path where unicorn log file will be put. Defaults toshared_path/log/unicorn.log
. -
:unicorn_workers
: number of unicorn workers. Defaults to 2. -
:unicorn_timeout
: timeout in seconds for requests. Defaults to 30. -
:unicorn_template
: ERB template withunicorn.rb
configuration file. -
:unicorn_init_template
: ERB template withinit.d
shell script for unicorn. Monit server is installed together with unicorn. For monit you can set following variables in yourdeploy.rb
-file: -
:monit_mem_restart
: amount of memory... . Defaults to"120.0 MB"
. -
:monit_cpu_alert
: percentage of cpu ... . Defaults to"22%"
. -
:monit_cpu_restart
: percentage of cpu ... . Defaults to"25%"
.
For automatic installation of nodejs, add the following line to your deploy.rb
-file:
require "capistrano-cook/nodejs"
In case you require all capistrano-cook you can switch off nodejs installation by setting up install_nodejs
variable to false