My Recipe For Sinatra/Thin/Rack/Webfaction

Wednesday 03 June 2009 2 comments

The solution I am using for deploying a Sinatra app that runs on Thin and Rack on Webfaction, without Capistrano or Git, just using Rsync and Rake.

  1. Create the application:

    myapp
    config
       config.ru
       config.yml
       db
           migrate
               rake migration files
           myapp.sqlite3.db
    myapp.rb
    lib
    models
    public
       stylesheets
       images
       javascripts
    Rakefile
    tmp/
    views
       layout.erb
       myview.erb
  2. In the Wefaction Control Panel, create a custom application listening on port, get the port number, needed for config files. Create a domain. Create a website that links a domain to the application. Do a custom Ruby install. Install any necessary gems (eg Thin, Rack, ActiveRecord, whatever).
  3. Set up the config files and a Rakefile:

    config.ru

    config.yml

    Rakefile

  4. To deploy the site, rake deploy.

Comments

2 Comments Subscribe via RSS

  • Avatar

    Marc Köhlbrugge Monday, May 17, 2010, 07:09 PM

    Thanks for sharing, I think I almost got it to work. The only thing is the server doesn't start, and I think that's because the Rake file doesn't include any start task. Any idea what that task should look like?

    Thanks!

    PS
    I realize this is a old post, but I guess the method of running Sinatra apps on Webfaction is still the same.

  • Avatar

    Gordon Isnor Monday, May 17, 2010, 07:56 PM

    Yeah, that’s odd, thanks for pointing it out Marc. I should edit my GitHub Gist. This is the start task I am using:

    desc "Start The Application"
    task :start do
    puts "Restarting The Application..."
    system("thin -s 1 -C config/config.yml -R config/config.ru start")
    end