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
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.
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
andrpm
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