Skip to content
This repository has been archived by the owner on Sep 14, 2019. It is now read-only.

[mig agent] use service package from github (Bugzilla #1135542) #114

Open
jvehent opened this issue Oct 2, 2015 · 5 comments
Open

[mig agent] use service package from github (Bugzilla #1135542) #114

jvehent opened this issue Oct 2, 2015 · 5 comments

Comments

@jvehent
Copy link
Contributor

jvehent commented Oct 2, 2015

Migrated from https://bugzilla.mozilla.org/show_bug.cgi?id=1135542
Assigned to: Julien Vehent [:ulfr]

On 2015-02-22 16:48:59 -0800, Julien Vehent [:ulfr] wrote:

The service package in mig agent currently uses a fork that solves a systemd issue. The issue has now been fixed upstream, so there is no need for the fork anymore. The repository has also moved from bitbucket to github and provides a new configuration API that should be integrated in mig-agent.

new location is https://github.com/kardianos/service

@jvehent jvehent added this to the MIG Loader milestone Oct 2, 2015
@mvanotti
Copy link
Contributor

mvanotti commented Oct 9, 2015

Do you mean changing jvehent/service-go to kardianos/service?

kardianos/service removed the NewService function, and added a service.New one, but this one takes an Interface (Start, Stop) which I have yet to figure out how to adapt to our use case.

@jvehent
Copy link
Contributor Author

jvehent commented Oct 9, 2015

Yes, that's what I mean. I looked at the new interfaces from kardianos/service a while back, but the changes were more difficult to implement than I had initially anticipated. Still, it's something to look into.

@mvanotti
Copy link
Contributor

I think we might still want to fork service package, we can use the upstream version, but there are some changes that are convenient for us:

Service package allows us to "Install" a service, giving the "Start at Boot" and "Restart on Crash" capability.

The functionallity is already working on OSX and systemd as it is.
For upstart it is just a one line change
For systemv it might be more difficult (it's changing the init script)
For windows it is a few lines change (not tested yet)

I created an issue in the Service project asking to make it configurable.

@mvanotti
Copy link
Contributor

Once that is solved, the idea would be to Create the Service and Install it on the sistem, right?

Installing it in the system implies creating the corresponding file so the process is run at startup and restarts after crashes.

Should it use a flag to specify this behaviour?

@jvehent
Copy link
Contributor Author

jvehent commented Oct 10, 2015

I don't think a flag is needed. The current approach is a bit brute-forcy, but works: if the process isn't currently running as a service (ppid!=1), then do a remove->install->start service. At that point, a new process should be started as a service, and the current process that did the install exits.

@arcrose arcrose removed this from the MIG Loader milestone Apr 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants