Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AKKA-http deployment

This is the first time I'm working with akka-http. I wrote the following main class which starts the application:

object Main extends App with Routes with Config with Protocols {
  implicit val system: ActorSystem = ActorSystem("slickboard-system")
  implicit val executor: ExecutionContext = system.dispatcher
  implicit val materializer: ActorMaterializer = ActorMaterializer()

  override val employeeActor: ActorRef = system.actorOf(EmployeeActor.props, "employees")

  val server = Http().bindAndHandle(route, httpServerURL, httpServerPort)
}

It starts a server on localhost, but when I try to deploy it on a remote tomcat server, it is not working anymore. It is responding with a HTTP 404: not found.

I've been searching on the web for akka-http deployment, but couldn't find an answer. Someone has experience with this probleem?

Kind regards

like image 390
Corne Elshof Avatar asked Mar 14 '16 12:03

Corne Elshof


2 Answers

Akka-http is not supposed to be deployed as a servlet, but rather a standalone executable. One of the popular ways to deploy Akka apps is to use sbt-native-packager plugin. It can create system-specific packages for deployment, including deb and rpm packages with startup scripts to provide a service-like behavior on Linux.

I've recently answered related question, but about Play framework. Play and Akka are similar from deploy perspective, so have a look here: https://stackoverflow.com/a/35648740/371804

like image 195
Haspemulator Avatar answered Nov 16 '22 19:11

Haspemulator


akka-http deploys with its own embeded webserver (the embeded webserver being the akka "evolved" version of spray-can). Whereas Spray had the option of deploying to an external web server (as spray servlet), that functionality hasn't been ported to akka-http. There's been some doubt raised in the community that spray-servlet will be something that ever gets ported to akka-http in the future. This is because the akka-http has evolved in a way where its more tightly coupled to the embeded server than spray ever was.

like image 34
Andrew Norman Avatar answered Nov 16 '22 19:11

Andrew Norman