Skip to content

Instantly share code, notes, and snippets.

@2m
Created January 18, 2014 15:33
Show Gist options
  • Save 2m/8492036 to your computer and use it in GitHub Desktop.
Save 2m/8492036 to your computer and use it in GitHub Desktop.

project/build.properties

sbt.version=0.12.0

build.sbt

import com.typesafe.sbt.SbtStartScript

seq(SbtStartScript.startScriptForClassesSettings: _*)

name := "hello"

version := "1.0"

scalaVersion := "2.10.3"

resolvers += "twitter-repo" at "http://maven.twttr.com"

libraryDependencies ++= Seq("com.twitter" %% "finagle-core" % "6.10.0", "com.twitter" %% "finagle-http" % "6.10.0")

Add the start script plugin

At deploy time, Heroku runs sbt clean compile stage to build your Scala app. Typesafe’s sbt-start-script adds a stage task to sbt that generates start scripts for your application.

To use the plugin, create this file:

project/build.sbt

resolvers += Classpaths.typesafeResolver

addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.9.0")

Declare process types with Procfile

Use a Procfile, a text file in the root directory of your application, to explicitly declare what command should be executed to start a web dyno. In this case, you need to execute the Web main method.

The sbt-start-script we added above generates a start script in target/start. This simple shell script sets the CLASSPATH and executes the main method for the object you specify. Invoke it from your Procfile:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment