Deploying web applications from Orion to Heroku

So you’ve written a shiny new web application with Orion, and you’re ready to deploy it. You can use old-school methods like exporting your application from Orion as a zip, or SFTPing your app to a remote web server. Another option is to deploy your application to the Heroku cloud platform directly from Orion. Here’s how:

1) In the Orion navigator, create a Heroku configuration file, “config.ru”. Unfortunately to edit a Ruby file in Orion you need a Ruby editor plugin. Luckily the example app I’m deploying here is a simple Orion Ruby plugin, so we’ll circle back to this problem at the end. My application is a simple static site, so I’m using the Rack::Static class as follows:

use Rack::Static, 
  :urls => ["/rubyEditor.html", "/plugin.js", 
            "/rubyGrammar.js", "/rubyContentAssist.js"],
  :root => "public"
  
run lambda { |env|
  [
    200, 
    {
      'Content-Type'  => 'text/html', 
      'Cache-Control' => 'public, max-age=86400' 
    },
    File.open('public/index.html', File::RDONLY)
  ]
}

This basically lists the files in my site, and specifies the root directory they should be served from (“public”). The remainder is some Heroku cache-control configuration.

2) If you haven’t already created a Heroku App, you’ll have to create one. Unfortunately this currently requires a local Ruby install and the Heroku Gem. After installing the gem you’ll also need to configure your SSH keys on Heroku if you haven’t already done so. Once you’ve set this up, you can create a new Heroku application by typing “heroku create” on the command line:

This spits out two important pieces of information: your application URL, and the git repository URI used to deploy your application.

3) On the Orion repositories page, add a new remote that points to the repository URI provided in the previous step.

4) Click on your repository name to open the Repository configuration panel, and set “branch.master.remote” to the new remote you just created.

5) Finally, open the Git Status page in Orion and push your application. In the password dialog, enter the private key corresponding to the public SSH key you provided to Heroku. If your SSH key requires a passphrase, enter that too.

That’s it! Now you can navigate to your site using the URL the Heroku command line gave you in step 2).


At this point you can continue to develop your application in Orion, and deploy new updates via a Git Push to Heroku directly from your browser development environment.

Circling back to the Ruby editing problem in step 1), the application I just deployed in this example is a trivial Ruby editor for Orion. I’ll save details on that for another post, but for now you can just install the plugin by pasting this URL into the Orion Plugins page:

http://radiant-night-3911.heroku.com/rubyEditor.html

Now what would make this process really sing would be an Orion plugin living on http://heroku.com that talks to the Heroku REST API for creating and managing deployed applications. This is exactly what the Heroku gem does today, so there is no technical barrier to making this possible. This would fill in the missing steps today where you need to install the Heroku gem on a developer machine just to bootstrap your application the first time. You would then be able to host your entire development lifecycle from creation to deployment directly from your browser.

This entry was posted in Integrations. Bookmark the permalink.