[couchdb] (6 commits) ...Add systemd notify support
by Peter Lemenkov
Summary of changes:
0f5feed... - Add /usr/libexec/couchdb wrapper to ExecStart from system (*)
f4f5c04... - default.d/ and local.d/ never worked with couchdb + syste (*)
e4f42ac... - SELinux: Use /usr/libexec/couchdb wrapper for systemd Exe (*)
946ed6d... Add missing script (*)
4c25dd1... spaces instead of tabs, bump to -8, retag (*)
e63180e... Add systemd notify support (*)
(*) This commit already existed in another branch; no separate mail sent
9 years, 2 months
[couchdb/f20] Add systemd notify support
by Warren Togami 砥上勇
commit e63180e008f4b878c017fa8ba642aabd1ad4efb4
Author: Warren Togami <warren(a)slickage.com>
Date: Wed Jul 9 04:26:08 2014 -1000
Add systemd notify support
...hdb-0013-Add-systemd-notification-support.patch | 34 ++++++++++++++++++++
couchdb.service | 2 +-
couchdb.spec | 13 ++++++--
3 files changed, 45 insertions(+), 4 deletions(-)
---
diff --git a/couchdb-0013-Add-systemd-notification-support.patch b/couchdb-0013-Add-systemd-notification-support.patch
new file mode 100644
index 0000000..f650849
--- /dev/null
+++ b/couchdb-0013-Add-systemd-notification-support.patch
@@ -0,0 +1,34 @@
+From 2969091a2ba903b9329739db886326528bfbecbe Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov(a)gmail.com>
+Date: Mon, 7 Jul 2014 21:32:43 +0400
+Subject: [PATCH 13/13] Add systemd notification support
+
+Signed-off-by: Peter Lemenkov <lemenkov(a)gmail.com>
+
+Load module first
+
+Function erlang:function_exported/3 looks only for modules already
+loaded. So we have to load module first. We can do it either implicitly
+by calling any function from the module (and catch for possible
+exceptions if no such module available) or explicitly.
+
+Signed-off-by: Peter Lemenkov <lemenkov(a)gmail.com>
+---
+ src/couchdb/couch_server_sup.erl | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/couchdb/couch_server_sup.erl b/src/couchdb/couch_server_sup.erl
+index 39a5568..2d25220 100644
+--- a/src/couchdb/couch_server_sup.erl
++++ b/src/couchdb/couch_server_sup.erl
+@@ -108,6 +108,7 @@ start_server(IniFiles) ->
+
+ Ip = couch_config:get("httpd", "bind_address"),
+ io:format("Apache CouchDB has started. Time to relax.~n"),
++ {module, sd_notify} == code:load_file(sd_notify) andalso sd_notify:sd_notify(0, "READY=1"),
+ Uris = [get_uri(Name, Ip) || Name <- [couch_httpd, https]],
+ [begin
+ case Uri of
+--
+1.9.3
+
diff --git a/couchdb.service b/couchdb.service
index d092eb9..9e37bae 100644
--- a/couchdb.service
+++ b/couchdb.service
@@ -5,7 +5,7 @@ After=network.target
[Service]
User=couchdb
Group=couchdb
-Type=simple
+Type=notify
StandardOutput=journal
StandardError=journal
Restart=always
diff --git a/couchdb.spec b/couchdb.spec
index 9a5ca62..5731a47 100644
--- a/couchdb.spec
+++ b/couchdb.spec
@@ -7,7 +7,7 @@
Name: couchdb
Version: 1.6.0
-Release: 8%{?dist}
+Release: 9%{?dist}
Summary: A document database server, accessible via a RESTful JSON API
Group: Applications/Databases
@@ -31,6 +31,7 @@ Patch9: couchdb-0009-README-was-renamed.patch
Patch10: couchdb-0010-Use-_DEFAULT_SOURCE-instead-of-obsolete-_BSD_SOURCE.patch
Patch11: couchdb-0011-Silence-redundant-logging-to-stdout-stderr.patch
Patch12: couchdb-0012-Expand-.d-directories-in-erlang.patch
+Patch13: couchdb-0013-Add-systemd-notification-support.patch
BuildRequires: autoconf
BuildRequires: autoconf-archive
@@ -62,6 +63,7 @@ Requires: erlang-kernel%{?_isa}
Requires: erlang-mochiweb%{?_isa}
Requires: erlang-oauth%{?_isa}
Requires: erlang-os_mon%{?_isa}
+Requires: erlang-sd_notify%{?_isa}
Requires: erlang-snappy%{?_isa}
Requires: erlang-ssl%{?_isa}
# Error:erlang(unicode:characters_to_binary/1) in R12B and earlier
@@ -108,10 +110,12 @@ JavaScript acting as the default view definition language.
%endif
%patch9 -p1 -b .renamed
%if 0%{?fedora} > 20
+# Workaround hard-coded Makefile.am assumptions
%patch10 -p1 -b .default_instead_of_bsd
%endif
%patch11 -p1 -b .redundant_logging
%patch12 -p1 -b .expands_d
+%patch13 -p1 -b .sd_notify
#gzip -d -k ./share/doc/build/latex/CouchDB.pdf.gz
@@ -239,7 +243,10 @@ fi
%changelog
-* Sun Jul 06 2014 Warren Togami <wtogami(a)gmail.com> - 1.6.0-8
+* Wed Jul 09 2014 Warren Togami <warren(a)slickage.com> - 1.6.0-9
+- Add systemd notify support
+
+* Sun Jul 06 2014 Warren Togami <warren(a)slickage.com> - 1.6.0-8
- SELinux: Use /usr/libexec/couchdb wrapper for systemd ExecStart, executes as couchdb_t
Additional fixes to selinux-policy are required,
see latest status http://wtogami.fedorapeople.org/a/2014/couchdb.txt
@@ -253,7 +260,7 @@ fi
Users can modify local.ini or add new files in local.d/
- CouchDB runtime config changes are written to local.ini
-* Thu Jul 03 2014 Warren Togami <wtogami(a)gmail.com> - 1.6.0-6
+* Thu Jul 03 2014 Warren Togami <warren(a)slickage.com> - 1.6.0-6
- silence stdout/stderr to prevent redundant flooding of /var/log/messages
CouchDB already logs these messages to /var/log/couchdb/couch.log
Instead print the log filename to stdout, in case a user who ran it
9 years, 2 months
[couchdb/f20] spaces instead of tabs, bump to -8, retag
by Warren Togami 砥上勇
commit 4c25dd1574356ce00a7b3a9576a2b4af5aa0f9ba
Author: Warren Togami <wtogami(a)gmail.com>
Date: Tue Jul 8 14:50:20 2014 -1000
spaces instead of tabs, bump to -8, retag
couchdb.spec | 84 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 42 insertions(+), 42 deletions(-)
---
diff --git a/couchdb.spec b/couchdb.spec
index ebd1453..9a5ca62 100644
--- a/couchdb.spec
+++ b/couchdb.spec
@@ -7,7 +7,7 @@
Name: couchdb
Version: 1.6.0
-Release: 7%{?dist}
+Release: 8%{?dist}
Summary: A document database server, accessible via a RESTful JSON API
Group: Applications/Databases
@@ -17,57 +17,57 @@ Source0: http://www.apache.org/dist/%{name}/source/%{version}/apache-%{na
Source1: http://www.apache.org/dist/%{name}/source/%{version}/apache-%{name}-%{ver...
Source2: %{name}.init
Source3: %{name}.service
-Source4: %{name}.tmpfiles.conf
-Source5: %{name}.temporary.sh
-Patch1: couchdb-0001-Do-not-gzip-doc-files-and-do-not-install-installatio.patch
-Patch2: couchdb-0002-More-directories-to-search-for-place-for-init-script.patch
-Patch3: couchdb-0003-Install-into-erllibdir-by-default.patch
-Patch4: couchdb-0004-Don-t-use-bundled-libraries.patch
-Patch5: couchdb-0005-Fixes-for-system-wide-ibrowse.patch
-Patch6: couchdb-0006-Remove-pid-file-after-stop.patch
-Patch7: couchdb-0007-Change-respawn-timeout-to-0.patch
-Patch8: couchdb-0008-Fix-for-Erlang-R16B01.patch
-Patch9: couchdb-0009-README-was-renamed.patch
-Patch10: couchdb-0010-Use-_DEFAULT_SOURCE-instead-of-obsolete-_BSD_SOURCE.patch
-Patch11: couchdb-0011-Silence-redundant-logging-to-stdout-stderr.patch
-Patch12: couchdb-0012-Expand-.d-directories-in-erlang.patch
+Source4: %{name}.tmpfiles.conf
+Source5: %{name}.temporary.sh
+Patch1: couchdb-0001-Do-not-gzip-doc-files-and-do-not-install-installatio.patch
+Patch2: couchdb-0002-More-directories-to-search-for-place-for-init-script.patch
+Patch3: couchdb-0003-Install-into-erllibdir-by-default.patch
+Patch4: couchdb-0004-Don-t-use-bundled-libraries.patch
+Patch5: couchdb-0005-Fixes-for-system-wide-ibrowse.patch
+Patch6: couchdb-0006-Remove-pid-file-after-stop.patch
+Patch7: couchdb-0007-Change-respawn-timeout-to-0.patch
+Patch8: couchdb-0008-Fix-for-Erlang-R16B01.patch
+Patch9: couchdb-0009-README-was-renamed.patch
+Patch10: couchdb-0010-Use-_DEFAULT_SOURCE-instead-of-obsolete-_BSD_SOURCE.patch
+Patch11: couchdb-0011-Silence-redundant-logging-to-stdout-stderr.patch
+Patch12: couchdb-0012-Expand-.d-directories-in-erlang.patch
BuildRequires: autoconf
-BuildRequires: autoconf-archive
+BuildRequires: autoconf-archive
BuildRequires: automake
BuildRequires: libtool
-BuildRequires: curl-devel >= 7.18.0
-BuildRequires: erlang-erts >= R13B
+BuildRequires: curl-devel >= 7.18.0
+BuildRequires: erlang-erts >= R13B
# FIXME - this time CouchDB bundled a copy of etap which is heavily different
# from the one we're shipping
-#BuildRequires: erlang-etap
-BuildRequires: erlang-ibrowse >= 4.0.1
-BuildRequires: erlang-mochiweb
-BuildRequires: erlang-oauth >= 1.3.0
-BuildRequires: erlang-os_mon
-BuildRequires: erlang-snappy
-BuildRequires: help2man
-BuildRequires: js-devel
-BuildRequires: libicu-devel
+#BuildRequires: erlang-etap
+BuildRequires: erlang-ibrowse >= 4.0.1
+BuildRequires: erlang-mochiweb
+BuildRequires: erlang-oauth >= 1.3.0
+BuildRequires: erlang-os_mon
+BuildRequires: erlang-snappy
+BuildRequires: help2man
+BuildRequires: js-devel
+BuildRequires: libicu-devel
# For /usr/bin/prove
-BuildRequires: perl(Test::Harness)
+BuildRequires: perl(Test::Harness)
-Requires: erlang-crypto%{?_isa}
+Requires: erlang-crypto%{?_isa}
# Error:erlang(erlang:max/2) in R12B and earlier
# Error:erlang(erlang:min/2) in R12B and earlier
-Requires: erlang-erts%{?_isa} >= R13B
-Requires: erlang-ibrowse%{?_isa} >= 4.0.1
-Requires: erlang-inets%{?_isa}
-Requires: erlang-kernel%{?_isa}
-Requires: erlang-mochiweb%{?_isa}
-Requires: erlang-oauth%{?_isa}
-Requires: erlang-os_mon%{?_isa}
-Requires: erlang-snappy%{?_isa}
-Requires: erlang-ssl%{?_isa}
+Requires: erlang-erts%{?_isa} >= R13B
+Requires: erlang-ibrowse%{?_isa} >= 4.0.1
+Requires: erlang-inets%{?_isa}
+Requires: erlang-kernel%{?_isa}
+Requires: erlang-mochiweb%{?_isa}
+Requires: erlang-oauth%{?_isa}
+Requires: erlang-os_mon%{?_isa}
+Requires: erlang-snappy%{?_isa}
+Requires: erlang-ssl%{?_isa}
# Error:erlang(unicode:characters_to_binary/1) in R12B and earlier
-Requires: erlang-stdlib%{?_isa} >= R13B
-Requires: erlang-tools%{?_isa}
-Requires: erlang-xmerl%{?_isa}
+Requires: erlang-stdlib%{?_isa} >= R13B
+Requires: erlang-tools%{?_isa}
+Requires: erlang-xmerl%{?_isa}
%if 0%{?el5}%{?el6}
#Initscripts
@@ -239,7 +239,7 @@ fi
%changelog
-* Sun Jul 06 2014 Warren Togami <wtogami(a)gmail.com> - 1.6.0-7
+* Sun Jul 06 2014 Warren Togami <wtogami(a)gmail.com> - 1.6.0-8
- SELinux: Use /usr/libexec/couchdb wrapper for systemd ExecStart, executes as couchdb_t
Additional fixes to selinux-policy are required,
see latest status http://wtogami.fedorapeople.org/a/2014/couchdb.txt
9 years, 2 months
[couchdb/f20] Add missing script
by Warren Togami 砥上勇
commit 946ed6d53aa15e0e1689ffd982be6808c16dfafc
Author: Warren Togami <wtogami(a)gmail.com>
Date: Tue Jul 8 14:48:37 2014 -1000
Add missing script
couchdb.temporary.sh | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/couchdb.temporary.sh b/couchdb.temporary.sh
new file mode 100755
index 0000000..2c7ac73
--- /dev/null
+++ b/couchdb.temporary.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Temporary Launcher for systemd + selinux
+# CouchDB upstream at version 2.0 will replace /bin/couchdb with a bare launcher
+# At that point we can get rid of this dumb wrapper.
+
+exec /usr/bin/erl $@
9 years, 2 months
[Bug 1103524] New: Change rabbitmq-server systemd service to Type=notify
by Red Hat Bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=1103524
Bug ID: 1103524
Summary: Change rabbitmq-server systemd service to Type=notify
Product: Fedora
Version: rawhide
Component: rabbitmq-server
Assignee: hubert.plociniczak(a)gmail.com
Reporter: lemenkov(a)gmail.com
QA Contact: extras-qa(a)fedoraproject.org
CC: apevec(a)redhat.com, erlang(a)lists.fedoraproject.org,
hubert.plociniczak(a)gmail.com, jeckersb(a)redhat.com,
lemenkov(a)gmail.com, rjones(a)redhat.com,
rohara(a)redhat.com, s(a)shk.io, skottler(a)redhat.com
Depends On: 1059913
+++ This bug was initially created as a clone of Bug #1059913 +++
Description of problem:
There is a race condition when starting rabbitmq-server for the first time.
When the erlang runtime starts, it tries to read its cookie file (for rabbitmq,
/var/lib/rabbitmq/.erlang.cookie) and if it doesn't already exist, it generates
a new random cookie and creates the file.
The following two lines from the rabbitmq-service.service unit file are
involved:
ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server
ExecStartPost=/usr/lib/rabbitmq/bin/rabbitmqctl wait /var/run/rabbitmq/pid
The rabbitmq-server command returns before the service is up. Therefor it is
required to exec the additional rabbitmqctl wait in order to make sure the
service starts all the way. However both of these are erlang programs, and
they share the cookie startup code described previously.
There is variance on the order of events and the eventual error. But generally
what happens is:
- ExecStart (rabbitmq-server) is run and exits. The erlang runtime is now
booting in the background.
- ExecStartPost (rabbitmqctl) is run.
- rabbitmq-server determines the cookie file is not present, and generates a
new cookie.
- rabbitmqctl determines the cookie file is not present, and generates a new
cookie.
- rabbitmq-server writes the new cookie to disk and sets the file to read-only
- rabbitmqctl tries to open the cookie file read/write in order to write its
cookie, but errors with EACCESS because the file already exists and is read
only.
- The erlang runtime for rabbitmqctl crashes and the command returns with a
non-successful exit code.
- The entire service unit is marked as failed, and all of the processes are
killed by systemd.
Version-Release number of selected component (if applicable):
rabbitmq-server-3.1.5-1.fc20.noarch
erlang-R16B-03.1.fc20.x86_64
How reproducible:
There is some variability since it's a race. I've provided my reproducer below
that works 100% of the time for me, inside a F20 VM. In theory this behavior
should still exist if starting the service from the cli instead of rebooting,
but I can't reproduce it that way.
Steps to Reproduce:
1. install rabbitmq-server
2. systemctl enable rabbitmq-server.service
3. reboot
Actual results:
Service fails to start, see attachment of journalctl output for error
Expected results:
Service starts cleanly
Additional info:
This is really an erlang bug, but the workaround for rabbit is simple (I'll
post a patch in a followup). I'll run down the erlang bit separately but it
will take longer, so it makes sense to apply the workaround here until erlang
is fixed.
--- Additional comment from John Eckersberg on 2014-01-30 18:06:26 EST ---
--- Additional comment from John Eckersberg on 2014-01-31 09:33:31 EST ---
This patch updates the systemd service to run `rabbitmqctl status` before
starting the rabbitmq-server process. This ensures the erlang cookie is
created before starting the service.
--- Additional comment from Richard W.M. Jones on 2014-04-01 13:58:41 EDT ---
I performed the steps given in the bug description and the patch
works for me in a Rawhide VM.
The patch also looks reasonable to me and low risk, so I'm going to
backport it to Fedora 20.
--- Additional comment from Fedora Update System on 2014-04-01 14:51:47 EDT ---
rabbitmq-server-3.1.5-5.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/rabbitmq-server-3.1.5-5.fc20
--- Additional comment from Fedora Update System on 2014-04-03 00:08:25 EDT ---
Package rabbitmq-server-3.1.5-5.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing rabbitmq-server-3.1.5-5.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-4722/rabbitmq-server-...
then log in and leave karma (feedback).
--- Additional comment from Sam Kottler on 2014-04-03 09:07:54 EDT ---
I'll merge rawhide into EPEL7 when I'm at a machine with my certs on it.
--- Additional comment from Alan Pevec on 2014-04-08 13:02:47 EDT ---
Instead of messing with ExecStartPost, it would be more reliable to switch
systemd service to Type=notify just need someone familiar with rabbitmq to tell
us where to put sd_notify to send notification when service is ready.
--- Additional comment from Fedora Update System on 2014-04-14 18:47:32 EDT ---
rabbitmq-server-3.1.5-5.fc20 has been pushed to the Fedora 20 stable
repository. If problems still persist, please make note of it in this bug
report.
Referenced Bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=1059913
[Bug 1059913] Race condition creating .erlang.cookie
--
You are receiving this mail because:
You are on the CC list for the bug.
9 years, 2 months