[ARVADOS] updated: e18a2167616da4d45fa3314df55483c4b1862240
Git user
git at public.curoverse.com
Tue Aug 23 13:29:19 EDT 2016
Summary of changes:
build/go-package-scripts/postinst | 31 ++++++++++++++++++++++
build/go-package-scripts/prerm | 19 +++++++++++++
build/run-library.sh | 13 ++++++++-
.../crunch-dispatch-slurm/crunch-dispatch-slurm.go | 7 ++++-
.../crunch-dispatch-slurm.service | 12 +++++++++
5 files changed, 80 insertions(+), 2 deletions(-)
create mode 100755 build/go-package-scripts/postinst
create mode 100755 build/go-package-scripts/prerm
create mode 100644 services/crunch-dispatch-slurm/crunch-dispatch-slurm.service
via e18a2167616da4d45fa3314df55483c4b1862240 (commit)
via 9192507c4d15cd083231d16331c96bd197c79cec (commit)
via 44af40bbc9c3617100d7360809275140ac7b7cd2 (commit)
via d25acd6794de48d6927cd5d6250cedef3ba4e2d1 (commit)
via 7d4f5d69a2dced1bb0c807da46a791e094a8cc47 (commit)
via 382f262d2c9c2c104808fa4bb38fb395e28c85bc (commit)
via 3ffd38b8e0792fc68be55d954cd65ab32f64586a (commit)
via 369b6de63a042bd7b0a95a5510f0260a314c2361 (commit)
via 8382fe1d7ee8c0c050873c05f0702d35c5e1305f (commit)
from ffc0c0768c4d2dc9aae3d4e3be3cb5584e42a4ba (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit e18a2167616da4d45fa3314df55483c4b1862240
Merge: ffc0c07 9192507
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 23 13:29:04 2016 -0400
Merge branch '9706-package-systemd-files'
refs #9706
refs #9745
commit 9192507c4d15cd083231d16331c96bd197c79cec
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Aug 22 15:18:30 2016 -0400
9706: Use ${} interpolation syntax consistently.
diff --git a/build/go-package-scripts/postinst b/build/go-package-scripts/postinst
index 8559a97..0663465 100755
--- a/build/go-package-scripts/postinst
+++ b/build/go-package-scripts/postinst
@@ -5,25 +5,25 @@ set -e
# NOTE: This package name detection will only work on Debian.
# If this postinst script ever starts doing work on Red Hat,
# we'll need to adapt this code accordingly.
-script="$(basename "$0")"
+script="$(basename "${0}")"
pkg="${script%.postinst}"
systemd_unit="${pkg}.service"
case "${1}" in
configure)
if [ -e /run/systemd/system ]; then
- eval "$(systemctl -p UnitFileState show "$systemd_unit")"
- case "$UnitFileState" in
+ eval "$(systemctl -p UnitFileState show "${systemd_unit}")"
+ case "${UnitFileState}" in
disabled)
# Failing to enable or start the service is not a
# package error, so don't let errors here
# propagate up.
- systemctl enable "$systemd_unit" || true
- systemctl start "$systemd_unit" || true
+ systemctl enable "${systemd_unit}" || true
+ systemctl start "${systemd_unit}" || true
;;
enabled)
systemctl daemon-reload || true
- systemctl reload-or-try-restart "$systemd_unit" || true
+ systemctl reload-or-try-restart "${systemd_unit}" || true
;;
esac
fi
diff --git a/build/go-package-scripts/prerm b/build/go-package-scripts/prerm
index 4e1399d..02772e4 100755
--- a/build/go-package-scripts/prerm
+++ b/build/go-package-scripts/prerm
@@ -5,15 +5,15 @@ set -e
# NOTE: This package name detection will only work on Debian.
# If this prerm script ever starts doing work on Red Hat,
# we'll need to adapt this code accordingly.
-script="$(basename "$0")"
+script="$(basename "${0}")"
pkg="${script%.prerm}"
systemd_unit="${pkg}.service"
case "${1}" in
remove)
if [ -e /run/systemd/system ]; then
- systemctl stop "$systemd_unit" || true
- systemctl disable "$systemd_unit" || true
+ systemctl stop "${systemd_unit}" || true
+ systemctl disable "${systemd_unit}" || true
fi
;;
esac
diff --git a/build/run-library.sh b/build/run-library.sh
index 485e0d2..4495a4e 100755
--- a/build/run-library.sh
+++ b/build/run-library.sh
@@ -105,13 +105,13 @@ package_go_binary() {
systemd_unit="$WORKSPACE/${src_path}/${prog}.service"
if [[ -e "${systemd_unit}" ]]; then
switches+=(
- --after-install "$WORKSPACE/build/go-package-scripts/postinst"
- --before-remove "$WORKSPACE/build/go-package-scripts/prerm"
+ --after-install "${WORKSPACE}/build/go-package-scripts/postinst"
+ --before-remove "${WORKSPACE}/build/go-package-scripts/prerm"
"${systemd_unit}=/lib/systemd/system/${prog}.service")
fi
- switches+=("$WORKSPACE/$license_file=/usr/share/doc/$prog/$license_file")
+ switches+=("$WORKSPACE/${license_file}=/usr/share/doc/$prog/${license_file}")
- fpm_build "$GOPATH/bin/$basename=/usr/bin/$prog" "$prog" 'Curoverse, Inc.' dir "$version" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=$description" "${switches[@]}"
+ fpm_build "$GOPATH/bin/${basename}=/usr/bin/${prog}" "${prog}" 'Curoverse, Inc.' dir "${version}" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=${description}" "${switches[@]}"
}
default_iteration() {
commit 44af40bbc9c3617100d7360809275140ac7b7cd2
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Aug 15 21:35:35 2016 -0400
9706: 9745: Fix config struct to match example.
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
index 8686fa4..ef08f45 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
@@ -22,7 +22,7 @@ import (
// Config used by crunch-dispatch-slurm
type Config struct {
- arvados.Client
+ Client arvados.Client
SbatchArguments []string
PollPeriod arvados.Duration
commit d25acd6794de48d6927cd5d6250cedef3ba4e2d1
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Aug 15 16:58:02 2016 -0400
9706: Notify systemd when crunch-dispatch-slurm is ready.
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
index 1d9015d..8686fa4 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
@@ -9,6 +9,7 @@ import (
"git.curoverse.com/arvados.git/sdk/go/arvados"
"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
"git.curoverse.com/arvados.git/sdk/go/dispatch"
+ "github.com/coreos/go-systemd/daemon"
"io"
"io/ioutil"
"log"
@@ -105,6 +106,10 @@ func doMain() error {
PollInterval: time.Duration(config.PollPeriod),
DoneProcessing: make(chan struct{})}
+ if _, err := daemon.SdNotify("READY=1"); err != nil {
+ log.Printf("Error notifying init daemon: %v", err)
+ }
+
err = dispatcher.RunDispatcher()
if err != nil {
return err
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.service b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.service
index eac8d89..5b37e3c 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.service
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.service
@@ -4,7 +4,7 @@ Documentation=https://doc.arvados.org/
After=network.target
[Service]
-Type=simple
+Type=notify
ExecStart=/usr/bin/crunch-dispatch-slurm
Restart=always
commit 7d4f5d69a2dced1bb0c807da46a791e094a8cc47
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Aug 15 16:10:58 2016 -0400
9706: Add systemd unit file for crunch-dispatch-slurm.
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.service b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.service
new file mode 100644
index 0000000..eac8d89
--- /dev/null
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Arvados Crunch Dispatcher for SLURM
+Documentation=https://doc.arvados.org/
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/crunch-dispatch-slurm
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
commit 382f262d2c9c2c104808fa4bb38fb395e28c85bc
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Aug 15 16:10:29 2016 -0400
9706: Stop systemd services when their packages are uninstalled.
diff --git a/build/go-package-scripts/postinst b/build/go-package-scripts/postinst
index 3adb0fc..8559a97 100755
--- a/build/go-package-scripts/postinst
+++ b/build/go-package-scripts/postinst
@@ -15,12 +15,14 @@ case "${1}" in
eval "$(systemctl -p UnitFileState show "$systemd_unit")"
case "$UnitFileState" in
disabled)
- systemctl enable "$systemd_unit"
- # Failing to start the service is not a package error,
- # so don't let an error here propagate up.
+ # Failing to enable or start the service is not a
+ # package error, so don't let errors here
+ # propagate up.
+ systemctl enable "$systemd_unit" || true
systemctl start "$systemd_unit" || true
;;
enabled)
+ systemctl daemon-reload || true
systemctl reload-or-try-restart "$systemd_unit" || true
;;
esac
diff --git a/build/go-package-scripts/prerm b/build/go-package-scripts/prerm
new file mode 100755
index 0000000..4e1399d
--- /dev/null
+++ b/build/go-package-scripts/prerm
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+# NOTE: This package name detection will only work on Debian.
+# If this prerm script ever starts doing work on Red Hat,
+# we'll need to adapt this code accordingly.
+script="$(basename "$0")"
+pkg="${script%.prerm}"
+systemd_unit="${pkg}.service"
+
+case "${1}" in
+ remove)
+ if [ -e /run/systemd/system ]; then
+ systemctl stop "$systemd_unit" || true
+ systemctl disable "$systemd_unit" || true
+ fi
+ ;;
+esac
diff --git a/build/run-library.sh b/build/run-library.sh
index 9140ac1..485e0d2 100755
--- a/build/run-library.sh
+++ b/build/run-library.sh
@@ -104,8 +104,10 @@ package_go_binary() {
declare -a switches=()
systemd_unit="$WORKSPACE/${src_path}/${prog}.service"
if [[ -e "${systemd_unit}" ]]; then
- switches+=("${systemd_unit}=/lib/systemd/system/${prog}.service")
- switches+=(--after-install "$WORKSPACE/build/go-package-scripts/postinst")
+ switches+=(
+ --after-install "$WORKSPACE/build/go-package-scripts/postinst"
+ --before-remove "$WORKSPACE/build/go-package-scripts/prerm"
+ "${systemd_unit}=/lib/systemd/system/${prog}.service")
fi
switches+=("$WORKSPACE/$license_file=/usr/share/doc/$prog/$license_file")
commit 3ffd38b8e0792fc68be55d954cd65ab32f64586a
Author: Brett Smith <brett at curoverse.com>
Date: Wed Aug 10 13:22:02 2016 -0400
9706: Go service postinst improvements.
* Use /bin/sh, per Debian policy.
* Prefer basename for readability.
* Check for systemd init with [ -e /run/systemd/system ].
* Make configuration changes based on checking the unit file state.
diff --git a/build/go-package-scripts/postinst b/build/go-package-scripts/postinst
index 137f898..3adb0fc 100755
--- a/build/go-package-scripts/postinst
+++ b/build/go-package-scripts/postinst
@@ -1,15 +1,29 @@
-#!/bin/bash
+#!/bin/sh
set -e
-script="${0##*/}"
+# NOTE: This package name detection will only work on Debian.
+# If this postinst script ever starts doing work on Red Hat,
+# we'll need to adapt this code accordingly.
+script="$(basename "$0")"
pkg="${script%.postinst}"
+systemd_unit="${pkg}.service"
case "${1}" in
configure)
- if which systemctl >/dev/null && [[ -e "/lib/systemd/system/${pkg}.service" ]]; then
- systemctl enable "${pkg}"
- systemctl start "${pkg}"
+ if [ -e /run/systemd/system ]; then
+ eval "$(systemctl -p UnitFileState show "$systemd_unit")"
+ case "$UnitFileState" in
+ disabled)
+ systemctl enable "$systemd_unit"
+ # Failing to start the service is not a package error,
+ # so don't let an error here propagate up.
+ systemctl start "$systemd_unit" || true
+ ;;
+ enabled)
+ systemctl reload-or-try-restart "$systemd_unit" || true
+ ;;
+ esac
fi
;;
esac
commit 369b6de63a042bd7b0a95a5510f0260a314c2361
Author: Tom Clegg <tom at curoverse.com>
Date: Thu Aug 4 18:43:17 2016 -0400
9706: Add postinst script to Go packages that have systemd unit files, so (on Debian) the service starts up without manual intervention.
diff --git a/build/go-package-scripts/postinst b/build/go-package-scripts/postinst
new file mode 100755
index 0000000..137f898
--- /dev/null
+++ b/build/go-package-scripts/postinst
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -e
+
+script="${0##*/}"
+pkg="${script%.postinst}"
+
+case "${1}" in
+ configure)
+ if which systemctl >/dev/null && [[ -e "/lib/systemd/system/${pkg}.service" ]]; then
+ systemctl enable "${pkg}"
+ systemctl start "${pkg}"
+ fi
+ ;;
+esac
diff --git a/build/run-library.sh b/build/run-library.sh
index aee579c..9140ac1 100755
--- a/build/run-library.sh
+++ b/build/run-library.sh
@@ -101,14 +101,15 @@ package_go_binary() {
cd $WORKSPACE/packages/$TARGET
go get "git.curoverse.com/arvados.git/$src_path"
- declare -a addfiles=()
+ declare -a switches=()
systemd_unit="$WORKSPACE/${src_path}/${prog}.service"
if [[ -e "${systemd_unit}" ]]; then
- addfiles+=("${systemd_unit}=/lib/systemd/system/${prog}.service")
+ switches+=("${systemd_unit}=/lib/systemd/system/${prog}.service")
+ switches+=(--after-install "$WORKSPACE/build/go-package-scripts/postinst")
fi
- addfiles+=("$WORKSPACE/$license_file=/usr/share/doc/$prog/$license_file")
+ switches+=("$WORKSPACE/$license_file=/usr/share/doc/$prog/$license_file")
- fpm_build "$GOPATH/bin/$basename=/usr/bin/$prog" "$prog" 'Curoverse, Inc.' dir "$version" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=$description" "${addfiles[@]}"
+ fpm_build "$GOPATH/bin/$basename=/usr/bin/$prog" "$prog" 'Curoverse, Inc.' dir "$version" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=$description" "${switches[@]}"
}
default_iteration() {
commit 8382fe1d7ee8c0c050873c05f0702d35c5e1305f
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Aug 3 17:06:55 2016 -0400
9706: If "foo.service" exists in the source dir for a Go program, package it so it installs to /lib/systemd/system/.
diff --git a/build/run-library.sh b/build/run-library.sh
index 32cf205..aee579c 100755
--- a/build/run-library.sh
+++ b/build/run-library.sh
@@ -100,7 +100,15 @@ package_go_binary() {
cd $WORKSPACE/packages/$TARGET
go get "git.curoverse.com/arvados.git/$src_path"
- fpm_build "$GOPATH/bin/$basename=/usr/bin/$prog" "$prog" 'Curoverse, Inc.' dir "$version" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=$description" "$WORKSPACE/$license_file=/usr/share/doc/$prog/$license_file"
+
+ declare -a addfiles=()
+ systemd_unit="$WORKSPACE/${src_path}/${prog}.service"
+ if [[ -e "${systemd_unit}" ]]; then
+ addfiles+=("${systemd_unit}=/lib/systemd/system/${prog}.service")
+ fi
+ addfiles+=("$WORKSPACE/$license_file=/usr/share/doc/$prog/$license_file")
+
+ fpm_build "$GOPATH/bin/$basename=/usr/bin/$prog" "$prog" 'Curoverse, Inc.' dir "$version" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=$description" "${addfiles[@]}"
}
default_iteration() {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list