Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(local): Kill processes as root #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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