Installing Sbt Native Packager Debian uses root user instead of daemon user

I am creating a debian package of my Scala Play 2.3.8 application with its own sbt ( "com.typesafe.sbt" % "sbt-native-packager" % "1.0.0"

) wrapper . The startup scripts that are generated use the user user to start and stop the application, which is exactly as intended. The problem is that installing using dpkg -i package.deb

seems to launch the app immediately after installing as root. /var/run/neeedo-app/running.pid

it is then owned by the root user, and all subsequent stop or start attempts fail because this file cannot be overwritten by the daemon user.

This is my build.sbt file:

import com.typesafe.sbt.SbtNativePackager._
import NativePackagerKeys._
import com.typesafe.sbt.packager.archetypes.ServerLoader.SystemV

name := """neeedo-api"""

version := "1.0-SNAPSHOT"

scalaVersion := "2.11.1"

maintainer in Debian := "neeedo-team <neeedo@neeedo.com>"

packageSummary in Debian := "neeedo api application"

serverLoading in Debian := SystemV

packageDescription := "neeedo api application"

daemonUser in Linux := neeedo-api

daemonGroup in Linux := neeedo-api

      

I am running the dpkg install command also with the neeedo-app user. I don't understand why the run.pid file is created by the root user after installation. If I delete the file manually with sudo and use the firewall start / stop script everything works fine ...

Edit (answer): It seems that running the app as root (with dpkg) is actually not a problem. The run.pid file is located in the directory owned by the application user. Therefore, it can edit and delete the pid file.

My application uses environment variables in its configuration and when running start script with sudo as root user you have different environment variables. This resulted in the application being unable to start and unfortunately the error reporting was not visible (I need to further investigate why as this should usually be reported).

+3


source to share





All Articles