Alternatives

Deploy Scala Play application on Heroku

enter heroku credentials
$ heroku login
create new application
$ heroku create
deploy to server
$ git push heroku master

Activate Node.js

Using multiple buildpacks

$ heroku buildpacks:clear
$ heroku buildpacks:add heroku/nodejs
$ heroku buildpacks:add heroku/scala
confirm the execution order
$ heroku buildpacks
add package.json with line to specify node version (or leave empty {} to pick latest version)
{ "engines": { "node": "4.0.0" } }
add file to git
$ git add package.json
$ git commit -m "Added package.json"
configure sbt to use the Node.js engine by setting SBT_OPTS
$ heroku config:set SBT_OPTS="-Dsbt.jse.engineType=Node"
deploy to heroku
$ git push heroku master
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Using set buildpack heroku/nodejs
remote: -----> Node.js app detected
remote: 
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NPM_CONFIG_PRODUCTION=true
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote: 
remote: -----> Installing binaries
remote:        engines.node (package.json):  4.0.0
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Downloading and installing node 4.0.0...
remote:        Using default npm version: 2.14.2
remote: 
remote: -----> Restoring cache
remote:        Skipping cache restore (new runtime signature)
remote: 
remote: -----> Building dependencies
remote:        Pruning any extraneous modules
remote:        Installing node modules (package.json)
remote: 
remote: -----> Caching build
remote:        Clearing previous node cache
remote:        Saving 2 cacheDirectories (default):
remote:        - node_modules (nothing to cache)
remote:        - bower_components (nothing to cache)
remote: 
remote: -----> Build succeeded!
remote:        └── (empty)
remote:        
remote: -----> Using set buildpack heroku/scala
remote: -----> Play 2.x - Scala app detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Running: sbt compile stage


Published

11 February 2016

Category

technical