Search code examples
scalaakkaakka-httpsbt-native-packager

How to deploy Akka-HTTP project to Ubuntu Server?


I am using sbt-native-packager.

I added following code to build.sbt

enablePlugins(JavaAppPackaging)

I run this command in sbt shell

sbt stage

Universal folder has been created. And My project runs with this command in my Windows Computer. No any problem.

./target/universal/stage/bin/MyProjectName.bat

But I want to deploy on Ubuntu Server. I could not run .bat command in Ubuntu. What do I need to do?


Solution

  • In the directory ./target/universal/stage/bin/ there will be an executable script with the same name with no extension.

    On the linux server, run ./target/universal/stage/bin/MyProjectName and the application will start. Make sure you copy everything in the stage folder, including bin and lib.

    I highly recommend that you use one for the packagers. Universal packager will create a zip file that you can extract anywhere.