Project

General

Profile

Actions

Task #1586

closed

contrib: Add unit file(s) and instructions for systemd

Added by Alex Afanasyev almost 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Tools
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

Related issues 1 (0 open1 closed)

Blocks NFD - Task #2810: PPA: use systemd startup scripts for daemonsClosedEric Newberry

Actions
Actions #1

Updated by Davide Pesavento almost 10 years ago

A unit file (nfd.service) should be enough, no scripts should be needed. Optionally we can (should) support on-demand socket-based activation, at least for the unix stream socket.

Actions #2

Updated by Alex Afanasyev almost 10 years ago

yes. nfd.service could be enough (may be nrd.service too, unless systemd cannot monitor two processes for the same service). I just don't know anything about it, so don't know exactly how to work with it. Are you familiar with it and can write a sample/readme?

I wouldn't go with ondemand approach. It is possible (even with upstart and launchd), but it is not entirely correct for us.

Actions #3

Updated by Davide Pesavento almost 10 years ago

Alex Afanasyev wrote:

yes. nfd.service could be enough (may be nrd.service too, unless systemd cannot monitor two processes for the same service). I just don't know anything about it, so don't know exactly how to work with it. Are you familiar with it and can write a sample/readme?

Sure, I can do it.

I wouldn't go with ondemand approach. It is possible (even with upstart and launchd), but it is not entirely correct for us.

Why not? It actually makes a lot of sense for the local socket...

Actions #4

Updated by Alex Afanasyev almost 10 years ago

When an application connects to the socket, there is an assumption that someone already created faces, created correct routes so packet can be routed somewhere. So, it doesn't make much sense in starting nfd/nrd when an app tries to connect.

This is different from ssh/apache/etc. deamons, which are triggered by remote connection, do some local job, and after that they are useless. nfd is more like kernel's IP stack: it runs, somebody manages it with command interest, packets gets forwarded, etc.

Actions #5

Updated by Alex Afanasyev almost 10 years ago

  • Assignee set to Davide Pesavento
Actions #6

Updated by Junxiao Shi almost 10 years ago

  • Target version changed from v0.2 to Unsupported
  • Start date deleted (05/09/2014)

20140626 conference call decides to make this "unsupported", because systemd is used on Debian and RedHat, which are unsupported platforms.

Actions #7

Updated by Davide Pesavento about 9 years ago

  • Assignee deleted (Davide Pesavento)
  • Target version changed from Unsupported to v0.4

https://lists.ubuntu.com/archives/ubuntu-devel-announce/2015-March/001130.html

Ubuntu is switching to systemd very soon, and the 15.04 release will likely boot with systemd by default.

Actions #8

Updated by Alex Afanasyev almost 9 years ago

So, 15.04 has switched to systemd and our PPA package no longer provides automatic start of nfd.

@Davide: Can you help creating systemd script that can be included in PPA?

Actions #9

Updated by Alex Afanasyev almost 9 years ago

  • Priority changed from Normal to High
Actions #10

Updated by Eric Newberry almost 9 years ago

I can work on this if needed.

Actions #11

Updated by Davide Pesavento almost 9 years ago

  • Status changed from New to Code review
  • Assignee set to Eric Newberry
Actions #12

Updated by Alex Afanasyev almost 9 years ago

  • Blocks Task #2810: PPA: use systemd startup scripts for daemons added
Actions #13

Updated by Davide Pesavento almost 9 years ago

  • Subject changed from contrib: Add instructions/scripts on how to start/stop nfd with systemd to contrib: Add unit file(s) and instructions for systemd
Actions #14

Updated by Alex Afanasyev almost 9 years ago

From gerrit issue discussions:

Alex: Do you have any idea where systemd stores its journal on Ubuntu. I figured out that I can access nfd's logs (current logs) using journalctrl command, but I couldn't figure out where this information stored or whether or not this information is stored permanently (i.e., how to debug problems)

Eric: By default Ubuntu stores the journal in /run/log/journal. However, this is a temporary filesystem and is lost upon reboot.

Alex: is there a good way to make it "permanent"

Eric: This can be done by creating the /var/log/journal directory

Actions #15

Updated by Alex Afanasyev almost 9 years ago

So, just creating /var/log/journal folder and everything will work automatically? Or anything else to configure? What about log rotation, will this be handled automatically?

Actions #16

Updated by Alex Afanasyev almost 9 years ago

  • % Done changed from 0 to 100
Actions #17

Updated by Eric Newberry almost 9 years ago

That's what the documentation says.

Rotation and other options can be configured in /etc/systemd/journald.conf:

http://www.freedesktop.org/software/systemd/man/journald.conf.html

Actions #18

Updated by Alex Afanasyev almost 9 years ago

I guess my question is going to Davide. How should we handle log files in nfd's PPA? Don't do anything and assume users will know what they are doing (this is kind of destructive...)? Create NFD-specific logging? Force creation of journal? Creating nfd-specific journal?

Actions #19

Updated by Davide Pesavento almost 9 years ago

Alex Afanasyev wrote:

So, just creating /var/log/journal folder and everything will work automatically?

Yes, assuming Storage=auto in journald.conf (the default).

Or anything else to configure?

No, assuming Storage=auto in journald.conf (the default).

What about log rotation, will this be handled automatically?

Yes, if SystemMaxFileSize/RuntimeMaxFileSize and MaxFileSec are left to their default values (or set to any other reasonable values). In any case, these are system-wide settings that are configured by the admin, and should never be touched by us.

Actions #20

Updated by Davide Pesavento almost 9 years ago

Alex Afanasyev wrote:

I guess my question is going to Davide. How should we handle log files in nfd's PPA? Don't do anything and assume users will know what they are doing (this is kind of destructive...)? Create NFD-specific logging? Force creation of journal? Creating nfd-specific journal?

What problem are you trying to solve? The volatility of the journal on Ubuntu? If that's the problem, then we don't need to do anything special. On Ubuntu journald is configured to forward all messages to syslog by default. So everything still goes to the rsyslog daemon and is handled according to the rsyslog rules and usually ends up being written to /var/log/syslog and friends.

Actions #21

Updated by Alex Afanasyev almost 9 years ago

THe problem is logging. Right now operators can see (without doing anything, except installing nfd package) all logs in /var/log/upstart/nfd.log. This log is automatically rotated and everything is fine.

With systemd I'm not seeing that the log is permanently stored. Should we enable something in the package to enable logging, e.g., adding syslog rule of some kind to the system?

Actions #22

Updated by Davide Pesavento almost 9 years ago

So there are two problems (correct me if I'm wrong)

  1. Writing nfd log messages to persistent storage (are you sure they don't get forwarded to syslog and saved like everything else?)

  2. Logging nfd messages separately from everything else... this is rather vague, what is the exact requirement here? do you really need a separate log file stored on disk? otherwise, if you just want to easily skim or search through nfd messages without being disturbed by other output, the systemd way of doing this is e.g. journalctl _COMM=nfd, no configuration necessary.

Actions #23

Updated by Davide Pesavento almost 9 years ago

  • Status changed from Code review to Closed
Actions #24

Updated by Alex Afanasyev almost 9 years ago

Davide Pesavento wrote:

So there are two problems (correct me if I'm wrong)

  1. Writing nfd log messages to persistent storage (are you sure they don't get forwarded to syslog and saved like everything else?)

  2. Logging nfd messages separately from everything else... this is rather vague, what is the exact requirement here? do you really need a separate log file stored on disk? otherwise, if you just want to easily skim or search through nfd messages without being disturbed by other output, the systemd way of doing this is e.g. journalctl _COMM=nfd, no configuration necessary.

There only one problem, the first one you mentioned. I don't have issues with 2, as I already figured out how to use journalctl to extract nfd-specific info.

Actions #25

Updated by Davide Pesavento almost 9 years ago

Well then you have to elaborate more on the first "problem" because I cannot reproduce it: as I said in comment #20, everything still ends up in /var/log/syslog on ubuntu.

Actions #26

Updated by Alex Afanasyev almost 9 years ago

Huh. Davide, the "problem" is that once somebody installs nfd from PPA, whether a week/month from now it would be possible to check logs about what have happened in the past. This is the only thing I want to have and I didn't notice /var/log/syslog originally, so I'm kind of ok right now. However, it would be even better if we had separated "permanent"+logrotated log files for NFD specifically, but I don't really care much.

Actions #27

Updated by Davide Pesavento almost 9 years ago

Then add a config file in /etc/rsyslog.d/, systemd has nothing to do with this.

Actions

Also available in: Atom PDF