From 2bf2c2c478b2bdc16fec01d10d23b14969ade9eb Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Wed, 15 Jun 2022 10:16:57 -0700 Subject: [PATCH] fix(local): Kill processes as root Fixes: #49 --- local/start.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/local/start.sh b/local/start.sh index 37cb861..8473fc7 100755 --- a/local/start.sh +++ b/local/start.sh @@ -1,6 +1,14 @@ #!/usr/bin/env bash set -euo pipefail +# NOTE(bacongobbler): nomad MUST run as root for the exec driver to work on Linux. +# https://github.com/deislabs/hippo/blob/de73ae52d606c0a2351f90069e96acea831281bc/src/Infrastructure/Jobs/NomadJob.cs#L28 +# https://www.nomadproject.io/docs/drivers/exec#client-requirements +case "$OSTYPE" in + linux*) SUDO="sudo --preserve-env=PATH" ;; + *) SUDO= ;; +esac + require() { if ! hash "$1" &>/dev/null; then echo "'$1' not found in PATH" @@ -14,19 +22,11 @@ require nomad cleanup() { echo echo "Shutting down services" - kill $(jobs -p) + $SUDO kill $(jobs -p) wait } trap cleanup EXIT -# NOTE(bacongobbler): nomad MUST run as root for the exec driver to work on Linux. -# https://github.com/deislabs/hippo/blob/de73ae52d606c0a2351f90069e96acea831281bc/src/Infrastructure/Jobs/NomadJob.cs#L28 -# https://www.nomadproject.io/docs/drivers/exec#client-requirements -case "$OSTYPE" in - linux*) SUDO="sudo --preserve-env=PATH" ;; - *) SUDO= ;; -esac - # change to the directory of this script cd "$(dirname "${BASH_SOURCE[0]}")"