bootstrap.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/usr/bin/env bash
  2. #
  3. # Prepares a virtual machine for running TFB
  4. # A shell provisioner is called multiple times
  5. if [ ! -e "~/.firstboot" ]; then
  6. # Workaround mitchellh/vagrant#289
  7. echo "grub-pc grub-pc/install_devices multiselect /dev/sda" | sudo debconf-set-selections
  8. # Install prerequisite tools
  9. echo "Installing prerequisites"
  10. sudo apt-get update
  11. sudo apt-get install -y git
  12. git config --global core.autocrlf input
  13. # Setting up ssh & passwordless sudo
  14. ssh-keygen -f /home/vagrant/.ssh/id_rsa -N '' -t rsa
  15. cat /home/vagrant/.ssh/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys
  16. chmod og-wx /home/vagrant/.ssh/authorized_keys
  17. echo "NoHostAuthenticationForLocalhost yes" | tee -a /home/vagrant/.ssh/config
  18. chmod 600 ~/.ssh/config
  19. echo "vagrant ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
  20. # Setting up hosts aliases
  21. echo 127.0.0.1 TFB-database | sudo tee --append /etc/hosts
  22. echo 127.0.0.1 TFB-client | sudo tee --append /etc/hosts
  23. echo 127.0.0.1 TFB-server | sudo tee --append /etc/hosts
  24. # Setting up new FWROOT
  25. export FWROOT="/home/vagrant/FrameworkBenchmarks"
  26. echo `export FWROOT="/home/vagrant/FrameworkBenchmarks"` >> ~/.bashrc
  27. sudo chown vagrant:vagrant ~/FrameworkBenchmarks
  28. cd ~/FrameworkBenchmarks
  29. # Set up the benchmark.cfg for vagrant user
  30. cat <<EOF > benchmark.cfg
  31. [Defaults]
  32. # Available Keys:
  33. os=linux
  34. server_host=TFB-server
  35. client_host=TFB-client
  36. client_identity_file=/home/vagrant/.ssh/id_rsa
  37. client_user=vagrant
  38. database_host=TFB-database
  39. database_identity_file=/home/vagrant/.ssh/id_rsa
  40. database_os=linux
  41. database_user=vagrant
  42. duration=60
  43. exclude=None
  44. install=server
  45. install_error_action=continue
  46. install_strategy=unified
  47. install_only=False
  48. list_tests=False
  49. concurrency_levels=[8, 16, 32, 64, 128, 256]
  50. query_levels=[1, 5,10,15,20]
  51. threads=8
  52. mode=benchmark
  53. sleep=60
  54. test=None
  55. type=all
  56. verbose=True
  57. clean=False
  58. clean_all=False
  59. EOF
  60. source ./toolset/setup/linux/prerequisites.sh
  61. # Setup a nice welcome message for our guest
  62. echo "Setting up welcome message"
  63. sudo rm -f /etc/update-motd.d/51-cloudguest
  64. sudo rm -f /etc/update-motd.d/98-cloudguest
  65. sudo cat <<EOF > motd
  66. Welcome to the FrameworkBenchmarks project!
  67. To get started, perhaps try this:
  68. $ cd FrameworkBenchmarks
  69. You can get lots of help:
  70. $ tfb --help
  71. You can run a test like:
  72. $ tfb --mode verify --test gemini
  73. This Vagrant environment is already setup and ready to go.
  74. EOF
  75. sudo mv motd /etc/
  76. fi