AKKA-http部署 [英] AKKA-http deployment
问题描述
这是我第一次使用akka-http。我编写了下面的主类来启动应用程序:
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)
}
它在本地主机上启动服务器,但是当我尝试将其部署在远程tomcat服务器上时,它不再起作用。它以HTTP 404响应:找不到。
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.
我一直在网上搜索akka-http部署,但找不到答案。有人对此问题有经验吗?
I've been searching on the web for akka-http deployment, but couldn't find an answer. Someone has experience with this probleem?
亲切的问候
推荐答案
Akka -http不应该作为servlet部署,而是一个独立的可执行文件。部署Akka应用程序的一种流行方法是使用 sbt-native-packager 一个>插件。它可以创建用于部署的特定于系统的软件包,包括带有启动脚本的 deb
和 rpm
软件包,以提供类似于服务的服务。 Linux上的行为。
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.
我最近回答了相关问题,但有关 Play
框架的问题。从部署角度看,Play和Akka相似,因此请在此处查看: https://stackoverflow.com/a/35648740/371804
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
这篇关于AKKA-http部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!