Skip to content

A bare-bones, self-hosting Nancy app with instructions for Heroku deployment.

Notifications You must be signed in to change notification settings

abdulhadad/nancy-simple-heroku

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple C# app that deploys to Heroku in one step

This repo contains a bare-bones, self-hosting Nancy app prepared for deployment on Heroku. All you have to do to get a C# web app deployed on Heroku is:

$ rake init

All of the heavy lifting was done by Ben Hall; the goal of this fork is simply to collect and document Ben's hard work to make it even easier to create simple C# apps on Heroku.

First Steps

First off, you need to get Mono, create a Heroku account, and install the Heroku toolbelt if you haven't already. Then, to create a new Heroku app, deploy your app to Heroku, and open it in your browser, simply do:

$ rake init

You should only run rake init once. When Heroku creates a new app, it assigns a unique hostname to your app–something like stark-hollows-8350.herokuapp.com. rake init reads this hostname and saves it as a Heroku environment variable, which the Nancy app reads to bind to the correct URL. If you ever change your Heroku hostname, remember to update HOST:

$ heroku config:add HOST=<your new hostname>

Building

$ rake build

Running your app locally

$ rake stage # or just `rake`

Deploying to Heroku

This is merely a shortcut for git push heroku master:

$ rake deploy

Rationale

I'm a developer who uses OS X and loves how easy Heroku makes web app deployment. Heroku's path of least resistance is to use Rails or Node to create your web app, and while I adore CoffeeScript and have some experience writing web apps with Rails and Express, sometimes I want to write my web app in a statically-typed language.

I'm a huge fan of the Mono project, and want to run web apps on Mono, but I've always found .NET web app configuration and deployment overly complicated, especially since I don't use Windows or Visual Studio as my main development environment, and I want something 'lighter' than ASP.NET for simple web services.

Nancy is a Sinatra-esque DSL in C# for creating web apps, and Ben Hall created a Heroku buildpack for Mono and blogged about running Nancy on Heroku about a year ago. I've collected bits of information from Ben's blog posts and added a Rakefile to make the process of deploying this tiny app a little easier.

Enjoy!

About

A bare-bones, self-hosting Nancy app with instructions for Heroku deployment.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published