client.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. 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