client.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. export DB_HOST={database_host}
  3. set -x
  4. export DEBIAN_FRONTEND=noninteractive
  5. ##############################
  6. # Prerequisites
  7. ##############################
  8. # WARNING: DONT PUT A SPACE AFTER ANY BACKSLASH OR APT WILL BREAK
  9. # Dpkg::Options avoid hangs on Travis-CI, don't affect clean systems
  10. sudo apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
  11. build-essential git libev-dev libpq-dev libreadline6-dev
  12. sudo sh -c "echo '* - nofile 65535' >> /etc/security/limits.conf"
  13. ##############################
  14. # wrk
  15. ##############################
  16. git clone https://github.com/wg/wrk.git
  17. cd wrk
  18. git checkout 205a1960c8b8de5f500bb143863ae293456b7add
  19. make
  20. sudo cp wrk /usr/local/bin
  21. cd ~
  22. #############################
  23. # pipeline.lua
  24. #############################
  25. cat << EOF | tee pipeline.lua
  26. init = function(args)
  27. wrk.init(args)
  28. local r = {}
  29. local depth = tonumber(args[1]) or 1
  30. for i=1,depth do
  31. r[i] = wrk.format()
  32. end
  33. req = table.concat(r)
  34. end
  35. request = function()
  36. return req
  37. end
  38. EOF