setup.sh 971 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. set -e # NB don't set -u, as weave's config.sh doesn't like that.
  3. # shellcheck disable=SC1091
  4. . ./config.sh
  5. echo Copying scope images and scripts to hosts
  6. # shellcheck disable=SC2153
  7. for HOST in $HOSTS; do
  8. SIZE=$(stat --printf="%s" ../scope.tar)
  9. pv -N "scope.tar" -s "$SIZE" ../scope.tar | $SSH -C "$HOST" sudo docker load
  10. done
  11. setup_host() {
  12. local HOST=$1
  13. echo Installing weave on "$HOST"
  14. # Download the latest released weave script locally,
  15. # for use by weave_on
  16. curl -sL git.io/weave -o ./weave
  17. chmod a+x ./weave
  18. run_on "$HOST" "sudo curl -sL git.io/weave -o /usr/local/bin/weave"
  19. run_on "$HOST" "sudo chmod a+x /usr/local/bin/weave"
  20. weave_on "$HOST" setup
  21. echo Prefetching Images on "$HOST"
  22. docker_on "$HOST" pull peterbourgon/tns-db
  23. docker_on "$HOST" pull alpine
  24. docker_on "$HOST" pull busybox
  25. docker_on "$HOST" pull nginx
  26. }
  27. for HOST in $HOSTS; do
  28. setup_host "$HOST" &
  29. done
  30. wait