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

Make systemd service option available to universal tarball. #1115

Closed
LeifW opened this issue Apr 4, 2018 · 1 comment
Closed

Make systemd service option available to universal tarball. #1115

LeifW opened this issue Apr 4, 2018 · 1 comment
Labels
feature request universal Zip, tar.gz, tgz and bash issues

Comments

@LeifW
Copy link

LeifW commented Apr 4, 2018

systemd is a standard - there's nothing necesarrily OS-specific about a systemd service file or its location on the filesystem.

I'm here on Arch Linux (a systemd system) installing Centos in a chroot just so I can get the java app as a systemd service.

@muuki88 muuki88 added feature request universal Zip, tar.gz, tgz and bash issues labels Apr 4, 2018
@muuki88
Copy link
Contributor

muuki88 commented Apr 4, 2018

Hi @LeifW
Thanks for your feature request.

I'm curious how your installation process exactly looks like?

From sbt-native-packager's perspective the sbt universal:package* (packageBin, packagaTarballz, etc.) tasks produce a self contained package that can be extracted and started.

there's nothing necesarrily OS-specific about a systemd service file or its location on the filesystem.

A systemloader is something OS specific. You can't (or at least it's non trivial) to use systemd on windows or macos. There are also common file locations for different systems.

If we package the systemd service file into the resulting tar/zip file, it would still do nothing as there is no proper installation mechanism. rpm and debian are configured for their OS-specific systemd paths and register the new service properly during package installation.
For all other systems there would be unnecessary files packaged. We try to only add exactly what is required to start the application.

  • systemd is OS specific if it should work. It's not universal like a zip file.
  • native-packager tries to provide only required files (notable exception are the bash and bat start script)

Having said that, if you have got good reasons to not use a package manager and want to
use systemd with universal:packageTarball there is nothing that restricts you to do so:

systemd and packageTarball

You could try to use the SystemdPlugin, which depends on the SystemloaderPlugin. However I think this is an overkill at this point as you'll need to duplicate a lot of settings that don't make much sense.

So what I would do instead: Put your service file into src/universal/systemd/myapp.service.
Your tarball will then contain the systemd/myapp.service. The nice thing is that no sbt configuration is required at all and you configure your app there. The only thing you need to take care of is that the linuxStartScriptName (by default the packageName) and the paths in your file match.

@muuki88 muuki88 closed this as completed Jul 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request universal Zip, tar.gz, tgz and bash issues
Projects
None yet
Development

No branches or pull requests

2 participants