run.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/sh
  2. rm -rf /tmp/m1.data /tmp/m2.data /tmp/m3.data
  3. /etc/init.d/bind9 start
  4. # get rid of hosts so go lookup won't resolve 127.0.0.1 to localhost
  5. cat /dev/null >/etc/hosts
  6. goreman -f /certs/Procfile start &
  7. # TODO: remove random sleeps
  8. sleep 7s
  9. ETCDCTL_API=3 ./etcdctl \
  10. --cacert=/certs/ca.crt \
  11. --cert=/certs/server.crt \
  12. --key=/certs/server.key.insecure \
  13. --endpoints=https://m1.etcd.local:2379 \
  14. endpoint health --cluster
  15. ETCDCTL_API=3 ./etcdctl \
  16. --cacert=/certs/ca.crt \
  17. --cert=/certs/server.crt \
  18. --key=/certs/server.key.insecure \
  19. --endpoints=https://m1.etcd.local:2379,https://m2.etcd.local:22379,https://m3.etcd.local:32379 \
  20. put abc def
  21. ETCDCTL_API=3 ./etcdctl \
  22. --cacert=/certs/ca.crt \
  23. --cert=/certs/server.crt \
  24. --key=/certs/server.key.insecure \
  25. --endpoints=https://m1.etcd.local:2379,https://m2.etcd.local:22379,https://m3.etcd.local:32379 \
  26. get abc
  27. printf "\nWriting v2 key...\n"
  28. curl -L https://127.0.0.1:2379/v2/keys/queue \
  29. --cacert /certs/ca.crt \
  30. --cert /certs/server.crt \
  31. --key /certs/server.key.insecure \
  32. -X POST \
  33. -d value=data
  34. printf "\nWriting v2 key...\n"
  35. curl -L https://m1.etcd.local:2379/v2/keys/queue \
  36. --cacert /certs/ca.crt \
  37. --cert /certs/server.crt \
  38. --key /certs/server.key.insecure \
  39. -X POST \
  40. -d value=data
  41. printf "\nWriting v3 key...\n"
  42. curl -L https://127.0.0.1:2379/v3/kv/put \
  43. --cacert /certs/ca.crt \
  44. --cert /certs/server.crt \
  45. --key /certs/server.key.insecure \
  46. -X POST \
  47. -d '{"key": "Zm9v", "value": "YmFy"}'
  48. printf "\n\nWriting v3 key...\n"
  49. curl -L https://m1.etcd.local:2379/v3/kv/put \
  50. --cacert /certs/ca.crt \
  51. --cert /certs/server.crt \
  52. --key /certs/server.key.insecure \
  53. -X POST \
  54. -d '{"key": "Zm9v", "value": "YmFy"}'
  55. printf "\n\nReading v3 key...\n"
  56. curl -L https://m1.etcd.local:2379/v3/kv/range \
  57. --cacert /certs/ca.crt \
  58. --cert /certs/server.crt \
  59. --key /certs/server.key.insecure \
  60. -X POST \
  61. -d '{"key": "Zm9v"}'
  62. printf "\n\nFetching 'curl https://m1.etcd.local:2379/metrics'...\n"
  63. curl \
  64. --cacert /certs/ca.crt \
  65. --cert /certs/server.crt \
  66. --key /certs/server.key.insecure \
  67. -L https://m1.etcd.local:2379/metrics | grep Put | tail -3
  68. printf "\n\nDone!!!\n\n"