AKKA-http deployment

孤街浪徒 提交于 2019-12-04 23:00:00

问题


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


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/35987639/akka-http-deployment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!