Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- files:
- "/opt/rabbitmq.sh":
- mode: "000755"
- owner: root
- group: root
- content: |
- # call "rabbitmqctl stop" when exiting
- trap "{ echo Stopping rabbitmq; rabbitmqctl stop; exit 0; }" TERM
- echo Starting rabbitmq
- sudo rabbitmq-server &
- PID=$!
- wait $PID
- "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh":
- mode: "000755"
- owner: root
- group: root
- content: |
- #!/usr/bin/env bash
- # Create rabbitmq configuration script
- rabbitmqconf="[program:rabbitmq]
- command=/bin/sh /opt/rabbitmq.sh
- user=root
- numprocs=1
- stdout_logfile=/opt/python/log/rabbitmqstdout.log
- stderr_logfile=/opt/python/log/rabbitmqstderr.log
- autostart=true
- autorestart=true
- killasgroup=true
- ; if rabbitmq is supervised, set its priority higher
- ; so it starts first
- priority=990"
- # Create the rabbitmq supervisord conf script
- echo "$rabbitmqconf" | tee /opt/python/etc/rabbitmq.conf
- # Add configuration script to supervisord conf (if not there already)
- if ! grep -Fxq "[include]" /opt/python/etc/supervisord.conf
- then
- echo "[include]" | tee -a /opt/python/etc/supervisord.conf
- echo "files: rabbitmq.conf" | tee -a /opt/python/etc/supervisord.conf
- fi
- # Reread the supervisord config
- /usr/local/bin/supervisorctl -c /opt/python/etc/supervisord.conf reread
- # Update supervisord in cache without restarting all services
- /usr/local/bin/supervisorctl -c /opt/python/etc/supervisord.conf update
- # Start/Restart rabbitmq through supervisord
- /usr/local/bin/supervisorctl -c /opt/python/etc/supervisord.conf start rabbitmq
- "/opt/elasticbeanstalk/hooks/appdeploy/pre/00_stop_rabbitmq.sh":
- mode: "000755"
- owner: root
- group: root
- content: |
- #!/usr/bin/env bash
- # Check for supervisord rabbitmq config
- if [[ -f /opt/python/etc/rabbitmq.conf ]]
- then
- # Attempt to stop Rabbit
- /usr/local/bin/supervisorctl -c /opt/python/etc/supervisord.conf stop rabbitmq
- fi
- "/opt/elasticbeanstalk/hooks/configdeploy/pre/00_stop_rabbitmq.sh":
- mode: "120400"
- content: "/opt/elasticbeanstalk/hooks/appdeploy/pre/00_stop_rabbitmq.sh"
- "/opt/elasticbeanstalk/hooks/configdeploy/post/99_run_supervised_rabbitmq.sh":
- mode: "120400"
- content: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
- "/opt/elasticbeanstalk/hooks/postinit/99_run_supervised_rabbitmq.sh":
- mode: "120400"
- content: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
- "/opt/elasticbeanstalk/hooks/postinitreboot/99_run_supervised_rabbitmq.sh":
- mode: "120400"
- content: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
- "/opt/elasticbeanstalk/hooks/restartappserver/pre/00_stop_rabbitmq.sh":
- mode: "120400"
- content: "/opt/elasticbeanstalk/hooks/appdeploy/pre/00_stop_rabbitmq.sh"
- "/opt/elasticbeanstalk/hooks/restartappserver/post/99_run_supervised_rabbitmq.sh":
- mode: "120400"
- content: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
- commands:
- 00_fix_perms:
- command: "chmod 755 /opt/elasticbeanstalk/hooks/appdeploy/pre/00_stop_rabbitmq.sh /opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_rabbitmq.sh"
- 01_rabbitmq_install:
- command: sudo yum -y --enablerepo=epel install rabbitmq-server librabbitmq-devel
- 02_rabbitmq_start:
- command: sudo service rabbitmq-server start
- 04_rabbitmq_management:
- command: export HOME=/var/lib/rabbitmq/ && rabbitmqctl -n rabbit add_user ygagadmin hbtventures && rabbitmqctl -n rabbit set_user_tags ygagadmin administrator
- ignoreErrors: true
- 05_rabbitmq_management:
- command: rabbitmqctl -n rabbit set_permissions -p / ygagadmin ".*" ".*" ".*"
- ignoreErrors: true
- 06_rabbitmq_management:
- command: rabbitmqctl -n rabbit delete_user guest
- ignoreErrors: true
- 07_rabbitmq_restart:
- command: service rabbitmq-server restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement