Shelly Cloud: Deploy a Rails App in Less Than 5 Minutes

2 weeks gone, 1 app ready for production. What now? It’s time to deploy the app on a server. But you’re a developer, you can’t be expected to know everything about managing a VPS for a Rails app. Shelly Cloud is here to help. Shelly Cloud is a hosted developer platform for deploying Ruby or Ruby on Rails apps. If you’ve used Heroku before, it’s the same concept; just git push and you have a deployed app.

This concept is called Platform as a Service (a.k.a PaaS). In contrast to Virtual Private Server (VPS) hosting, PaaS configures the hardware and a deployment platform for you, whereas you must configure your own with a VPS. With a VPS, you must scale the application yourself. But with PaaS, this scaling is done for you as your traffic grows.

Shelly Cloud is a PaaS that does a lot for you; git-based deployment and various forms of scaling are the main ones. Shelly also includes various services (like databases) that are setup for you automatically. Sound awesome? Let’s deploy an app to Shelly Cloud.

As with any service, you’ll need an account. Shelly Cloud is not free, so check out their pricing and get signed up if you want to follow along

First we need something to deploy. Let’s create a simple little app. I won’t do much explanation of the code, as I can assume that you know basic Rails development if you’re reading this.

A new remote was added to your git repository, shelly, that we’ll push to in a moment. You’ll also notice a nice Cloudfile in your application root now. This is a purely Shelly Cloud configuration file so that the PaaS knows what to do with the application that you pushed. I added some comments to explain what each option does.

shelly-books: # our app name
ruby_version: 2.2.2
environment: production # RAILS_ENV
domains: # a list of all the domains that you might be using
- shelly-books.shellyapp.com
# for example:
# - something.here.com
# then point CNAME to shelly-books.shellyapp.com
servers: # you can make as many servers as you want
app1: # our server name
size: small # size of this server
puma: 2 # minimum number of threads
# other things you want on the server
# delayed_job: 1
# sidekiq: 1
# clockwork: on
# whenever: on
# elasticsearch: on
databases: # DBs to set up
- postgresql
# - mysql
# - mongodb
# - redis

You might be wondering if the migration needs to be manually run, and the answer is “no”. This article explains how code is deployed on Shelly Cloud, including when rake db:migrate runs. The answer is, on every push, the migration is run on the first deployment server.

Now let’s view our app again, but this time at the /books route.

Feel free to play around with this to test the database functionality. It works great.

There you have it! A database-driven app deployed to Shelly Cloud in less than 5 minutes.

Extra: Custom Domain

To add a custom domain, simple append your domain to the domains list in your Cloudfile. Then point your domain’s CNAME record to your myappname.shellyapp.com domain.

Conclusion

From my experience writing this article, I would definitely recommend Shelly Cloud as a hosting provider; but there are plenty of options. Heroku is another PaaS option that provides languages other than Ruby — or maybe you want to set up your own VPS. No matter what hosting provider you use, the end goal is the same: easy deployment with reliable hosting. Shelly Cloud provides just that.