Skip to content

Instantly share code, notes, and snippets.

@skydan
Forked from teohm/capistrano3-rvmsudo.md
Created June 26, 2014 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skydan/d7b28885bbb05e326cc5 to your computer and use it in GitHub Desktop.
Save skydan/d7b28885bbb05e326cc5 to your computer and use it in GitHub Desktop.

1. Edit /etc/sudoers

https://rvm.io/integration/sudo

2. Custom execute command

# deploy.rb
  desc "Export Upstart script"
  task :export_upstart do
    on roles(:app) do
      execute [
        "cd #{release_path} &&",
        'export rvmsudo_secure_path=0 && ',
        "#{fetch(:rvm_path)}/bin/rvm #{fetch(:rvm_ruby_version)} do",
        'rvmsudo',
        'bundle exec foreman export -a glkickstart -u ubuntu -p 8787 upstart /etc/init'
      ].join(' ')
    end
  end
  after 'deploy:updated', 'deploy:export_upstart'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment