client.sh 1.1 KB

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