Deploy the Play app as a Debian package
I am having some problems creating a distribution of my Play application. deb file is correctly generated and I can install it on Ubuntu 15.04, but the start and stop services could not be installed:
myusr@myhost:~/dev/projects/test/target$ sudo dpkg -i test_0.2_all.deb
Selecting previously unselected package test.
(Reading database ... 350339 files and directories currently installed.)
Preparing to unpack test_0.2_all.deb ...
Unpacking test (0.2) ...
Setting up test (0.2) ...
Adding test to autostart using update-rc.d
update-rc.d: error: initscript does not exist: /etc/init.d/test
Failed to start test.service: Unit test.service failed to load: No such file or directory.
test could not be registered or started
I also tried to package the "production version" application.conf and some jvmopts, no luck (the deb file has the application.conf version from / conf, not from src / universal / conf -is, what's the correct path? - and jvmopts seems to be completely ignored).
This is the build.sbt file that I am using in my project:
import RjsKeys._
import com.typesafe.sbt.packager.archetypes.ServerLoader.{SystemV, Upstart}
serverLoading in Debian := SystemV
bashScriptConfigLocation := Some("${app_home}/../conf/jvmopts")
bashScriptExtraDefines += """addJava "-Dconfig.file=${app_home}/../conf/application.config""""
name := """test"""
version := "0.2"
maintainer in Linux := "Me <me@mail.com>"
packageSummary in Linux := "Test"
packageDescription := "Test"
daemonUser in Linux := normalizedName.value
daemonGroup in Linux := (daemonUser in Linux).value
doc in Compile <<= target.map(_ / "none")
lazy val root = (project in file(".")).enablePlugins(PlayScala,JavaServerAppPackaging,DebianPlugin)
linuxPackageMappings in Debian := linuxPackageMappings.value
scalaVersion := "2.11.1"
pipelineStages := Seq(rjs, digest, gzip)
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
ws,
filters,
"org.webjars" %% "webjars-play" % "2.3.0",
"org.webjars" % "jquery" % "2.1.3",
"org.webjars" % "bootstrap" % "3.3.4",
"org.webjars" % "bootbox" % "4.4.0",
"org.webjars" % "angularjs" % "1.3.15",
"org.webjars" % "angular-ui-bootstrap" % "0.13.0",
"org.webjars" % "nervgh-angular-file-upload" % "1.1.5-1",
"org.webjars" % "angular-uuid4" % "0.3.0",
"org.webjars" % "requirejs" % "2.1.14-1",
"org.webjars" % "d3js" % "3.5.5-1",
"org.webjars" % "d3-tip" % "0.6.6",
"com.google.inject" % "guice" % "3.0",
"ws.securesocial" %% "securesocial" % "master-SNAPSHOT",
"org.reactivemongo" %% "play2-reactivemongo" % "0.10.5.0.akka23"
)
scalacOptions ++= Seq(
"-target:jvm-1.7",
"-encoding", "UTF-8",
"-deprecation",
"-feature",
"-unchecked",
"-Xlint",
"-Ywarn-adapted-args",
"-Ywarn-value-discard",
"-Ywarn-inaccessible",
"-Ywarn-dead-code",
"-language:reflectiveCalls"
)
fork in run := false
webJarCdns := Map("org.webjars" -> "//cdn.jsdelivr.net/webjars")
source to share
Failed to start test.service: Unit test.service failed to load: No such file or directory.
... assumes the package linker is not shipping or installing the correct installation of the systemd file, or is using the sysvinit shim incorrectly. Can you run the following:
dpkg -c test_0.2_all.deb
sudo
not required. This will display the contents of the file .deb
. If we see a file here .service
, we'll need to see the package file .postinst
to see if it does something silly (or more like missing any initscript install line).
source to share