Code Monkey home page Code Monkey logo

heroku-buildpack-scala's Introduction

Heroku Buildpack for Scala Build Status

This is the official Heroku buildpack for Scala apps. It uses sbt 0.11.0+.

How it works

The buildpack will detect your app as Scala if it has a project/build.properties file and either a .sbt or .scala based build config (for example, a build.sbt file). It vendors a version of sbt into your slug (if you are not using sbt-native-packager, it also includes your popluated .ivy/cache in the slug). The .ivy2 directory will be cached between builds to allow for faster build times.

It is strongly recommended that you use sbt-native-packager with this buildpack instead of sbt-start-script. The latter is deprecated, and will result in exessively large slug sizes.

Documentation

For more information about using Scala and buildpacks on Heroku, see these articles:

Examples

There are a number of example applications that demonstrate various ways of configuring a project for use on Heroku. Here are a few:

Customizing

This buildpack uses sbt-extras to run sbt. In this way, the execution of sbt can be customized either by setting the SBT_OPTS config variable, or by creating a .sbtopts file in the root directory of your project. When passing options to the underlying sbt JVM, you must prefix them with -J. Thus, setting stack size for the compile process would look like this:

$ heroku config:set SBT_OPTS="-J-Xss4m"

Running additional tasks before the build

Sometimes, it might be necessary to run additional sbt tasks before a build and deployment (for example, database migrations). Ideally, the tasks should be interdependent such that these tasks run automatically as pre-requisities to compile stage, but sometimes this might not be the case. To add any additional tasks, set the environment variable SBT_PRE_TASKS to a list of tasks that should be executed. If the following is set:

SBT_PRE_TASKS=flyway:migrate info

Then, the following command will be run for build:

sbt flyway:migrate info compile stage

Clean builds

In some cases, builds need to clean artifacts before compiling. If a clean build is necessary, configure builds to perform clean by setting SBT_CLEAN=true:

$ heroku config:set SBT_CLEAN=true
Setting config vars and restarting example-app... done, v17
SBT_CLEAN: true

All subsequent deploys will use the clean task. To remove the clean task, unset SBT_CLEAN:

$ heroku config:unset SBT_CLEAN
Unsetting SBT_CLEAN and restarting example-app... done, v18

Development

To make changes to this buildpack, fork it on Github. Push up changes to your fork, then create a new Heroku app to test it, or configure an existing app to use your buildpack:

# Create a new Heroku app that uses your buildpack
heroku create --buildpack <your-github-url>

# Configure an existing Heroku app to use your buildpack
heroku buildpacks:set <your-github-url>

# You can also use a git branch!
heroku buildpacks:set <your-github-url>#your-branch

License

Licensed under the MIT License. See LICENSE file.

heroku-buildpack-scala's People

Contributors

jkutner avatar sclasen avatar ryanbrainard avatar havocp avatar rohanprabhunomadly avatar jeantil avatar jamesward avatar jsimone avatar ndeverge avatar xuwei-k avatar dougc avatar edmorley avatar lstoll avatar mmcgrana avatar mattgraham avatar matt-thomson avatar mbbx6spp avatar ticktock avatar vcherkassky avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.