ensuring availability of REST service implemented in Sinatra

3 views
Skip to first unread message

lsiden

unread,
Oct 30, 2009, 10:51:19 AM10/30/09
to Detroit.rb
I am thinking about implementing a REST-ful interface with Sinatra for
my business client. When selecting a web host (shared hosting - at
least initially), what are the minimal requirements I will need from
the hosting provider.

I tried a little Sinatra REST demo out on my own site hosted on
a2hosting.com and got it to work fine (after a bit of help from you
folks with loading gems), but am concerned by the need to ssh info my
account on the host and run "ruby ...". How do I keep the service up
and running if ruby crashes other than having to log on each time and
type "ruby mywebapp.rb" on the command line to restart it? (Of
course, I could run ruby from a bash script that catches exceptions
and restart it, but I'm hoping there's a best practice that's
supported or recommended by the "community".) I have a hunch that
Rack and/or Camping may have solutions for restarting a failed
service, but then what do I need to ask the host provider to make sure
it's supported?

My client wants to use DreamHost. DH supports Ruby on Rails. Is that
all that's needed to accomplish this cleanly?

lsiden

unread,
Oct 30, 2009, 11:22:40 AM10/30/09
to Detroit.rb
I just found this: http://www.bluehostforum.com/showthread.php?t=16486.

Is that a solution? I also took a look at shotgun, but that appears
to be more a development convenience to reload the source code if it
changes, not necessarily to restart a failed app.

Daniel Parker

unread,
Oct 30, 2009, 11:50:48 AM10/30/09
to rubyd...@googlegroups.com
I've been using Linode.com for a while now, and really like it. It's just a VPS, so you'll have to install your own Ubuntu.

As for Dreamhost, you can do Sinatra through Passenger, because Sinatra is a rack app. See http://www.marc-seeger.de/2008/11/15/deploying-rack-apps-eg-sinatra-on-dreamhost

Heroku is another option that is really optimized for running Ruby / Rack apps, if their pricing is okay with you (http://heroku.com/pricing). It'd probably be nice at least for a free staging option, and then the task of setting up a production server elsewhere can be done separate from development.

As another option similar to Sinatra, I might remind you of Cilantro (which is admittedly in development) -- I am planning to get that running really easily as a simple Rack app as well, and running on Passenger should be really cool because of its really fast load time. (It's based on Sinatra, so a simple Sinatra app should load just as quickly -- if rubygems is sandboxed to only use gems installed in the app.) Hopefully that'll be working by Tuesday of next week. I'll be testing it on Heroku.com as well, so if you have a free account there you could have any Rack application (Sinatra, Cilantro, etc) up and running under a minute once you know what you're doing, and their docs are very easy to follow if you haven't done it before.

When it comes to Cilantro, I would recommend it for anyone thinking of using Sinatra. At the very least it makes views, routing, process management, and gem management a bit easier. Tuesday I'm planning to present it for the Grand Rapids ruby group, maybe I can get someone to video-record it for you.

- daniel parker -

"You have granted me life and steadfast love, and your care has preserved my spirit." Job 10:12
"The LORD is my chosen portion and my cup . . . indeed, I have a beautiful inheritance." Psalm 16:5-6
"Give what you can ... take nothing back!"

Larry Siden

unread,
Oct 30, 2009, 2:01:31 PM10/30/09
to rubyd...@googlegroups.com
The app I have in mind for Sinatra is much more bare-bones REST server (GET, POST, PUT, ...).  I plan on doing a financial calculator with SproutCore which does all the MVC stuff on the client side and uses the server only for transactions and persistence.  (In my app, the only "transaction" is authentication and granting access to a user's stored data from a previous session.)

The rest of the site involves some pretty low-turnover static content that I think can be easily handled by Wordpress.

That would be great to see a video of your Cilantro talk next week.  Keep me posted, and thanks for the useful link on Rack apps and Dreamhost.  Heroku looks like a good alternative for the REST-ful back end data server.

Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
Reply all
Reply to author
Forward
0 new messages