Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[services-ng] upgrade rabbitmq to 3.0

  • Loading branch information...
commit b7b402fe87f0503ab47fb190ce5e68919b996ad8 1 parent 59679e1
@EagleChen EagleChen authored
View
4 config/blobs.yml
@@ -443,6 +443,10 @@ rabbitmq/rabbitmq-server-with-plugins-generic-unix-2.8.7.tar.gz:
object_id: eyJvaWQiOiI0ZTRlNzhiY2EyMWUxMjIyMDRlNGU5ODYzOTI2YjEwNTA5MGQ2%0AYzUzNDc5NCIsInNpZyI6IlFJVjA0TDA5ZlZqZUlZeUNGcHZaMU4zclgxND0i%0AfQ==%0A
sha: 23db4c0fb8a43a0131f8e909c2821aaf85ea410b
size: 2894762
+rabbitmq/rabbitmq-server-with-plugins-generic-unix-3.0.4.tar.gz:
+ object_id: eyJvaWQiOiI0ZTRlNzhiY2ExMWUxMjEyMDRlNGU4NmVlMTUyOTQwNTE0OTE1%0ANmM5ZTVmZiIsInNpZyI6IjNlUSt5VnFGbFcrVlFSLzZTdGxkUGUvdXlTVT0i%0AfQ==%0A
+ sha: 70ea6912251056f49d7bf2a94f1ea5852d0518ca
+ size: 3570257
nats/vendor/cache/json_pure-1.6.5.gem:
object_id: eyJvaWQiOiI0ZTRlNzhiY2E0MWUxMjIyMDRlNGU5ODYzZDA3NjMwNGY1MjVm%0AMDAxYjZkMSIsInNpZyI6Imh1ZGFBVUk1V1VzaE5jU01UQnE5andIaCtBVT0i%0AfQ==%0A
sha: 739c40b6acebe9b7b3fdcaf3ff6bd4600ce3dcfb
View
4 jobs/rabbit_node_ng/spec
@@ -19,13 +19,15 @@ templates:
rabbit_worker.yml.erb: config/rabbit_worker.yml
rabbit_worker_ctl: bin/rabbit_worker_ctl
- backup_or_restore.escript: bin/backup_or_restore.escript
+ backup_or_restore2.escript: bin/backup_or_restore2.escript
+ backup_or_restore3.escript: bin/backup_or_restore3.escript
packages:
- common
- erlang
- rabbitmq-2.4
- rabbitmq-2.8
+ - rabbitmq-3.0
- daylimit
- ruby
- ruby_next
View
0  ...abbit_node_ng/templates/backup_or_restore.escript → ...bbit_node_ng/templates/backup_or_restore2.escript
File renamed without changes
View
44 jobs/rabbit_node_ng/templates/backup_or_restore3.escript
@@ -0,0 +1,44 @@
+#!/usr/bin/env escript
+
+%%! -sname backup
+
+-record(amqqueue, {name, durable, auto_delete, exclusive_owner, arguments, pid, slave_pids, sync_slave_pids, policy, gm_pids}).
+-record(exchange, {name, type, durable, auto_delete, internal, arguments, scratches, policy}).
+
+%% Mnesia restore only recover the db info for the queues and exchanges of rabbit, to make these queues and exchanges work, we still
+%% need to redeclare these old items after clear its mnesia record info
+main([Type, Name, Backup]) ->
+if Type == "restore" ->
+ Host = lists:concat([Name, "@localhost"]),
+ %% Restore the mnesia database
+ rpc:call(list_to_atom(Host), mnesia, restore, [Backup, []]),
+
+ %% Get queues and exchanges info from restored db
+ Queues = rpc:call(list_to_atom(Host), mnesia, dirty_select, [rabbit_durable_queue, [{#amqqueue{name='$1', durable='$2', auto_delete='$3', arguments='$4', _='_'}, [], ['$$']}]]),
+ Exchanges = rpc:call(list_to_atom(Host), mnesia, dirty_select, [rabbit_durable_exchange, [{#exchange{name='$1', type='$2', durable='$3', auto_delete='$4', internal='$5', arguments='$6', _='_'}, [], ['$$']}]]),
+
+ %% Remove all the queues and exchanges info in db
+ Fdel = fun() ->
+ QueueKeys = mnesia:all_keys(rabbit_durable_queue),
+ lists:foreach(
+ fun(Key) -> mnesia:delete(rabbit_durable_queue, Key, write) end,
+ QueueKeys),
+ ExchangeKeys = mnesia:all_keys(rabbit_durable_exchange),
+ lists:foreach(
+ fun(Key) -> mnesia:delete(rabbit_durable_exchange, Key, write) end,
+ ExchangeKeys)
+ end,
+ rpc:call(list_to_atom(Host), mnesia, transaction, [Fdel]),
+
+ %% Redeclare old queues and exchanges
+ lists:foreach(fun(Queue) ->
+ rpc:call(list_to_atom(Host), rabbit_amqqueue, declare, lists:append(Queue, [none])) end,
+ Queues),
+ lists:foreach(fun(Exchange) ->
+ rpc:call(list_to_atom(Host), rabbit_exchange, declare, Exchange) end,
+ Exchanges);
+ Type == "backup" ->
+ Host = lists:concat([Name, "@localhost"]),
+ %% Backup the mnesia database
+ rpc:call(list_to_atom(Host), mnesia, backup, [Backup])
+end.
View
4 jobs/rabbit_node_ng/templates/rabbit_node.yml.erb
@@ -33,6 +33,9 @@ rabbit:
'2.8':
config_template: ../../../resources/rabbitmq28.config.erb
disk_free_limit: <%= ((plan_enabled && plan_conf.max_disk || 128) * 1024 * 1024 * (plan_enabled && plan_conf.free_disk_low_water || 0.1).to_f).to_i %>
+ '3.0':
+ config_template: ../../../resources/rabbitmq30.config.erb
+ disk_free_limit: <%= ((plan_enabled && plan_conf.max_disk || 128) * 1024 * 1024 * (plan_enabled && plan_conf.free_disk_low_water || 0.1).to_f).to_i %>
migration_nfs: <%= properties.service_migration && properties.service_migration.mount_point ? properties.service_migration.mount_point : "/var/vcap/services_migration" %>
<% if node.ip_route %>
ip_route: <%= node.ip_route %>
@@ -52,6 +55,7 @@ service_start_timeout: <%= node.service_start_timeout || 5 %>
service_bin_dir:
'2.4': /var/vcap/packages/rabbitmq-2.4
'2.8': /var/vcap/packages/rabbitmq-2.8
+ '3.0': /var/vcap/packages/rabbitmq-3.0
erlang: /var/vcap/packages/erlang
service_common_dir: /var/vcap/store/rabbitmq_common
fqdn_hosts: <%= properties.services && properties.services.fqdn_hosts || "false" %>
View
2  jobs/rabbit_node_ng/templates/rabbit_node_ctl
@@ -37,7 +37,7 @@ case $1 in
mkdir -p $COMMON_DIR/bin
rsync -arl $JOB_DIR/bin/warden_service_ctl $COMMON_DIR/bin
- rsync -arl $JOB_DIR/bin/backup_or_restore.escript $COMMON_DIR/bin
+ rsync -arl $JOB_DIR/bin/backup_or_restore*.escript $COMMON_DIR/bin
rsync -arl /var/vcap/packages/common/utils.sh $COMMON_DIR/bin
chmod -R 755 $COMMON_DIR/bin
View
1  jobs/rabbit_node_ng/templates/rabbit_worker.yml.erb
@@ -15,6 +15,7 @@ service_log_dir: /var/vcap/sys/service-log/rabbit
service_bin_dir:
'2.4': /var/vcap/packages/rabbitmq-2.4
'2.8': /var/vcap/packages/rabbitmq-2.8
+ '3.0': /var/vcap/packages/rabbitmq-3.0
erlang: /var/vcap/packages/erlang
image_dir: /var/vcap/store/rabbitmq_image
snapshots_base_dir: <%= snapshot_dir %>
View
6 packages/rabbitmq-3.0/packaging
@@ -0,0 +1,6 @@
+# abort script on any command that exit with a non zero value
+set -e
+
+tar xzf rabbitmq/rabbitmq-server-with-plugins-generic-unix-3.0.4.tar.gz
+cd rabbitmq_server-3.0.4
+cp -a * ${BOSH_INSTALL_TARGET}
View
4 packages/rabbitmq-3.0/spec
@@ -0,0 +1,4 @@
+---
+name: rabbitmq-3.0
+files:
+- rabbitmq/rabbitmq-server-with-plugins-generic-unix-3.0.4.tar.gz
Please sign in to comment.
Something went wrong with that request. Please try again.