memcached provides systemd service file:
which might be not fully gentoo compilant.
Anyway, I think memcached package should install systemd service file.
Steps to Reproduce:
1. emerge memcached
2. systemctl -a | grep memcached
systemd service file not installed
systemd service file should be installed
m_melnikau-vaio kvms # emerge --info
Portage 18.104.22.168 (default/linux/amd64/10.0/desktop/kde, gcc-4.6.1, glibc-2.13-r4, 3.1.1-gentoo x86_64)
System uname: Linux-3.1.1-gentoo-x86_64-Intel-R-_Core-TM-_i5_CPU_M_430_@_2.27GHz-with-gentoo-2.1
Timestamp of tree: Sun, 18 Dec 2011 20:30:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
dev-lang/python: 2.6.7-r2, 2.7.2-r3, 3.1.4-r3, 3.2.2
sys-devel/autoconf: 2.13, 2.68
sys-devel/automake: 1.9.6-r3, 1.10.3, 1.11.1-r1
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
Repositories: gentoo sunrise systemd qting-edge local
CFLAGS="-march=corei7 -Os -pipe"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=corei7 -Os -pipe"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles metadata-transfer news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/lib/layman/sunrise /var/lib/layman/systemd /var/lib/layman/qting-edge /usr/local/portage"
USE="X a52 aac aalib acpi alsa amd64 avahi berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups curl cxx dbus declarative djvu dri dts dv dvd dvdr emboss encode exif fam ffmpeg firefox flac ftp gdbm gdu gif gnome-keyring gnutls gpm gps gsm gstreamer iconv icu imagemagick ios ipod ipv6 jingle jpeg jpeg2k kde kipi lame latex lcms ldap libcaca libnotify lm_sensors lzma lzo mad mmx mng modules mp3 mp4 mpeg mplayer mtp mudflap multilib musicbrainz ncurses netboot networkmanager nls nptl nptlonly ogg openal opengl openmp oscar pam pango pcre pdf phonon plasma png policykit portaudio postgres ppds pppd pulseaudio qt3support qt4 rdesktop readline ruby samba sdl semantic-desktop session smp speex spell sqlite sqlite3 sse sse2 ssl startup-notification subversion svg sysfs taglib tcpd theora tiff truetype udev unicode usb v4l v4l2 vaapi vim-syntax vnc vorbis wifi x264 xcb xcomposite xine xinerama xml xorg xscreensaver xulrunner xv xvid zeroconf zlib zsh-completion" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ru" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon dummy fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
How can I help to move it?
(In reply to Maksim 'max_posedon' Melnikau from comment #1)
> How can I help to move it?
Providing an ebuild diff working for you would be nice
Created attachment 353794 [details, diff]
Created attachment 353796 [details]
memcached.service based on variant provided by fedora-19, but fixed a bit to fix /etc/conf.d/memcached variables (s/$USER/$MEMCACHED_RUNAS)
(In reply to Pacho Ramos from comment #2)
Works for me with attached ebuild patch and service:
# systemctl status memcached.service
memcached.service - Memcached
Loaded: loaded (/usr/lib64/systemd/system/memcached.service; disabled)
Active: active (running) since Mon 2013-07-22 00:35:44 FET; 4min 16s ago
Main PID: 20626 (memcached)
└─20626 /usr/bin/memcached -u memcached -p 11211 -m -c 1024
Jul 22 00:35:44 m_melnikau-M11xR3 systemd: Started Memcached.
Will test and commit in a week if nobody disagrees. Thanks!
There is one problem here: right now memcached.service will use /etc/conf.d/memcached, which is nice in compatibility reasons.
But systemd users may use INSTALL_MASK="/etc/init.d /etc/conf.d /etc/runlevels", like https://github.com/canek-pelaez/gentoo-systemd-only suggest for example (as many others gentoo systemd manualsa)
Should I provide another service, which don't use variables from /etc/conf.d/memcached? It will be more "systemdish", if we will put all this variables inside service.
You should fix memcached to use config files.
(In reply to Michał Górny from comment #8)
> You should fix memcached to use config files.
I'm sorry I didn't understand which config files you mean, attached service file uses /etc/conf.d/memcached, is it ok?
(In reply to Maksim 'max_posedon' Melnikau from comment #9)
> (In reply to Michał Górny from comment #8)
> > You should fix memcached to use config files.
> I'm sorry I didn't understand which config files you mean, attached service
> file uses /etc/conf.d/memcached, is it ok?
No. memcached should have its *own* config file which will be read by memcached. RC is supposed to *start* services, not *configure* them.
> (In reply to Maksim 'max_posedon' Melnikau from comment #9)
> No. memcached should have its *own* config file which will be read by
> memcached. RC is supposed to *start* services, not *configure* them.
But memcached haven't such config files by design, and all configuration should be done by command line.
And frankly speaking it could work (with default configuration) without any options at all.
(In reply to Maksim 'max_posedon' Melnikau from comment #11)
> > (In reply to Maksim 'max_posedon' Melnikau from comment #9)
> > No. memcached should have its *own* config file which will be read by
> > memcached. RC is supposed to *start* services, not *configure* them.
> But memcached haven't such config files by design, and all configuration
> should be done by command line.
> And frankly speaking it could work (with default configuration) without any
> options at all.
And that's a major design flaw that needs to be fixed upstream. Otherwise, you end up with software that you can't properly move to another distro without converting configuration to a different format used by the local flavor of RC.
And if you really want to get it wrong, use the format used by Fedora. It's likely to end up being the most portable one even if it introduces /etc/sysconfig in Gentoo.
(In reply to Michał Górny from comment #12)
> And that's a major design flaw that needs to be fixed upstream. Otherwise,
> you end up with software that you can't properly move to another distro
> without converting configuration to a different format used by the local
> flavor of RC.
As I understand, this is thing, which systemd trying to fix. There is no reason to have 2 separate config files - app's one, and service --- if its easy and possible to move all configuration to service file and unify many options.
> And if you really want to get it wrong, use the format used by Fedora. It's
> likely to end up being the most portable one even if it introduces
> /etc/sysconfig in Gentoo.
I expecting that fedora will deprecate /etc/sysconfig at least for systemd.
So, I'm asking, which variant in the best for Gentoo?
As for me - move all configuration in nice service file, and configure systemd via Environment and EnvironmentFile or even via simple Exec=. And expecting from user to changing configuration via standard systemd way - service inheritance.
We also have some units relying on cond.f files, I see no gain on having a new file in a new subdirectory providing exact same functionality (and I don't see /etc/sysconfig any better than conf.d)
Also, this specific .service file is broken and won't work for me (I use UNIX sockets only).
If we're to provide a file for this, I suggest providing one with sane defaults and possibly a /etc/systemd/system/memcached.service.d/gentoo.conf with commented out sample how to specify more options.
However, we should not at all think about providing configuration wrapper variables. Let's just let people pass command-line options directly, e.g. via overriding ExecStart=.
Created attachment 356956 [details]
(In reply to Michał Górny from comment #15)
> ... and possibly a /etc/systemd/system/memcached.service.d/gentoo.conf
> with commented out sample how to specify more options.
I think its not required, because overriding settings via /etc/systemd/system/<service>.service.d/ is the standard way for systemd's services.
I don't think providing a commented file as example to edit and tweak will hurt, and will surely help to people making configuration easier
+*memcached-1.4.13-r1 (31 Aug 2013)
+ 31 Aug 2013; Pacho Ramos <email@example.com> +files/memcached.service,
+ Add unit file (#395209 by Maksim 'max_posedon' Melnikau)
OK, I have seen neither Arch people let people play so much with memcached starting