Digital Ocean is a Platform as a Service (PaaS). It is designed to do one thing and to do it well - create instances of web servers for you to use. Once you're out working on a job, you'll be exposed to a variety of PaaS providers - Amazon's EC2, Heroku, AppHarbor, and of course, Digital Ocean. Today you're going to sign up for Digital Ocean, create a droplet (their word for a server), and write an app and put it out for the world to see! Because as cool as it is to show your classmates what you've been working on, wouldn't it be cooler to show your friends and prospective employers? Plus, this will give you a leg up when looking for a job: being able to say I can configure and setup a server is kind of a big deal.
Digital Ocean requires a credit card on file. General Assembly is providing free credits for our students so you should not need to worry about being billed; however, please be aware that if you run out of credits, your card will be billed.
A droplet is a scalable server offered by Digital Ocean. Digital Ocean supports a variety of Linux platforms to develop on (amongst others). A droplet can serve a small website that you use for your own portfolio and it can scale up to host an enterprise application! One of the best things about a droplet is that it can scale - if your site blows up, you can expand the resources it has without needing to create a new server!
We need to create a secure way for you to log into any Droplet that you create. We're going to use an private key that you already are using on your computer. You should only share private keys with entities you trust! I only share mine with my computers and the servers I run. I even have a copy of mine in my will! They're private!
Because we want to make sure that you and only you - not some hacker in Russia, not some script kiddie in China - has access to your droplet, we'll use a private key that we're already comfortable with to connect to the server.
Open up terminal and enter in the following commands:
ls -al ~/.ssh
- list all of the keys in the ./ssh directory. You should see an id_rsa.pub
. This is your public key.atom ~/.ssh/id_rsa.pub
- Open the key in atom so we can use it in just a moment.my-site
or myawesomesite.com
. The name is just used for reference.ssh root@0.0.0.0
apt-get update
apt-get install ruby
6.gem install bundler
, gem install pry
touch Gemfile config.ru app.rb
nano Gemfile
, ctrl-x to exit, S to save; repeat x3ssh root@[your.ip.address.here]
apt-get update
> y at promptapt-get install git
apt-get install ruby
gem install bundler
gem install pry
bundle
rackup config.ru --port 80 --host 0.0.0.0
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that gem install json -v '1.8.2'
succeeds before bundling.
root@coffee-shop:~/coffee-shop.ninja# gem install json -v '1.8.2'`
apt-get install build-essential
-- plox
apt-get install ruby-dev
rack
application and KEEP it running...nohup bundle exec rackup -p 80 --host 0.0.0.0
nohup
: Do not listen to the hup
signal when terminal is closedbundle exec
: Use the gem versions in the Gemfile.lock to execute the commandrackup -p 80
: Run the application on port 80&
: Run this command in the background
Nano