beetle 3.3.2 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +40 -15
- data/RELEASE_NOTES.rdoc +3 -0
- data/Rakefile +2 -2
- data/beetle.gemspec +1 -1
- data/lib/beetle/base.rb +6 -4
- data/lib/beetle/version.rb +1 -1
- data/script/start_rabbit +1 -1
- data/test/beetle/message_test.rb +3 -1
- data/test/test_helper.rb +11 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aceed6177b4f2b7e4d02cb52910ebec0ea0f0fbd90fbf552bc9ddaa49a833bd
|
4
|
+
data.tar.gz: 16a61b5e7384e215a3af25a06c65b43707c25bfc1a46dfd9ee1f4da1c3365acd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9c7acebd383b549f6c6cfca1c0aa19559487db55a3095c89da3e24f3696a6a7d8a77dcb9e05127cc997d165130f766fec22bd7d0aa8de49855c3414b590603b
|
7
|
+
data.tar.gz: 348913abe61bf69f20046b050b17fdc510074016ff3e39c0fe4562bde640b076329c326980fe7fd0ee32428e1748e162f653115da62d4c2e7406219c9bac9d97
|
data/README.rdoc
CHANGED
@@ -55,8 +55,8 @@ windows and execute the following commands:
|
|
55
55
|
|
56
56
|
rake rabbit:start1
|
57
57
|
rake rabbit:start2
|
58
|
-
rake redis:
|
59
|
-
rake redis:
|
58
|
+
rake redis:start:master
|
59
|
+
rake redis:start:slave
|
60
60
|
|
61
61
|
== Prerequisites
|
62
62
|
|
@@ -87,8 +87,6 @@ should suffice.
|
|
87
87
|
== Gem Dependencies
|
88
88
|
|
89
89
|
At runtime, Beetle will use
|
90
|
-
* {uuid4r}[http://github.com/skaes/uuid4r]
|
91
|
-
(which needs ossp-uuid)
|
92
90
|
* {bunny}[http://github.com/ruby-amqp/bunny]
|
93
91
|
* {redis}[http://github.com/redis/redis-rb]
|
94
92
|
* {amqp}[http://github.com/ruby-amqp/amqp]
|
@@ -106,6 +104,8 @@ For tests, you'll need
|
|
106
104
|
* {activerecord}[https://github.com/rails/rails/tree/master/activerecord]
|
107
105
|
* {mysql2}[https://github.com/brianmario/mysql2/]
|
108
106
|
|
107
|
+
Dependencies are managed by bundler.
|
108
|
+
|
109
109
|
== Authors
|
110
110
|
|
111
111
|
{Stefan Kaes}[http://github.com/skaes],
|
@@ -133,22 +133,48 @@ distribution.
|
|
133
133
|
Don't increase the gem version in your pull requests. It will be done after merging the request,
|
134
134
|
to allow merging of pull requests in a flexible order.
|
135
135
|
|
136
|
-
==
|
136
|
+
== Compiling beetle and running tests
|
137
|
+
|
138
|
+
In order to execute the unit tests, you need Ruby, a running rabbitmq server, a running
|
139
|
+
redis-server, a running mysql server and a runnning consul server.
|
140
|
+
|
141
|
+
In addition, beetle ships with a cucumber feature to test the automatic redis failover as
|
142
|
+
an integration test. For this you need a recent Go installation in order to compile the
|
143
|
+
beetle go binary. Just invoke `make` in the top level directory.
|
144
|
+
|
145
|
+
There are two ways to start the required test dependencies: using `docker-compose` or
|
146
|
+
starting the services manually.
|
147
|
+
|
148
|
+
=== Testing with docker-compose
|
149
|
+
|
150
|
+
Open a separate terminal window and run
|
151
|
+
|
152
|
+
docker-compose pull
|
153
|
+
|
154
|
+
followed by
|
137
155
|
|
138
|
-
|
139
|
-
as an integration test.
|
156
|
+
docker-compose up
|
140
157
|
|
141
|
-
|
142
|
-
development
|
158
|
+
This will start mysql, two redis servers, two RabbitMQ instances and a single consul
|
159
|
+
development node.
|
143
160
|
|
144
|
-
|
145
|
-
|
146
|
-
|
161
|
+
Note: make sure to wait until all services are properly started.
|
162
|
+
|
163
|
+
|
164
|
+
== Tesing with locally installed services
|
165
|
+
|
166
|
+
The top level Rakefile comes with targets to start several RabbitMQ instances locally.
|
167
|
+
Make sure the corresponding binaries are in your search path. Open three shell windows and
|
168
|
+
execute the following command:
|
147
169
|
|
148
170
|
rake rabbit:start1
|
149
171
|
|
150
172
|
and
|
151
173
|
|
174
|
+
rake redis:start:master
|
175
|
+
|
176
|
+
as well as
|
177
|
+
|
152
178
|
rake consul:start
|
153
179
|
|
154
180
|
Then you can run the cucumber feature by running:
|
@@ -159,9 +185,8 @@ or
|
|
159
185
|
|
160
186
|
rake cucumber
|
161
187
|
|
162
|
-
|
163
|
-
|
164
|
-
|
188
|
+
Note: Cucumber will automatically run after the unit tests when you run `rake` without
|
189
|
+
arguments.
|
165
190
|
|
166
191
|
|
167
192
|
== How to release a new gem version
|
data/RELEASE_NOTES.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -58,11 +58,11 @@ namespace :rabbit do
|
|
58
58
|
|
59
59
|
desc "start rabbit instance 1"
|
60
60
|
task :start1 do
|
61
|
-
start "rabbit1", 5672, 15672
|
61
|
+
start "rabbit1@localhost", 5672, 15672
|
62
62
|
end
|
63
63
|
desc "start rabbit instance 2"
|
64
64
|
task :start2 do
|
65
|
-
start "rabbit2", 5673, 15673
|
65
|
+
start "rabbit2@localhost", 5673, 15673
|
66
66
|
end
|
67
67
|
desc "reset rabbit instances (deletes all data!)"
|
68
68
|
task :reset do
|
data/beetle.gemspec
CHANGED
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.add_development_dependency "minitest", "~> 5.1"
|
39
39
|
s.add_development_dependency "mocha", "~> 1.3.0"
|
40
40
|
s.add_development_dependency "mysql2", "~> 0.4.4"
|
41
|
-
s.add_development_dependency "rake", "~>
|
41
|
+
s.add_development_dependency "rake", "~> 13.0"
|
42
42
|
s.add_development_dependency "rdoc", "~> 4.0"
|
43
43
|
s.add_development_dependency "simplecov", "~> 0.15"
|
44
44
|
s.add_development_dependency "webmock", "~> 3.0"
|
data/lib/beetle/base.rb
CHANGED
@@ -99,10 +99,12 @@ module Beetle
|
|
99
99
|
payload = options.merge(:server => @server)
|
100
100
|
logger.debug("Beetle: publishing policy options on #{@server}: #{payload.inspect}")
|
101
101
|
# make sure to declare the queue, so the message does not get lost
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
ActiveSupport::Notifications.instrument('publish.beetle') do
|
103
|
+
queue(@client.config.beetle_policy_updates_queue_name)
|
104
|
+
data = payload.to_json
|
105
|
+
opts = Message.publishing_options(:key => @client.config.beetle_policy_updates_routing_key, :persistent => true, :redundant => false)
|
106
|
+
exchange(@client.config.beetle_policy_exchange_name).publish(data, opts)
|
107
|
+
end
|
106
108
|
end
|
107
109
|
|
108
110
|
end
|
data/lib/beetle/version.rb
CHANGED
data/script/start_rabbit
CHANGED
@@ -14,7 +14,7 @@ export RABBITMQ_NODENAME=$1
|
|
14
14
|
# combination. See clustering on a single machine guide at <http://www.rab-
|
15
15
|
# bitmq.com/clustering.html#single-machine> for details.
|
16
16
|
|
17
|
-
export RABBITMQ_NODE_IP_ADDRESS=
|
17
|
+
export RABBITMQ_NODE_IP_ADDRESS=127.0.0.1
|
18
18
|
# Defaults to 0.0.0.0. This can be changed if you only want to bind to one net-
|
19
19
|
# work interface.
|
20
20
|
|
data/test/beetle/message_test.rb
CHANGED
@@ -116,6 +116,7 @@ module Beetle
|
|
116
116
|
class KeyManagementTest < Minitest::Test
|
117
117
|
def setup
|
118
118
|
@config = Configuration.new
|
119
|
+
@config.redis_server = Beetle.config.redis_server
|
119
120
|
@store = DeduplicationStore.new(@config)
|
120
121
|
@store.flushdb
|
121
122
|
@null_handler = Handler.create(lambda {|*args|})
|
@@ -339,6 +340,7 @@ module Beetle
|
|
339
340
|
class SimpleMessageTest < Minitest::Test
|
340
341
|
def setup
|
341
342
|
@config = Configuration.new
|
343
|
+
@config.redis_server = Beetle.config.redis_server
|
342
344
|
@store = DeduplicationStore.new(@config)
|
343
345
|
@store.flushdb
|
344
346
|
end
|
@@ -765,7 +767,7 @@ module Beetle
|
|
765
767
|
username: "root",
|
766
768
|
encoding: "utf8",
|
767
769
|
host: ENV['MYSQL_HOST'] || "127.0.0.1",
|
768
|
-
port: ENV['MYSQL_PORT'] || 3306
|
770
|
+
port: (ENV['MYSQL_PORT'] || 3306).to_i
|
769
771
|
)
|
770
772
|
end
|
771
773
|
|
data/test/test_helper.rb
CHANGED
@@ -27,9 +27,13 @@ end
|
|
27
27
|
I18n.enforce_available_locales = false
|
28
28
|
|
29
29
|
Beetle.config.logger = Logger.new(File.dirname(__FILE__) + '/../test.log')
|
30
|
-
|
31
|
-
Beetle.config.
|
32
|
-
|
30
|
+
if `docker inspect beetle-redis-master -f '{{.State.Status}}'`.chomp == "running"
|
31
|
+
Beetle.config.redis_server = "localhost:6370"
|
32
|
+
Beetle.config.redis_servers = "localhost:6370,localhost:6380"
|
33
|
+
else
|
34
|
+
Beetle.config.redis_server = "localhost:6379"
|
35
|
+
Beetle.config.redis_servers = "localhost:6379,localhost:6380"
|
36
|
+
end
|
33
37
|
|
34
38
|
def header_with_params(opts = {})
|
35
39
|
beetle_headers = Beetle::Message.publishing_options(opts)
|
@@ -46,3 +50,7 @@ def redis_stub(name, opts = {})
|
|
46
50
|
opts = {'host' => default_host, 'port' => default_port, 'server' => "#{default_host}:#{default_port}"}.update(opts)
|
47
51
|
stub(name, opts)
|
48
52
|
end
|
53
|
+
|
54
|
+
if `docker inspect beetle-mysql -f '{{.State.Status}}'`.chomp == "running"
|
55
|
+
ENV['MYSQL_PORT'] = '6612'
|
56
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beetle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kaes
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2020-04-06 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bunny
|
@@ -216,14 +216,14 @@ dependencies:
|
|
216
216
|
requirements:
|
217
217
|
- - "~>"
|
218
218
|
- !ruby/object:Gem::Version
|
219
|
-
version: '
|
219
|
+
version: '13.0'
|
220
220
|
type: :development
|
221
221
|
prerelease: false
|
222
222
|
version_requirements: !ruby/object:Gem::Requirement
|
223
223
|
requirements:
|
224
224
|
- - "~>"
|
225
225
|
- !ruby/object:Gem::Version
|
226
|
-
version: '
|
226
|
+
version: '13.0'
|
227
227
|
- !ruby/object:Gem::Dependency
|
228
228
|
name: rdoc
|
229
229
|
requirement: !ruby/object:Gem::Requirement
|
@@ -375,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
375
375
|
- !ruby/object:Gem::Version
|
376
376
|
version: 1.3.7
|
377
377
|
requirements: []
|
378
|
-
rubygems_version: 3.0.
|
378
|
+
rubygems_version: 3.0.8
|
379
379
|
signing_key:
|
380
380
|
specification_version: 3
|
381
381
|
summary: High Availability AMQP Messaging with Redundant Queues
|