Difficulty getting Rails working on Ubuntu 14.04

Posted April 23, 2015 1.9k views
Ruby on RailsGitDigitalOcean 1-Click Apps MarketplaceLinux Commands

I have a rails application that works fine on my local machine when I run

rails server

However I am having trouble getting it working on DO. The exact commands I have run are as follow

#create droplet with ubuntu and 1-click rails application
#open up server's console via ssh or online console

rm -rf /home/rails/*
apt-get install git
cd /home/rails
git init
git remote add origin MY_GIT_REPO
git pull origin master
#must add swapfile for bundle install to work
fallocate -l 512M /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
#make swapfile permanent
nano /etc/fstab # add this line to bottom of file --> /swapfile   none    swap    sw   0   0
#back to the rails stuff
bundle install
#switch from sqlite to mysql2, eventually (note I have not done this yet)
#need to add mysql2 to gemfile and edit config/database.yml using
bundle exec rake db:create db:schema:load db:seed
nano config/environments/production.rb # Set `config.assets.compile = true`
chown -R rails:www-data *
service unicorn restart
exec bundle rails s -d

After I run this it appears my IP is up and running (there’s no error shown), but my index page is not shown. Thanks for the help!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


What size droplet are you using? Have you tried a larger one if swap is required? In many cases, swap isn’t an appropriate fix for actual memory. This is especially true since DigitalOcean uses SSD which can cause swap to not be as effective.

While you have no errors on running, have you checked for any errors with the system log? This can be found with the ‘dmesg’ command.

I wouldn’t be surprised if the issue was memory, especially if you were using a smaller droplet. Perhaps it would bundle ok, but the app may not run with the swap.

You may also wish to review this article on debugging a ruby application. Considering setting up a logger or something to help provide more verbose feedback while the app is running.