2
votes

I have a scala SBT project where I'm using the native packager plugin. I'm bundling as a JavaServerAppPackaging and would like to generate scripts for automatically registering the application for startup and shutdown with rc.d scripts (Amazon Linux). In my plugins.sbt: addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.2.0-M5")

In build.sbt lazy val server = DefProject("some/server", "server") .settings(serverModuleDeps) .settings(ServerSettings.allSettings: _*) .settings(CloudFormation.defaultSettings: _*) .settings(serverLoading in Universal := Option(ServerLoader.SystemV)) .settings(serviceAutostart:=true) .settings(startRunlevels:=Option("3")) .settings(stopRunlevels:=Option("3")) .settings(stackRegion := "US_WEST_2") .settings(codedeployAWSCredentialsProvider := Option(new ProfileCredentialsProvider("devcredentialsprovider"))) .dependsOn(sharedJvm) .dependsOn(langJVM) .enablePlugins(JavaServerAppPackaging, SystemVPlugin) .settings(daemonUser:="ec2-user") .configure(InBrowserTesting.jvm)

when I run sbt stage I can see a universal folder containing a bin folder with a sh and a cmd file to start the application. However, there is not code to register/start the application as a system service. Is there any additional configuration required to have the plugin generate scripts for registering the application? What am I missing?

I have a created a basic project to demonstrate the issue: https://github.com/MojoJojo/sbt-native-packager-test

1
If you want to create a debian package you should run debian:packageBin command.kardapoltsev

1 Answers

1
votes

Your configuration is correct. Your sbt command isn't :)

with packageBin ( which IIRC triggers universal:packageBin ) generates only a universal zip file. A systemloader is a operating system specific part. That's why it's not included in a universal zip.

Generate a debian or rpm file with

debian:packageBin
rpm:packageBin

The generated deb or rpm package will have the systemloader files included, because they are in the place a rpm/debian based system would expect them.

Related issue: https://github.com/sbt/sbt-native-packager/issues/869