forked from ruby-amqp/bunny
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbefore_build
executable file
·46 lines (29 loc) · 1.73 KB
/
before_build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env ruby
$ctl = ENV["BUNNY_RABBITMQCTL"] || ENV["RABBITMQCTL"] || "sudo rabbitmqctl"
$plugins = ENV["BUNNY_RABBITMQ_PLUGINS"] || ENV["RABBITMQ_PLUGINS"] || "sudo rabbitmq-plugins"
def rabbit_control(args)
command = "#{$ctl} #{args}"
system command
end
def rabbit_plugins(args)
command = "#{$plugins} #{args}"
system command
end
# guest:guest has full access to /
rabbit_control 'add_vhost /'
rabbit_control 'add_user guest guest'
rabbit_control 'set_permissions -p / guest ".*" ".*" ".*"'
# bunny_gem:bunny_password has full access to bunny_testbed
rabbit_control 'add_vhost bunny_testbed'
rabbit_control 'add_user bunny_gem bunny_password'
rabbit_control 'set_permissions -p bunny_testbed bunny_gem ".*" ".*" ".*"'
# guest:guest has full access to bunny_testbed
rabbit_control 'set_permissions -p bunny_testbed guest ".*" ".*" ".*"'
# bunny_reader:reader_password has read access to bunny_testbed
rabbit_control 'add_user bunny_reader reader_password'
rabbit_control 'set_permissions -p bunny_testbed bunny_reader "^---$" "^---$" ".*"'
# requires RabbitMQ 3.0+
# rabbit_plugins 'enable rabbitmq_management'
# Reduce retention policy for faster publishing of stats
rabbit_control "eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), application:set_env(rabbitmq_management, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_sup_sup:start_child().'"
rabbit_control "eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().'"