Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. files:
  2. "/opt/rabbitmq.sh":
  3. mode: "000755"
  4. owner: root
  5. group: root
  6. content: |
  7. # call "rabbitmqctl stop" when exiting
  8. trap "{ echo Stopping rabbitmq; rabbitmqctl stop; exit 0; }" TERM
  9.  
  10. echo Starting rabbitmq
  11. sudo rabbitmq-server &
  12. PID=$!
  13. wait $PID
  14. "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh":
  15. mode: "000755"
  16. owner: root
  17. group: root
  18. content: |
  19. #!/usr/bin/env bash
  20. # Create rabbitmq configuration script
  21. rabbitmqconf="[program:rabbitmq]
  22. command=/bin/sh /opt/rabbitmq.sh
  23. user=root
  24. numprocs=1
  25. stdout_logfile=/opt/python/log/rabbitmqstdout.log
  26. stderr_logfile=/opt/python/log/rabbitmqstderr.log
  27. autostart=true
  28. autorestart=true
  29. killasgroup=true
  30. ; if rabbitmq is supervised, set its priority higher
  31. ; so it starts first
  32. priority=990"
  33. # Create the rabbitmq supervisord conf script
  34. echo "$rabbitmqconf" | tee /opt/python/etc/rabbitmq.conf
  35. # Add configuration script to supervisord conf (if not there already)
  36. if ! grep -Fxq "[include]" /opt/python/etc/supervisord.conf
  37. then
  38. echo "[include]" | tee -a /opt/python/etc/supervisord.conf
  39. echo "files: rabbitmq.conf" | tee -a /opt/python/etc/supervisord.conf
  40. fi
  41. # Reread the supervisord config
  42. /usr/local/bin/supervisorctl -c /opt/python/etc/supervisord.conf reread
  43. # Update supervisord in cache without restarting all services
  44. /usr/local/bin/supervisorctl -c /opt/python/etc/supervisord.conf update
  45. # Start/Restart rabbitmq through supervisord
  46. /usr/local/bin/supervisorctl -c /opt/python/etc/supervisord.conf start rabbitmq
  47. "/opt/elasticbeanstalk/hooks/appdeploy/pre/00_stop_rabbitmq.sh":
  48. mode: "000755"
  49. owner: root
  50. group: root
  51. content: |
  52. #!/usr/bin/env bash
  53. # Check for supervisord rabbitmq config
  54. if [[ -f /opt/python/etc/rabbitmq.conf ]]
  55. then
  56. # Attempt to stop Rabbit
  57. /usr/local/bin/supervisorctl -c /opt/python/etc/supervisord.conf stop rabbitmq
  58. fi
  59. "/opt/elasticbeanstalk/hooks/configdeploy/pre/00_stop_rabbitmq.sh":
  60. mode: "120400"
  61. content: "/opt/elasticbeanstalk/hooks/appdeploy/pre/00_stop_rabbitmq.sh"
  62. "/opt/elasticbeanstalk/hooks/configdeploy/post/99_run_supervised_rabbitmq.sh":
  63. mode: "120400"
  64. content: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
  65. "/opt/elasticbeanstalk/hooks/postinit/99_run_supervised_rabbitmq.sh":
  66. mode: "120400"
  67. content: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
  68. "/opt/elasticbeanstalk/hooks/postinitreboot/99_run_supervised_rabbitmq.sh":
  69. mode: "120400"
  70. content: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
  71. "/opt/elasticbeanstalk/hooks/restartappserver/pre/00_stop_rabbitmq.sh":
  72. mode: "120400"
  73. content: "/opt/elasticbeanstalk/hooks/appdeploy/pre/00_stop_rabbitmq.sh"
  74. "/opt/elasticbeanstalk/hooks/restartappserver/post/99_run_supervised_rabbitmq.sh":
  75. mode: "120400"
  76. content: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
  77. commands:
  78. 00_fix_perms:
  79. command: "chmod 755 /opt/elasticbeanstalk/hooks/appdeploy/pre/00_stop_rabbitmq.sh /opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
  80. 01_rabbitmq_install:
  81. command: sudo yum -y --enablerepo=epel install rabbitmq-server librabbitmq-devel
  82. 02_rabbitmq_start:
  83. command: sudo service rabbitmq-server start
  84. 04_rabbitmq_management:
  85. command: export HOME=/var/lib/rabbitmq/ && rabbitmqctl -n rabbit add_user ygagadmin hbtventures && rabbitmqctl -n rabbit set_user_tags ygagadmin administrator
  86. ignoreErrors: true
  87. 05_rabbitmq_management:
  88. command: rabbitmqctl -n rabbit set_permissions -p / ygagadmin ".*" ".*" ".*"
  89. ignoreErrors: true
  90. 06_rabbitmq_management:
  91. command: rabbitmqctl -n rabbit delete_user guest
  92. ignoreErrors: true
  93. 07_rabbitmq_restart:
  94. command: service rabbitmq-server restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement