Skip to content

Commit

Permalink
fix(local): Kill processes as root
Browse files Browse the repository at this point in the history
Fixes: fermyon#49
  • Loading branch information
adamreese committed Jun 15, 2022
1 parent a02877a commit 2bf2c2c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions local/start.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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]}")"

Expand Down

0 comments on commit 2bf2c2c

Please sign in to comment.