Skip to content

Instantly share code, notes, and snippets.

@ideaoforder
Last active November 2, 2016 17:43
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 ideaoforder/5f6db3a05c2972799f6cb848216aceae to your computer and use it in GitHub Desktop.
Save ideaoforder/5f6db3a05c2972799f6cb848216aceae to your computer and use it in GitHub Desktop.
Ubuntu Rails Server Setup

Basic Server Setup

https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04

UPDATED: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04

NOTE: The default firewall setup uses ufw, so we'll need OpenSSH, HTTP, HTTPS, 6379 (redis), and possibly something for our MySQL connection): https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands

Rbenv/Rails setup

https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-14-04

NOTE: There's a bug with bundler 1.12.0 Downgrading to 1.11.2[https://rubygems.org/gems/bundler/versions/1.11.2] solved this for us. It's already been updated, so the issue may have been resolved.

It's also helpful to do gem install unicorn since we're setting the box up to use it, we're creating an init file. https://gist.github.com/ideaoforder/411c1a359dd9dcdbbdf9831a26cd955b

sudo update-rc.d unicorn defaults

A few Rackspace/Server caveats

Rackspace's default iptables setup is overly aggressive, so we'll tune it by installing iptables-persistent https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-iptables-on-ubuntu-14-04

sudo apt-get install iptables-persistent
sudo invoke-rc.d iptables-persistent save

This will create two files /etc/iptables/rules.ipv4 and /etc/iptables/rules.ipv6.

These can both be replaced with this: https://gist.github.com/ideaoforder/6b802483873b4f12827ea378aca67551

We also want to be sure to copy whiplashmerch.com.crt, whiplashmerch.com.key, and whiplashmerch.com.pem to the server. Set the PEM file's permissions:

chown root:root /etc/ssl/certs/whiplashmerch.com.pem
chmod 700 /etc/ssl/certs/whiplashmerch.com.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment