Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 643634 - net-p2p/go-ipfs-bin-0.4.13 should include systemd support (optional)
Summary: net-p2p/go-ipfs-bin-0.4.13 should include systemd support (optional)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: David Roman
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2018-01-06 05:00 UTC by Renich Bon Ciric
Modified: 2019-09-28 06:46 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Renich Bon Ciric 2018-01-06 05:00:26 UTC
IMHO, you should include something like: 

# /etc/systemd/system/ipfs-daemon@.service 
[Unit]
Description=InterPlanetary File System
After=network.target

[Service]
ExecStart=/usr/bin/ipfs daemon --enable-gc --migrate
ExecStop=/usr/bin/ipfs shutdown
Group=%i
Restart=always
Type=simple
User=%i

[Install]
WantedBy=multi-user.target

So a user can simply: systemctl start ipfs-daemon@renich.service and have it launch.

I've tested it and it works for me.
Comment 1 Renich Bon Ciric 2018-06-13 22:47:57 UTC
hello?
Comment 2 David Roman 2018-06-13 23:03:59 UTC
Sorry, I did the services for systemd & openrc long time ago but forgot about it, this week I will do the PR.

btw, thanks for sharing your systemd service, it was very helpful, I don't have much experience writing systemd services.
Comment 3 Renich Bon Ciric 2018-06-14 00:23:35 UTC
(In reply to David from comment #2)
> Sorry, I did the services for systemd & openrc long time ago but forgot
> about it, this week I will do the PR.

No worries. Just wanted to know happened.
 
> btw, thanks for sharing your systemd service, it was very helpful, I don't
> have much experience writing systemd services.

Awesome! Glad to help!
Comment 4 Larry the Git Cow gentoo-dev 2018-08-07 15:09:55 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=58150d2a90836290517b123f04f2930afd25016b

commit 58150d2a90836290517b123f04f2930afd25016b
Author:     David Roman <davidroman96@gmail.com>
AuthorDate: 2018-06-14 20:07:46 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-08-07 15:09:05 +0000

    net-p2p/go-ipfs-bin: add services for openrc & systemd
    
    Closes: https://bugs.gentoo.org/643634
    Closes: https://github.com/gentoo/gentoo/pull/9223

 net-p2p/go-ipfs-bin/files/ipfs.confd                 |  1 +
 net-p2p/go-ipfs-bin/files/ipfs.init                  | 17 +++++++++++++++++
 net-p2p/go-ipfs-bin/files/ipfs.service               | 14 ++++++++++++++
 ...in-0.4.15.ebuild => go-ipfs-bin-0.4.15-r1.ebuild} | 20 +++++++++++++++++++-
 4 files changed, 51 insertions(+), 1 deletion(-)
Comment 5 Kai Krakow 2019-06-17 23:25:52 UTC
Please reopen because it's not fixed.

The included ipfs.service file is just plain wrong... It's rejected with status "bad-setting" by systemd.

To fix this, either set "User=ipfs" and "Group=ipfs", or make it an instance unit by naming it "ipfs@.service" (the "@" is not a syntax error).

In the latter case, "%i" is replaced by whatever comes between "@" and ".service". So if you "systemctl enable ipfs@someuser.service", it would run as "someuser" because %i resolves to "someuser".

But using "%i" and not naming the service file as an instance template is just a syntax error.

The "ipfs.init" file runs as user/group "ipfs" by default, so I guess you should provide both "ipfs@.service" (with %i as user/group) and "ipfs.service" (with static user/group).

While fixing it, it should have "After=network.target" (the ipfs.init file also has it).
Comment 6 Larry the Git Cow gentoo-dev 2019-09-28 06:46:25 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f02a3bf0a1f4c5d58fc553d9a85fe44229e1be76

commit f02a3bf0a1f4c5d58fc553d9a85fe44229e1be76
Author:     Kai Krakow <kai@kaishome.de>
AuthorDate: 2019-09-19 21:38:43 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2019-09-28 06:46:14 +0000

    net-p2p/go-ipfs-bin: Bump to 0.4.22
    
    Bump to 0.4.22 and fix systemd unit files on that way. This
    revision installs both variants, a user instance unit and a unit
    mirroring what the openrc version does (using the "ipfs" user).
    
    Closes: https://bugs.gentoo.org/643634
    Package-Manager: Portage-2.3.69, Repoman-2.3.16
    Signed-off-by: Kai Krakow <kai@kaishome.de>
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 net-p2p/go-ipfs-bin/Manifest                  |  4 +++
 net-p2p/go-ipfs-bin/files/ipfs-at.service     | 18 ++++++++++
 net-p2p/go-ipfs-bin/files/ipfs.service        | 11 ++++--
 net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.22.ebuild | 51 +++++++++++++++++++++++++++
 net-p2p/go-ipfs-bin/metadata.xml              |  8 +++--
 5 files changed, 87 insertions(+), 5 deletions(-)