With this cartridge you can easily deploy Scala, Spray, Play and Akka applications, or any java applications, on the Openshift PaaS. using sbt launcher
Openshift environment:
rhc app create demoreactiveapp \
http://cartreflect-claytondev.rhcloud.com/reflect?github=spaced/openshift-cartridge-scala-sbt-launcher
That's all! Now all that is left is to wait for the deployment to complete ;)
First Deployment can sometimes be a rather slow process. Be patient with it and check on the deployment process with following command:
ssh id_to_replace@yourapp-$yournamespace.rhcloud.com "tail -f scala/logs/scala.log"
After each git push
, start.sh
script will be automatically called at the root of your repo.
In the template project, run start.sh
script:
sbt @application.properties
https://github.com/spaced/openshift-cartridge-example-project
Add dependency
"org.scala-sbt" % "launcher-interface" % "1.0.0" % "provided",
and implement a Runner extends xsbti.AppMain (see also http://www.scala-sbt.org/0.13/docs/Launcher-Getting-Started.html) Example: https://github.com/spaced/openshift-cartridge-example-project/blob/master/src/main/scala/com/example/XMain.scala Customize your application.properties If you use sbt as build tool, add following to your sbt build:
publishTo := Some(Resolver.file("file", new File("/path/to/your/openshift_git_repo/localrepo"))
publishMavenStyle := true
In your application listen on the environment variable $OPENSHIFT_SCALA_IP:$OPENSHIFT_SCALA_PORT
interface = System.getenv("OPENSHIFT_SCALA_IP")
port = System.getenv("OPENSHIFT_SCALA_PORT").toInt
- publish your application to localrepo folder (sbt publish)
- git push
This cartridge will embed a quick start application based on Spray Original Repo. Learn more at spray.io.