With this cartridge you can easily deploy Scala, Spray, Play and Akka applications, or any SBT based applications, on the Openshift PaaS.
Openshift environment:
rhc app create demoreactiveapp \
http://cartreflect-claytondev.rhcloud.com/reflect?github=47deg/openshift-cartridge-scala
That's all! Now all that is left is to wait for the deployment to complete ;)
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@demoreactiveapp-$yournamespace.rhcloud.com "tail -f scala/logs/scala.log"
After each git push
, sbt compile
will be automatically called, followed by the start.sh
script at the root of your repo.
In the template project, run start.sh
script:
activator run
Another example:
sbt run com.example.Boot.main
Make sure start.sh
has the correct permissions to execute: chmod +x start.sh
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
This cartridge will embed a quick start application based on Spray Original Repo. Learn more at spray.io. However, you could use any framework as long as SBT (or an SBT wrapper like activator) is used for compilation.