Question

I am trying to get an SBT web app running under Heroku. I have been able to do this by using a JettyLauncher script as described here http://scalatra.org/2.2/guides/deployment/heroku.html However, I'd really like to run from the WAR artifact and not my src/main/webapp directory because of some later processing that occurs in the build.

When I try to use StartScriptPlugin.startScriptForWarSettings however, my app gets an error on startup because it tries to copy the WAR file to /tmp/build_26wd72c43fv12/target/jetty-distribution-7.3.1.v20110307/webapps

Reading this: https://devcenter.heroku.com/articles/read-only-filesystem , explains clearly that the problem is because when that script is run by the web dyno, it can't write into /tmp.

So my question is: Is there a way to change the directory that is used for the Jetty distribution in the sbt-start-scriptplugin? I've looked at the source and it is this 'target' variable that is used but I don't ever see how or where it is defined.

Was it helpful?

Solution

There are two possible solutions I have found:

  1. In the Jetty launcher you set the context to go directly to the war file generated by staging using context.setWar("target/scala-2.10/mywar_2.10-0.0.1.war") . In this case you still run with embedded Jetty and the StartScriptPlugin.startScriptForClassesSettings key, but it runs from the WAR instead of

  2. Use Heroku's deploy:war capability: https://devcenter.heroku.com/articles/war-deployment . This didn't work well for me because it means everything is now running in an environment I don't really understand and Heroku is shy on supporting this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top