You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.3 KiB

  1. #! /bin/bash
  2. set -eux
  3. # Take IP version as parameter
  4. IPV="${1:-4}"
  5. # Get the directory of where this script is.
  6. SOURCE="${BASH_SOURCE[0]}"
  7. while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
  8. DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  9. # Enable IPv6 support in Docker daemon
  10. if [[ "$IPV" == "6" ]]; then
  11. echo
  12. echo "* [$(date +"%T")] enabling IPv6 stack in Docker daemon"
  13. cat <<'EOF' | sudo tee /etc/docker/daemon.json
  14. {
  15. "ipv6": true,
  16. "fixed-cidr-v6": "2001:db8:1::/64"
  17. }
  18. EOF
  19. sudo service docker restart
  20. fi
  21. LOGS_DIR="$DIR/logs"
  22. echo
  23. echo "* [$(date +"%T")] cleaning up $LOGS_DIR"
  24. rm -rf "$LOGS_DIR"
  25. mkdir -p "$LOGS_DIR"
  26. set +e
  27. echo
  28. echo "* [$(date +"%T")] removing run_test container"
  29. docker rm -vf run_test
  30. set -e
  31. echo
  32. echo "* [$(date +"%T")] starting rsyslog container"
  33. docker rm -f rsyslog || true
  34. docker run -d -v "$LOGS_DIR:/var/log/" -p 127.0.0.1:5514:514/udp --name rsyslog voxxit/rsyslog
  35. set +u
  36. if [[ "$SKIP_BUILD" == "" ]]; then
  37. echo
  38. echo "* [$(date +"%T")] building docker image"
  39. bash "$DIR/../docker/build.sh"
  40. fi
  41. echo
  42. echo "* [$(date +"%T")] running IPv$IPV p2p tests on a local docker network"
  43. bash "$DIR/../p2p/test.sh" tester $IPV
  44. echo
  45. echo "* [$(date +"%T")] copying log files out of docker container into $LOGS_DIR"
  46. docker cp rsyslog:/var/log $LOGS_DIR