The heart of our services is scala + akka + spray + mongo. So we are using GitHub for version control. After merging checked PRs to the master branch, Jenkins automaticaly tests'n'builds project. If all tests were successful then Jenking runs a couple of scripts:
- Increment project version (currently written in shell, but will be changed to sbt)
- Run assembly task with sbt-assembly
- Run deploy script (written in Python with Fabric) wich deploys our jar to EC2
Basicaly on the thrid step you have a couple of choices:
Make a runnable jar using IO/Spray boot file:
object Boot extends App {
implicit val system = ActorSystem("ServiceName")
val log = system.log
val service = system.actorOf(Props[Service], name="serviceActor")
IO(Http) ! Http.Bind(service, interface = host, port = port)
}
Make a runnable jar as Akka's microkernel:
In this case you should extend Bootable trait and override startup
and shutdown
methods:
class Kernel extends Bootable {
// many lines of code
def startup() {
scheduler.start()
SomeActorSystem.startup()
}
def shutdown() {
scheduler.shutdown()
SomeActorSystem.shutdown()
system.shutdown()
}
}
Using a TypeSafe startscript:
Can't show an example, but it has a good intro on github =)
We are using all of this way in different cases.