简体   繁体   中英

How to deploy a Scala Play framework API using the SBT native packager

I created a web API based on the Scala Play framework 2. In the past I generated war files using a SBT plugin in order to deploy in production using Tomcat. It is now possible to build native package from Play project using the SBT native packager plugin. I used it to generate a debian package from my web app.

However, I don't understand how it works. I could generate and install the debian package and start the daemon, but my API seems not listening request.

In the first case, Tomcat hosts the war file which contains the Play app and manages the HTTP connection. I have the feeling that there are missing parts in my debian package in order to work properly like the war file under Tomcat.

The question is, how can I use the native packager plugin to deploy a standalone HTTP API? What is responsible to handle HTTP connection? What is missing in my project?

Thanks in advance

Play applications run using their own light weight http server.

To build a standalone project issue

sbt dist

or if your using activator

activator dist

This makes a directory target/universal/your-app.zip

If you unzip the contents you will find a standalone application structure

/bin
/lib
/conf
/share

under which you can find shellscripts that launch the server

bin/your-app
bin/your-app.bat (windows)

The distribution to a war file appears to have been removed from play. Similar question asked here: Deploy play as a war file into a servlet container, even if it uses JPA heavily?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM