Bug 789901

Summary: Provide native systemd service
Product: [Fedora] Fedora Reporter: Jóhann B. Guðmundsson <johannbg>
Component: monotoneAssignee: Thomas Moschny <thomas.moschny>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: thomas.moschny, zbyszek
Target Milestone: ---Keywords: FutureFeature, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-15 21:21:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 713562, 751869    
Attachments:
Description Flags
Native systemd service file for monotone none

Description Jóhann B. Guðmundsson 2012-02-13 08:44:02 UTC
Description of problem:

Let's get the ball rolling on this one...

http://fedoraproject.org/wiki/Features/SysVtoSystemd
https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Jóhann B. Guðmundsson 2012-02-13 08:46:04 UTC
Created attachment 561458 [details]
Native systemd service file for monotone

Let's start with this one. 

The rest of the init script needs to be split out to seperate script which the users runs by hand ( monotone-init,sh and monotone-genkey.sh montone-migrate.sh )

Comment 2 Thomas Moschny 2012-02-16 17:27:58 UTC
The sysv init file does automatically create a database and a key, or moves and migrates the database if necessary upon start.

Do you see any way this can also be done using systemd?

Comment 3 Jóhann B. Guðmundsson 2012-02-16 18:08:22 UTC
It can be done via two methods 

You can create a separated Type=oneshot units ( monotone-keygen.service and monotone-upgrade.service ) with or without conditions  something like...

### monotone-keygen.service ###

[Unit]
Description=Monotone Key Generator

[Service]
Type=oneshot
ExecStart=/path/to/script
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

### monotone-initialdb.service ###

[Unit]
Description=Monotone Create InitialDB

[Service]
Type=oneshot
ExecStart=/path/to/script
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then you would add "Wants=monotone-keygen.service monotone-upgrade.service" to the [Unit] Section and also add monotone-keygen.service monotone-initialdb.service to the After= line in the [Unit] section.

Or you can create one shell script that does all the above and add "ExecStartPre=-/path/to/script" to the [Service] section ( above the ExecStart= line ) in the monotone.service. 

Pay attention to the "-" before the / in the ExecStartPre= line if you skip it the service will fail to start if the relevant script does not exit cleanly.

Comment 4 Jóhann B. Guðmundsson 2012-02-16 18:09:49 UTC
(In reply to comment #3)
> It can be done via two methods 

s/upgrade/initaldb/

Comment 5 Thomas Moschny 2012-02-20 18:29:04 UTC
(In reply to comment #3)

Thanks for the comments. I think I will go that

> Or you can create one shell script that does all the above and add
> "ExecStartPre=-/path/to/script" to the [Service] section ( above the ExecStart=
> line ) in the monotone.service.

route.

> Pay attention to the "-" before the / in the ExecStartPre= line if you skip it
> the service will fail to start if the relevant script does not exit cleanly.

which might on the other hand desired, no? If creation or migration of the database is not possible, the service cannot (and thus should not try to) start.

Comment 6 Jóhann B. Guðmundsson 2012-02-20 18:48:20 UTC
(In reply to comment #5)
> (In reply to comment #3) 
> > Pay attention to the "-" before the / in the ExecStartPre= line if you skip it
> > the service will fail to start if the relevant script does not exit cleanly.
> 
> which might on the other hand desired, no? If creation or migration of the
> database is not possible, the service cannot (and thus should not try to)
> start.

Yup 

But for example how are you going to handled the keygen part? surely you dont want to create keys each time the service is started and if you skip the "-" then the service would fail to start encase the keys exist ( same thing applies for the migration/upgrade) ...

You can have three separated scripts in three separated ExecStartPre= lines which should better point out to admins what failed when they run systemctl status <service> and which would allow you to use "-" where applicable.

Anyway you might want to look at how Tom solved similar problem for postgresql and mysql if I can recall correctly he simply stopped doing all this stuff in the daemon startup and pointed users to use script or run the commands by hand...

Comment 7 Jóhann B. Guðmundsson 2013-02-21 10:44:01 UTC
Ping what's the current status on this?

Comment 8 Fedora End Of Life 2013-04-03 19:46:14 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 9 Jóhann B. Guðmundsson 2014-05-26 09:42:10 UTC
Given that I have left the project and a new individual may or may not continue with systemd integration in the project by submitting new feature following whatever demands FPC and FESCo might have and thus new units in the process I'm closing this and all remaining bugs I had submitted for this particular feature as WONTFIX

Comment 10 Thomas Moschny 2016-02-15 21:21:40 UTC
Fixed in rawhide: monotone-1.1-14.fc24 uses systemd instead of sysv init.