Skip to content

Commit

Permalink
Update docker scripts for newer Docker/Debian
Browse files Browse the repository at this point in the history
- On Mac `/bin/echo -e "<control chars>"` prints out `-e <uninterpreted
  control chars>` to the terminal. This seems to happen in the latest
  Debian image too. Use `printf` for compatibility across both and
  proper colouration.
- Check that `POSITIONAL` has some elements before trying to `set` with
  it, to avoid `unbound variable` error with `set -o nounset`.
- Remove cgroup sharing from host, and make container privileged, to
  allow nodes to spin up with cgroupv2. Docker > 20.10 will
  automatically create a private cgroup slice in this case.
  • Loading branch information
dancmeyers committed Jan 20, 2022
1 parent 781b41d commit 25b2bd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions docker/bin/up
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ set -o nounset
# set -o xtrace

ERROR() {
/bin/echo -e "\e[101m\e[97m[ERROR]\e[49m\e[39m" "$@"
printf "\e[101m\e[97m[ERROR]\e[49m\e[39m %s\n" "$@"
}

WARNING() {
/bin/echo -e "\e[101m\e[97m[WARNING]\e[49m\e[39m" "$@"
printf "\e[101m\e[97m[WARNING]\e[49m\e[39m %s\n" "$@"
}

INFO() {
/bin/echo -e "\e[104m\e[97m[INFO]\e[49m\e[39m" "$@"
printf "\e[104m\e[97m[INFO]\e[49m\e[39m %s\n" "$@"
}

exists() {
Expand Down Expand Up @@ -83,7 +83,9 @@ do
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [ "${#POSITIONAL[@]}" -gt 0 ]; then
set -- "${POSITIONAL[@]}" # restore positional parameters
fi

if [ "${HELP}" -eq 1 ]; then
echo "Usage: $0 [OPTION]"
Expand Down
2 changes: 1 addition & 1 deletion docker/template/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ x-node:
- /run:size=100M
- /run/lock:size=100M
volumes:
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
- "jepsen-shared:/var/jepsen/shared"
networks:
- jepsen
privileged: true
cap_add:
- ALL
ports:
Expand Down

0 comments on commit 25b2bd7

Please sign in to comment.