By JTronLabs
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 https://gist.github.com/erichurst/961978
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!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.