Guest User

Untitled

a guest
Dec 8th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. require 'erb'
  2.  
  3. # Setup variables
  4. monit_path = "/usr/bin/monit"
  5. tor_path = "/usr/bin/tor"
  6. delegated_path = "/usr/local/bin/delegated"
  7. haproxy_path = "/usr/local/bin/haproxy"
  8. install_path = "/Users/mauroasprea/rotating-tors"
  9. user = "username"
  10. email = "email@example.com" # where moint and delegated will send mails.
  11. tors_count = 4
  12. haproxy_port = 3128
  13. delegated_base_port = 3129
  14. tor_base_port = 9050
  15. tor_control_base_port = 8118
  16.  
  17. # Optional: setup gmail smtp for monit outgoing alerts
  18. gmail_username = "email@gmail.com"
  19. gmail_password = "password"
  20.  
  21. # Prepare paths
  22. `mkdir -p #{install_path}/etc`
  23. `mkdir -p #{install_path}/caches`
  24. `mkdir -p #{install_path}/pids`
  25.  
  26. # haproxy.cfg
  27. c = ERB.new(File.read("haproxy.cfg.erb"))
  28. File.write("#{install_path}/etc/haproxy.cfg", c.result(binding))
  29. `chmod 600 #{install_path}/etc/haproxy.cfg`
  30.  
  31. # monitrc
  32. c = ERB.new(File.read('monitrc.erb'))
  33. File.write("#{install_path}/etc/monitrc", c.result(binding))
  34. `chmod 600 #{install_path}/etc/monitrc`
Add Comment
Please, Sign In to add comment