Skip to content

Instantly share code, notes, and snippets.

@dfang
Last active March 1, 2018 21:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dfang/4334056 to your computer and use it in GitHub Desktop.
Save dfang/4334056 to your computer and use it in GitHub Desktop.
very very very basic guide for deploy rails application to local application
# assumptions: virtualbox, vagrant already installed
# and there is a box lucid32
1. rails new appdmeo , gem capistrano , then bundle
2. vagrant init lucid32
3. capify .
# !important
# vagrant ssh-config >> ~/.ssh/config
# vagrant ssh-config | grep IdentityFile | awk '{print $2}' that's where private key located
# then change the file's(~/.ssh/config) first line "host localhost" to "host vagrant"
# then modify deploy.rb:
set :application, "capdemo"
set :scm, :none
set :repository, "."
set :local_repository, "."
server 'vagrant', :web, :app, :db
set :user, "vagrant"
set :use_sudo, false
set :deploy_to, "/home/#{user}/apps"
set :deploy_via, :copy
set :copy_exclude, "log/*"
4. cap deploy:setup
5. ssh to your vagrant box , you'll find the deployed app location in /home/vagrant/apps
ssh vagrant or vagrant ssh , both are ok now , because in ~/.ssh/confg there is a config file we copyed from vagrant ssh-config