How to deploy a Rails application from Github?

June 15, 2015 3k views
Git Deployment Ruby on Rails

I want to import my app from github to run on Digitalocean. I am currently running Ubuntu Ruby on Rails on 14.04 (Postgres, Nginx, Unicorn).

Step I took so far after setting up a new droplet...

  1. sudo apt-get update
  2. I installed git
  3. removed the folder "/home/rails" and everything inside
  4. cloned the app from Github to "/home/"
  5. renamed the cloned folder to "rails"
  6. I setup the locale environment
  7. configured postgresql user and password
  8. bundle install everything
  9. run "rails s"

run into the problem..

"A server is already running. Check /home/rails/tmp/pids/" after I tried "rails s"

Is this the correct way to do it? if not how exactly should I go about deploying my rails app from github?

2 Answers

ok i figured it out

  1. make sure to create /home/index.html as your first/index page and point your route there before you push to git
  2. install git apt-get install git
  3. ssh to your digitalocean domain
  4. navigate to cd /home/rails
  5. delete folder "rails"
  6. clone your rails repo from github git clone YOUR_REMOTE_ADDRESS
  7. rename the downloaded repo to rails mv OLD_FOLDER NEW_FOLDER
  8. setup your db rake db:drop db:create db:migrate
  9. run rails server like so rails s --binding=YOUR_IP_ADDRESS

I was running rails s for the past few days wondering why it is just showing the default "digitalocean rails page", it was because i kept running rails by using rails s ..duh

anyways, i hope this could help someone in the future.

Sorry I don't quite understand step 1. Can you explain more? create /home/index.html in app/view folder? how to point your route there?

  • In your rails app in route.rb replace this root 'home#index' instead of the original route that rails is using as the root route.

Have another answer? Share your knowledge.