How to use secrets.yml for API_KEYS in Rails 4.1?

First rule: DO NOT CHECK-IN secrets.yml into the repo. All right, here’s how a secret.yml would look: development: secret_key_base: 6a1ada9d8e377c8fad5e530d6e0a1daa3d17e43ee… # Paste output of $ rake secret here for your dev machine. test: secret_key_base: _your_secret_ as above production: secret_key_base: <%= secure_token %> STRIPE_PUBLISHABLE_KEY: ‘Put your stripe keys for production’ STRIPE_SECRET_KEY: ‘Put actual keys for production … Read more

bundle install doesn’t work from capistrano

Just ran into the same issue. What worked for me was this: 1) Installing the capistrano-rvm gem and adding require ‘capistrano/rvm’ to the Capfile. 2) Adding my deployment user to the rvm group on the server: # usermod deploy -a -G rvm 3) Creating two directories in my deployment user’s home folder: .rvm and .rvm/bin … Read more

Capistrano 3 sudo task

The Capistrano 3 guide recommends the use of passwordless sudo. This allows your less-priveleged user execute the sudo command without having to enter a password via the PTY. You can use the task that Kentaro wrote above, and add something like the following to your /etc/sudoers file: deploy ALL=NOPASSWD:/bin/cp ~/something /something http://www.capistranorb.com/documentation/getting-started/authentication-and-authorisation/#toc_8

Passing parameters to Capistrano

Update: For Capistrano 3, see scieslak’s answer. As jarrad has said, capistrano-ash is a good basic set of helper modules to deploy other project types, though it’s not required as at the end of the day it’s just a scripting language and most tasks are done with the system commands and end up becoming almost … Read more

Starting delayed_job at startup

In combination with the capistrano restart recipe it’s quite convenient to use cron to also start the delayed_job daemon at startup using the special @reboot time in a crontab: @reboot /bin/bash -l -c ‘cd /path/to/app && RAILS_ENV=production script/delayed_job restart’ And it’s even more convenient together with whenever to configure a scheduled task: job_type :envcommand, ‘cd … Read more

Hot deploy on Heroku with no downtime

You could setup a second Heroku app which points to the same DB as your primary production app and use the secondary app to run your DB migrations without interrupting production (assuming the migrations don’t break the previous version of your app). Let’s call the Heroku apps PRODUCTION and STAGING. Your deploy sequence would become … Read more

How do I configure capistrano to use my rvm version of Ruby

You have two options: Enable .ssh environment variables using the PermitUserEnvironment option in your ssh configuration file Use the capistrano :default_environment setting For the second option, simply add the following line in your deploy.rb file set :default_environment, { ‘PATH’ => “/path/to/.rvm/ree-1.8.7-2009.10/bin:/path/to/.rvm/gems/ree/1.8.7/bin:/path/to/.rvm/bin:$PATH”, ‘RUBY_VERSION’ => ‘ruby 1.8.7’, ‘GEM_HOME’ => ‘/path/to/.rvm/gems/ree/1.8.7’, ‘GEM_PATH’ => ‘/path/to/.rvm/gems/ree/1.8.7’ } To get the … Read more

tech