gpt4 book ai didi

ubuntu - 将 Play 应用程序部署为 Debian 包

转载 作者:太空宇宙 更新时间:2023-11-03 16:59:08 26 4
gpt4 key购买 nike

我在创建 Play 应用程序的 debian 发行版时遇到了一些问题。deb 文件已正确创建,我可以在 Ubuntu 15.04 上安装它,但无法安装启动和停止服务:

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

我还尝试在包中包含 application.conf 的“生产版本”和一些 jvmopts,也不走运(deb 文件具有来自/conf 的 application.conf 版本,而不是来自 src/universal/conf - 是正确的路径?-,并且 jvmopts 似乎被完全忽略了)。

这是我在项目中使用的 build.sbt:

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")

最佳答案

Failed to start test.service: Unit test.service failed to load: No such file or directory.

... 表明软件包生成器未运送或未正确安装 systemd单元文件或者它没有正确使用 sysvinit shim。你能运行以下命令吗:

dpkg -c test_0.2_all.deb 

sudo 不是必需的。这将列出 .deb 的文件内容。如果我们在这里看到一个 .service 文件,我们就必须查看包的 .postinst 文件,看看它是否在做任何愚蠢的事情(或者更像是缺少一些 initscript 设置节)。

关于ubuntu - 将 Play 应用程序部署为 Debian 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31816493/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com