Saturday, 7 March 2009

Deploying Sinatra on Joyent’s Shared Accelerators with Thin

On Thursday afternoon, I had an idea for just about the smallest web app I could think of (since then, I’ve even cut out a couple features). It didn’t make sense to use all of Ruby on Rails for this considering how tiny it was.

Seemed like a great opportunity to try out Sinatra1

  1. Write the app
  2. Vendor Sinatra and Rack (that’s just good practice)
  3. Submit a ticket requesting a port
  4. Add a config.ru file to your app’s directory (for Rack) containing the following

    # PATH TO VENDOR-ED RACK AND SINATRA
    require 'vendor/rack-[VERSION]/lib/rack'
    require 'vendor/sinatra-[VERSION]/lib/sinatra'
    Sinatra::Application.set(
    :run => false,
    :environment => :production
    )
    require 'app'
    run Sinatra::Application
  5. Add a config.yml file to your app’s directory for Thin containing the following

    ---
    environment: production
    chdir: /path/to/app
    address: 127.0.0.1
    user: [USERNAME]
    port: [PORT]
    pid: /path/to/domain/tmp/thin.pid
    rackup: /path/to/app/config.ru
    log: /path/to/domain/logs/thin.log
    max_conns: 1024
    timeout: 30
    max_persistent_conns: 512
    daemonize: true
  6. Follow the Setting up and Configuring Lighttpd instructions on the Joyent Wiki (See update below)
  7. Add another Bootup Action for Thin
    Startup thin -s 1 -C /path/to/config.yml -R /path/to/config.ru start
    Shutdown thin -s 1 -C /path/to/config.yml -R /path/to/config.ru stop
  8. Follow the Proxying to a Port instructions on the Joyent Wiki
  9. 1. If the time I spent building this app was a cocktail, it’d be 1 part programming, 2 parts design, 3 parts deployment. That’s a huge part of why I wrote this post.

UPDATE: March 8, 2009
My gut says Lighttpd + Thin is redundant, so I’ve turned Lighttpd off.

Tuesday, 8 April 2008

Free & Open Is Its Own Lock-in

A decade ago, one of the very first places I found that offering free websites gave everyone access to the same images directory. You could upload your own images, but then everyone else could use them as well.

Goofy, questionable, but free.

I’ve been hosting with Joyent for more than 3 years, purchased 3 different ‘lifetime’ accounts from them. I’ve played around with a hundred website ideas on those accounts, comfortable knowing I can do whatever I need to explore an idea.

Whatever the app; Rails, PHP, MySQL, Facebook, some other crazy technology sounds cool, I know Joyent’s servers are up for it.

At this point, a year after my last ‘lifetime’ purchase, I consider those accounts ‘free’.
Free, as in: I’ve got a crazy idea and some server space, let’s see if this thing has legs.

I suspect Joyent considers them free as well.
Free, as in: Here’s the pricing on our Accelerators when you figure out your idea has legs.
Not free as in: Sharecropping.

“If you’re developing software for the Windows platform, yes. Or for the Apple platform, or the Oracle platform, or the SAP platform, or, well, any platform that is owned and operated by a company. They own the ground you’re building on, and if they decide they don’t like you, or they can do something better with the ground, you’re toast. ” – Tim Bray, 2003

“Perhaps Google is thinking about acquisitions. How much would it be worth to buy companies without having to transition their technology to their platform?” – Dave Winer

“Try to leave App Engine. Or AWS. When you move can you install Bigtable? S3?” – David Young

From its very first iteration, Cullect.com was running on one of my ‘free’ servers. Late last year, I moved it to another, bigger, ‘free’ server. A couple months ago, ‘free’ didn’t cut it any more. The idea had legs and needed room to run. I opened my wallet and and purchased a 1GiB Accelerator.

While I briefly considered moving the app to a different host, I realized Joyent has me locked-in.

Not locked into their platform, but locked into their attitude. Locked into their community, and locked in because I know I can experiment for ‘free’ and when those experiments work, they sold another Accelerator.

Sunday, 9 March 2008

Cullect.com – Moving Servers

Cullect was fast out-growing the Lifetime M Accelerator it started out on last summer, so this weekend I moved it to a bigger, 1GB Accelerator. As I write this, the database is migrating. After that, Cullect will be faster and have room to grow.

As part of this, I’ve started a proper blog for Cullect where I’ll be posts status updates, in-depth pieces on the decisions behind Cullect, and general bloggy stuff.

Wednesday, 31 October 2007

Data Mine

Yesterday, I was listening to Bruce Schneier’s talk at DefCon 15. As always, fantastic. While some of it was familiar, one new bit I picked up from him is the legal ramifications of not owning the data we create. We don’t know when it’s being used for secondary purposes.

“And the 4th Amendment doesn’t work to protect our privacy (secure our person and papers) when our papers are not in our desks, they’re in our SMS messages, ISPs and Google, etc.” – Bruce Schneier

Ouch. I’m not sure lack of Constitutional protection is mentioned in ‘I agree to the terms and conditions’. Puts a whole different price tag on ‘free’ services.

It also helps me better grok the Vendor Relationship Managment project Doc Searls is heading. If individuals control their data – the chances of massive data breaches1 seem less likely, as do the Facebooks. Plus, individuals start to have some idea of the market value of their information. Hint – it’s greater than zero.

Elsewhere:

“How much of my data are you letting me control today? That’s pretty much all that matters to anyone, imho. – Dave Winer”

“I don’t deal with applications, I deal with data” – John Gruber, Daring Fireball

“Braininess is open data standards and protocols, not free APIs that trap data and developers in the holding pens of big companies. Sorry, did that in the 1990s.” – David Young, Joyent

P.S. For those of you playing along at home: BINGO!

1. Techdirt does a great job of tracking this issue.

Wednesday, 20 June 2007

How to SFTP into a Virtual Server on Your Joyent Accelerator

I’m finally getting around to setting up my Joyent Accelerator.

As I read through the ‘Getting Started with Joyent Accelerator’ wiki, things were going smoothly.

Updating the nameserver at my registrar was unexpectedly fast and easy, as was signing into webmin, setting up a virtual server, a subversion repo, and a couple users.

Now, which of the half dozen name/pass combos do I use for SFTP?
Answer: The admin of the virtual server.

How to find these credentials:

  1. Select ‘Edit Virtual Server’
  2. Expand ‘Configurable Settings’
  3. Click ‘Show…’

Now SFTP in, and everything should look as expected.

Wednesday, 30 May 2007

Google Gears and Joyent Slingshot – Take the Web Offline

My biggest issue with browser-based apps is their complete uselessness when I’m without internet access (or low bandwidth situations). Still happens quite frequently.

I knew that situation wouldn’t last long, but of all the potential outcomes, I didn’t expect this one: Joyent Slingshot and Google Gears turn browser-based apps into offline desktop apps.

Crazy.