Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemVPlugin on Debian not working #955

Closed
wobu opened this issue Apr 4, 2017 · 9 comments · Fixed by #977
Closed

SystemVPlugin on Debian not working #955

wobu opened this issue Apr 4, 2017 · 9 comments · Fixed by #977
Projects

Comments

@wobu
Copy link

wobu commented Apr 4, 2017

Expected behaviour

sudo service name start
-> Service starts succesfull

Actual behaviour

service isn't starting

Information

  • 1.1.5, 1.2.0-M8
  • sbt 0.13.13
  • What is your build system (e.g. Ubuntu, MacOS, Windows, Debian )
  • deb
  • Debian `dpkg' package management program version 1.17.5 (amd64)
  • Ubuntu 14.04

In Version 1.0.5 everythings works. The bug introduced when the logging to the init.d file was introduced.
https://github.com/sbt/sbt-native-packager/blob/master/src/main/resources/com/typesafe/sbt/packager/archetypes/systemloader/systemv/start-debian-template#L51

There are 2 bugs i identified:

  • the stdout_redirect variable shouldn't be escaped when appending to the start-stop-daemon
  • when i remove the 2>&1 and the escaping quotes from stdout_redirect it is working

i am not an expert with the service managers and stdout redirects so i can't say what would be correct.

@jan0sch
Copy link
Contributor

jan0sch commented Apr 4, 2017

Could you provide some more information (like your packaging configuration)? We're using this without problems for nearly a year now.

@wobu
Copy link
Author

wobu commented Apr 4, 2017

enablePlugins(UniversalPlugin)
enablePlugins(DebianPlugin)
enablePlugins(SystemVPlugin)
enablePlugins(JDebPackaging)
enablePlugins(JavaServerAppPackaging)

maintainer := "SomeName"
daemonUser in Linux := "Someuser"
daemonUserUid in Linux := Some("id")
daemonGroup in Linux := "someuser"
daemonGroupGid in Linux := Some("id")
debianPackageDependencies in Debian := Seq("")

bashScriptExtraDefines += """addJava "-Dconfig.file=${app_home}/../conf/application.conf""""
bashScriptExtraDefines += """addJava "-Dlog4j.configuration=file:${app_home}/../conf/log4j.xml""""

mappings in Universal ++= {
    val confDirectory = baseDirectory.value / "conf" / environment.value.name
    Seq(
    confDirectory / "application.conf" -> "conf/application.conf",
    confDirectory / "log4j.xml" -> "conf/log4j.xml",
    confDirectory / "application.ini" -> "conf/application.ini"
    )
}

@jan0sch
Copy link
Contributor

jan0sch commented Apr 4, 2017

Looks good so far the only difference to our options seems to be that we enable fewer plugins:

enablePlugins(JavaServerAppPackaging, JDebPackaging, SystemVPlugin)

I'll try to give this some thought but that will take a while because of current workload.

@wobu
Copy link
Author

wobu commented Apr 4, 2017

thats no problem. I am having a workaround for specifying an alternate template without the log additions for the init.d file

@muuki88 muuki88 added the debian label Apr 5, 2017
@muuki88
Copy link
Contributor

muuki88 commented Apr 5, 2017

Thanks @wobu for your report and thanks @jan0sch for taking a look :)

You are referencing this line, right?

As you are using java logging, you can also disable the logging completely with

daemonStdoutLogFile := None

@wobu
Copy link
Author

wobu commented Apr 5, 2017

yeah this is the default setting, but despite having this set to None there will be empty quotes "" appended to the start-daemon command.
And with this empty quotes our daemon wasn't starting either.

@timcharper
Copy link
Contributor

I'm also experiencing this. From what I read, you cannot use environment variables to append redirection commands, as the parse order in bash is such that environment variables are expanded AFTER the redirection instruction is parsed.

I tried a few things, and found success with a solution described here:

https://stackoverflow.com/questions/8251933/how-can-i-log-the-stdout-of-a-process-started-by-start-stop-daemon

@muuki88
Copy link
Contributor

muuki88 commented Aug 28, 2017

Thanks for sharing @timcharper
Could you share you build.sbt here or even better submit a pull request extending the systemloader documentation 😍

@timcharper
Copy link
Contributor

I submitted a fix here:

#1021

build.sbt here:

https://github.com/mesosphere/marathon/tree/tharper/1.5-packager-updates

Issue is not documentation. I think the template is just broken. I have a PR to fix #1021 which I've confirmed works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants