gorgon 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -2
- data/.rspec +2 -0
- data/.travis.yml +10 -0
- data/Dockerfile +25 -0
- data/Gemfile.lock +20 -15
- data/README.md +33 -6
- data/Rakefile +5 -0
- data/architecture.md +2 -2
- data/bin/gorgon +2 -114
- data/daemon_with_upstart_and_rvm.md +1 -1
- data/docker-compose.yml +28 -0
- data/file_server/Dockerfile +8 -0
- data/file_server/test_gorgon.pem.pub +1 -0
- data/gorgon.gemspec +2 -2
- data/gorgon_secret.json.sample +5 -0
- data/lib/gorgon/amqp_service.rb +28 -26
- data/lib/gorgon/callback_handler.rb +28 -26
- data/lib/gorgon/colors.rb +6 -4
- data/lib/gorgon/command.rb +145 -0
- data/lib/gorgon/configuration.rb +45 -5
- data/lib/gorgon/core_ext/hash/deep_merge.rb +21 -0
- data/lib/gorgon/crash_reporter.rb +15 -13
- data/lib/gorgon/failures_printer.rb +27 -26
- data/lib/gorgon/g_logger.rb +19 -17
- data/lib/gorgon/gem_command_handler.rb +41 -39
- data/lib/gorgon/gem_service.rb +60 -57
- data/lib/gorgon/host_state.rb +23 -21
- data/lib/gorgon/job.rb +19 -17
- data/lib/gorgon/job_definition.rb +23 -21
- data/lib/gorgon/job_state.rb +93 -90
- data/lib/gorgon/listener.rb +137 -146
- data/lib/gorgon/listener_installer.rb +98 -96
- data/lib/gorgon/originator.rb +170 -167
- data/lib/gorgon/originator_logger.rb +30 -28
- data/lib/gorgon/originator_protocol.rb +85 -83
- data/lib/gorgon/ping_service.rb +44 -42
- data/lib/gorgon/pipe_forker.rb +17 -15
- data/lib/gorgon/progress_bar_view.rb +109 -107
- data/lib/gorgon/rsync_daemon.rb +56 -54
- data/lib/gorgon/runtime_file_reader.rb +28 -27
- data/lib/gorgon/runtime_recorder.rb +27 -26
- data/lib/gorgon/settings/files_content.rb +27 -25
- data/lib/gorgon/settings/initial_files_creator.rb +58 -56
- data/lib/gorgon/settings/rails_project_files_content.rb +33 -31
- data/lib/gorgon/settings/simple_project_files_content.rb +11 -9
- data/lib/gorgon/shutdown_manager.rb +20 -18
- data/lib/gorgon/source_tree_syncer.rb +108 -69
- data/lib/gorgon/version.rb +1 -1
- data/lib/gorgon/worker.rb +130 -128
- data/lib/gorgon/worker_manager.rb +139 -137
- data/lib/gorgon_amq-protocol/.rspec +3 -0
- data/run_dev_environment.sh +3 -0
- data/run_gorgon.sh +3 -0
- data/run_listener.sh +3 -0
- data/run_test.sh +3 -0
- data/spec/callback_handler_spec.rb +10 -10
- data/spec/command_spec.rb +172 -0
- data/spec/configuration_spec.rb +62 -0
- data/spec/core_ext/hash/deep_merge_spec.rb +11 -0
- data/spec/crash_reporter_spec.rb +10 -10
- data/spec/dummy/.gitignore +3 -0
- data/spec/dummy/Gemfile +11 -0
- data/spec/dummy/Gemfile.lock +76 -0
- data/spec/dummy/README.md +23 -0
- data/spec/dummy/gorgon.json +30 -0
- data/spec/dummy/gorgon_callbacks.rb +68 -0
- data/spec/dummy/gorgon_listener.json +8 -0
- data/spec/dummy/integration_spec.rb +51 -0
- data/spec/{support/mock_app/app/mailers → dummy/log}/.gitkeep +0 -0
- data/spec/dummy/rspec_runner.rb +8 -0
- data/spec/dummy/spec/1_syntax_error_spec.rb +1 -0
- data/spec/dummy/spec/exception_spec.rb +5 -0
- data/spec/dummy/spec/failing_spec.rb +11 -0
- data/spec/dummy/spec/keeping_rspec_config_spec.rb +5 -0
- data/spec/dummy/spec/spec_helper.rb +13 -0
- data/spec/dummy/spec/successful_spec.rb +9 -0
- data/spec/dummy/spec/using_shared_example_spec.rb +3 -0
- data/spec/dummy/test/.rb +15 -0
- data/spec/dummy/test/minitest/mini1_test.rb +11 -0
- data/spec/dummy/test/minitest/mini2_test.rb +25 -0
- data/spec/dummy/test/unit/1_syntax_error_test.rb +9 -0
- data/spec/dummy/test/unit/exception_test.rb +14 -0
- data/spec/dummy/test/unit/failing_test.rb +17 -0
- data/spec/dummy/test/unit/successful_test.rb +9 -0
- data/spec/dummy/test_gorgon.pem +27 -0
- data/spec/end_to_end_spec.rb +142 -0
- data/spec/failures_printer_spec.rb +20 -20
- data/spec/gem_command_handler_spec.rb +24 -24
- data/spec/gem_service_spec.rb +18 -18
- data/spec/gorgon_rspec_formatter_spec.rb +12 -12
- data/spec/host_state_spec.rb +8 -8
- data/spec/job_definition_spec.rb +3 -3
- data/spec/job_state_spec.rb +46 -46
- data/spec/listener_spec.rb +67 -73
- data/spec/mini_test_runner_spec.rb +7 -7
- data/spec/originator_logger_spec.rb +6 -6
- data/spec/originator_protocol_spec.rb +38 -38
- data/spec/originator_spec.rb +78 -69
- data/spec/ping_service_spec.rb +14 -14
- data/spec/pipe_forker_spec.rb +13 -13
- data/spec/progress_bar_view_spec.rb +32 -32
- data/spec/rspec_runner_spec.rb +12 -12
- data/spec/rsync_daemon_spec.rb +18 -16
- data/spec/runtime_file_reader_spec.rb +12 -12
- data/spec/runtime_recorder_spec.rb +19 -19
- data/spec/shutdown_manager_spec.rb +9 -9
- data/spec/source_tree_syncer_spec.rb +148 -61
- data/spec/spec_helper.rb +3 -0
- data/spec/support/end_to_end_helpers.rb +16 -0
- data/spec/support/stream_helpers.rb +23 -0
- data/spec/unknown_runner_spec.rb +1 -1
- data/spec/worker_manager_spec.rb +23 -23
- data/spec/worker_spec.rb +70 -70
- metadata +84 -113
- data/spec/acceptance_spec_helper.rb +0 -7
- data/spec/support/mock_app/.gitignore +0 -15
- data/spec/support/mock_app/Gemfile +0 -39
- data/spec/support/mock_app/Gemfile.lock +0 -135
- data/spec/support/mock_app/README.rdoc +0 -261
- data/spec/support/mock_app/Rakefile +0 -7
- data/spec/support/mock_app/app/assets/images/rails.png +0 -0
- data/spec/support/mock_app/app/assets/javascripts/application.js +0 -15
- data/spec/support/mock_app/app/assets/stylesheets/application.css +0 -13
- data/spec/support/mock_app/app/controllers/application_controller.rb +0 -3
- data/spec/support/mock_app/app/helpers/application_helper.rb +0 -2
- data/spec/support/mock_app/app/models/.gitkeep +0 -0
- data/spec/support/mock_app/app/views/layouts/application.html.erb +0 -14
- data/spec/support/mock_app/config.ru +0 -4
- data/spec/support/mock_app/config/application.rb +0 -62
- data/spec/support/mock_app/config/boot.rb +0 -6
- data/spec/support/mock_app/config/database.yml +0 -25
- data/spec/support/mock_app/config/environment.rb +0 -5
- data/spec/support/mock_app/config/environments/development.rb +0 -37
- data/spec/support/mock_app/config/environments/production.rb +0 -67
- data/spec/support/mock_app/config/environments/test.rb +0 -37
- data/spec/support/mock_app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/support/mock_app/config/initializers/inflections.rb +0 -15
- data/spec/support/mock_app/config/initializers/mime_types.rb +0 -5
- data/spec/support/mock_app/config/initializers/secret_token.rb +0 -7
- data/spec/support/mock_app/config/initializers/session_store.rb +0 -8
- data/spec/support/mock_app/config/initializers/wrap_parameters.rb +0 -14
- data/spec/support/mock_app/config/locales/en.yml +0 -5
- data/spec/support/mock_app/config/routes.rb +0 -58
- data/spec/support/mock_app/db/seeds.rb +0 -7
- data/spec/support/mock_app/doc/README_FOR_APP +0 -2
- data/spec/support/mock_app/lib/assets/.gitkeep +0 -0
- data/spec/support/mock_app/lib/tasks/.gitkeep +0 -0
- data/spec/support/mock_app/log/.gitkeep +0 -0
- data/spec/support/mock_app/public/404.html +0 -26
- data/spec/support/mock_app/public/422.html +0 -26
- data/spec/support/mock_app/public/500.html +0 -25
- data/spec/support/mock_app/public/favicon.ico +0 -0
- data/spec/support/mock_app/public/index.html +0 -241
- data/spec/support/mock_app/public/robots.txt +0 -5
- data/spec/support/mock_app/script/rails +0 -6
- data/spec/support/mock_app/test/fixtures/.gitkeep +0 -0
- data/spec/support/mock_app/test/functional/.gitkeep +0 -0
- data/spec/support/mock_app/test/integration/.gitkeep +0 -0
- data/spec/support/mock_app/test/performance/browsing_test.rb +0 -12
- data/spec/support/mock_app/test/test_helper.rb +0 -13
- data/spec/support/mock_app/test/unit/.gitkeep +0 -0
- data/spec/support/mock_app/test/unit/passing_test.rb +0 -7
- data/spec/support/mock_app/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/support/mock_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/support/mock_app/vendor/plugins/.gitkeep +0 -0
- data/spec/support/originator_handler.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9724573d2e23c58b465f2420cff3d59af675e9599555daf228c55556d247ff9d
|
4
|
+
data.tar.gz: 3b92ad056401808c0b01e4cbc9631d77cf1114d96a507bd70df6eddd0e4b5838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 759e075c18e5b1e9cdfb04a366156a16626835ff6edbcec56ee859a49aacbbdb5e8ccb08c04faedd226585be79c2b330ee7bec2061b5fb6af4b4b174c05553a0
|
7
|
+
data.tar.gz: a0b6e638d57012577d914e074e0ac7952dde717bf9ab4cff57f900c048bb97b0dbc6f7e69ca71056e4ac7e1cda3c317313530ed8f8ffcbd30dcc1346fc4bf7d0
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Dockerfile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
FROM ruby:2.1.6-slim
|
2
|
+
|
3
|
+
RUN apt-get update -y && apt-get install -y \
|
4
|
+
build-essential \
|
5
|
+
git \
|
6
|
+
net-tools # we need ifconfig
|
7
|
+
|
8
|
+
RUN mkdir -p ~/.ssh
|
9
|
+
|
10
|
+
ADD spec/dummy/test_gorgon.pem .
|
11
|
+
RUN mv test_gorgon.pem ~/.ssh/id_rsa && chmod 400 ~/.ssh/id_rsa
|
12
|
+
|
13
|
+
WORKDIR '/opt/gorgon'
|
14
|
+
|
15
|
+
RUN gem install bundler
|
16
|
+
ADD ["Gemfile", "Gemfile.lock", "gorgon.gemspec", "./"]
|
17
|
+
ADD ["lib/gorgon/version.rb", "lib/gorgon/"]
|
18
|
+
RUN bundle install
|
19
|
+
|
20
|
+
ADD . .
|
21
|
+
|
22
|
+
RUN gem build gorgon.gemspec && gem install gorgon
|
23
|
+
RUN cd spec/dummy
|
24
|
+
|
25
|
+
ENTRYPOINT ["/bin/bash", "-c", "sleep infinity"]
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gorgon (0.11.
|
4
|
+
gorgon (0.11.1)
|
5
5
|
amq-protocol (~> 1.9.2)
|
6
6
|
amqp (~> 1.1.0)
|
7
7
|
awesome_print
|
@@ -10,7 +10,7 @@ PATH
|
|
10
10
|
open4 (~> 1.3.0)
|
11
11
|
ruby-progressbar (~> 1.7.5)
|
12
12
|
uuidtools (= 2.1.3)
|
13
|
-
yajl-ruby (= 1.1
|
13
|
+
yajl-ruby (= 1.3.1)
|
14
14
|
|
15
15
|
GEM
|
16
16
|
remote: http://rubygems.org/
|
@@ -19,24 +19,29 @@ GEM
|
|
19
19
|
amqp (1.1.8)
|
20
20
|
amq-protocol (>= 1.9.2)
|
21
21
|
eventmachine
|
22
|
-
awesome_print (1.
|
22
|
+
awesome_print (1.8.0)
|
23
23
|
colorize (0.5.8)
|
24
|
-
diff-lcs (1.
|
24
|
+
diff-lcs (1.3)
|
25
25
|
eventmachine (1.0.9.1)
|
26
26
|
open4 (1.3.4)
|
27
27
|
rake (0.9.2.2)
|
28
|
-
rspec (
|
29
|
-
rspec-core (~>
|
30
|
-
rspec-expectations (~>
|
31
|
-
rspec-mocks (~>
|
32
|
-
rspec-core (
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
rspec (3.5.0)
|
29
|
+
rspec-core (~> 3.5.0)
|
30
|
+
rspec-expectations (~> 3.5.0)
|
31
|
+
rspec-mocks (~> 3.5.0)
|
32
|
+
rspec-core (3.5.4)
|
33
|
+
rspec-support (~> 3.5.0)
|
34
|
+
rspec-expectations (3.5.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.5.0)
|
37
|
+
rspec-mocks (3.5.0)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.5.0)
|
40
|
+
rspec-support (3.5.0)
|
36
41
|
ruby-progressbar (1.7.5)
|
37
42
|
test-unit (2.5.2)
|
38
43
|
uuidtools (2.1.3)
|
39
|
-
yajl-ruby (1.1
|
44
|
+
yajl-ruby (1.3.1)
|
40
45
|
|
41
46
|
PLATFORMS
|
42
47
|
ruby
|
@@ -44,8 +49,8 @@ PLATFORMS
|
|
44
49
|
DEPENDENCIES
|
45
50
|
gorgon!
|
46
51
|
rake
|
47
|
-
rspec (~>
|
52
|
+
rspec (~> 3.5.0)
|
48
53
|
test-unit
|
49
54
|
|
50
55
|
BUNDLED WITH
|
51
|
-
1.
|
56
|
+
1.16.1
|
data/README.md
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
Gorgon
|
2
|
-
=====================
|
3
|
-
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/gorgon.png)](https://rubygems.org/gems/gorgon)
|
5
|
-
[![Code Climate](https://codeclimate.com/github/Fitzsimmons/Gorgon.png)](https://codeclimate.com/github/Fitzsimmons/Gorgon)
|
1
|
+
# Gorgon [![Build Status](https://travis-ci.org/nulogy/Gorgon.svg?branch=master)](https://travis-ci.org/nulogy/Gorgon) [![Gem Version](https://badge.fury.io/rb/gorgon.svg)](https://rubygems.org/gems/gorgon) [![Code Climate](https://codeclimate.com/github/nulogy/Gorgon/badges/gpa.svg)](https://codeclimate.com/github/nulogy/Gorgon)
|
6
2
|
|
7
3
|
About
|
8
4
|
---------------------
|
@@ -26,6 +22,7 @@ Gotchas
|
|
26
22
|
|
27
23
|
Also note that the steps in the tutorial are **not** meant to work on every project, they will only give you initial settings. You will probably have to modify the following files:
|
28
24
|
* gorgon.json
|
25
|
+
* gorgon_secret.json
|
29
26
|
* {test, spec}/gorgon_callbacks/gorgon_callbacks.rb
|
30
27
|
* gorgon_listener.json (located in your project root or in ~/.gorgon/)
|
31
28
|
|
@@ -47,6 +44,11 @@ This file contains project-specific settings for gorgon, such as:
|
|
47
44
|
|
48
45
|
See [gorgon.json example](/gorgon.json.sample) for an example file.
|
49
46
|
|
47
|
+
### gorgon_secret.json (optional)
|
48
|
+
This optional file contains sensitive information such as passwords that cannot be put in gorgon.json.
|
49
|
+
|
50
|
+
See [gorgon_secret.json example](/gorgon_secret.json.sample) for an example file.
|
51
|
+
|
50
52
|
### gorgon_listener.json
|
51
53
|
This file contains the listener-specific settings, such as:
|
52
54
|
|
@@ -60,6 +62,31 @@ Contributing
|
|
60
62
|
---------------------
|
61
63
|
Read overview [architecture](/architecture.md)
|
62
64
|
|
65
|
+
### Requirements:
|
66
|
+
|
67
|
+
* You only need [Docker](https://docs.docker.com/docker-for-mac/install/)
|
68
|
+
|
69
|
+
### Prepare your environment
|
70
|
+
|
71
|
+
* Execute `./run_dev_environment.sh`
|
72
|
+
* In a new terminal tab, execute `./run_listener.sh`
|
73
|
+
|
74
|
+
**NOTE:** If you make changes changes to `listener` code, you must restart `./run_listener.sh` for those changes to take effect
|
75
|
+
|
76
|
+
### Running all tests
|
77
|
+
|
78
|
+
* `./run_test.sh`
|
79
|
+
|
80
|
+
### Running gorgon using the `spec/dummy` project
|
81
|
+
|
82
|
+
* `./run_gorgon.sh`
|
83
|
+
|
84
|
+
Releasing to RubyGems
|
85
|
+
---------------------
|
86
|
+
|
87
|
+
1. Update `version.rb`
|
88
|
+
1. Run `rake release`
|
89
|
+
|
63
90
|
Credits
|
64
91
|
---------------------
|
65
92
|
Gorgon is maintained by:
|
@@ -67,4 +94,4 @@ Gorgon is maintained by:
|
|
67
94
|
* Arturo Pie
|
68
95
|
|
69
96
|
Gorgon is funded by [Nulogy Corp](http://www.nulogy.com/).
|
70
|
-
Thank you to all the [contributors](https://github.com/
|
97
|
+
Thank you to all the [contributors](https://github.com/nulogy/Gorgon/contributors).
|
data/Rakefile
CHANGED
data/architecture.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Architecture
|
2
2
|
---------------------
|
3
3
|
|
4
|
-
[Gorgon](https://github.com/
|
4
|
+
[Gorgon](https://github.com/nulogy/Gorgon/) distributes a test suite across multiple machines. So you can use all the computer power in your office to run your tests in parallel.
|
5
5
|
|
6
6
|
These are the main components of Gorgon's architecture:
|
7
7
|
|
@@ -33,7 +33,7 @@ When a *listener* receives a *job definition*, it:
|
|
33
33
|
After WorkerManager starts, it:
|
34
34
|
|
35
35
|
* Runs before_creating_workers callback
|
36
|
-
* Forks n workers, where n is the number of available worker slots specified in [gorgon configuration](https://github.com/
|
36
|
+
* Forks n workers, where n is the number of available worker slots specified in [gorgon configuration](https://github.com/nulogy/Gorgon/blob/master/gorgon_listener.json.sample).
|
37
37
|
* Subscribes to a queue where originator can send a cancel_job message
|
38
38
|
|
39
39
|
Each Worker:
|
data/bin/gorgon
CHANGED
@@ -1,116 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
|
5
|
-
require 'gorgon/originator'
|
6
|
-
require 'gorgon/listener'
|
7
|
-
require 'gorgon/rsync_daemon'
|
8
|
-
require 'gorgon/worker_manager'
|
9
|
-
require 'gorgon/ping_service'
|
10
|
-
require 'gorgon/gem_service'
|
11
|
-
require 'gorgon/version'
|
12
|
-
require 'gorgon/listener_installer'
|
13
|
-
require 'gorgon/settings/initial_files_creator'
|
14
|
-
|
15
|
-
WELCOME_MSG = "Welcome to Gorgon #{Gorgon::VERSION}"
|
16
|
-
|
17
|
-
def start
|
18
|
-
o = Originator.new
|
19
|
-
exit o.originate
|
20
|
-
end
|
21
|
-
|
22
|
-
def listen
|
23
|
-
l = Listener.new
|
24
|
-
l.listen
|
25
|
-
end
|
26
|
-
|
27
|
-
def start_rsync_daemon
|
28
|
-
puts "Starting rsync daemon..."
|
29
|
-
exit 1 unless RsyncDaemon.start ARGV[1]
|
30
|
-
puts "Rsync Daemon is running. Use 'gorgon stop_rsync' to kill it."
|
31
|
-
end
|
32
|
-
|
33
|
-
def stop_rsync_daemon
|
34
|
-
puts "Stopping rsync daemon..."
|
35
|
-
exit 1 unless RsyncDaemon.stop
|
36
|
-
puts "Done"
|
37
|
-
end
|
38
|
-
|
39
|
-
def manage_workers
|
40
|
-
config_path = ENV["GORGON_CONFIG_PATH"]
|
41
|
-
|
42
|
-
manager = WorkerManager.build config_path
|
43
|
-
manager.manage
|
44
|
-
|
45
|
-
# For some reason I have to 'exit' here, otherwise WorkerManager process crashes
|
46
|
-
exit
|
47
|
-
end
|
48
|
-
|
49
|
-
def ping_listeners
|
50
|
-
PingService.new.ping_listeners
|
51
|
-
end
|
52
|
-
|
53
|
-
def run_gem command
|
54
|
-
GemService.new.run command
|
55
|
-
end
|
56
|
-
|
57
|
-
def init framework
|
58
|
-
Settings::InitialFilesCreator.run framework
|
59
|
-
end
|
60
|
-
|
61
|
-
def install_listener
|
62
|
-
ListenerInstaller.install
|
63
|
-
end
|
64
|
-
|
65
|
-
def usage
|
66
|
-
#print instructions on how to use gorgon
|
67
|
-
puts "\tstart - remotely runs all tests specified in gorgon.json"
|
68
|
-
puts "\tlisten - starts a listener process using the settings in gorgon_listener.json"
|
69
|
-
puts "\tping - pings listeners and shows hosts and gorgon's version they are running"
|
70
|
-
puts "\tinit [rails] - create initial files for current project"
|
71
|
-
puts "\tinstall_listener - runs gorgon listener as a daemon process"
|
72
|
-
puts "\tstart_rsync <directory> - start rsync daemon. Run this command in File Server"
|
73
|
-
puts "\tstop_rsync - stop rsync daemon."
|
74
|
-
puts "\tgem command [options...] - execute the gem command on every listener and shutdown listener. e.g. 'gorgon gem install --version 1.0.0'"
|
75
|
-
end
|
76
|
-
|
77
|
-
case ARGV[0] # special case for 'version', because we don't need the welcome message telling us the version when we're explicitly asking for it
|
78
|
-
when "version", "--version"
|
79
|
-
puts Gorgon::VERSION
|
80
|
-
exit
|
81
|
-
end
|
82
|
-
|
83
|
-
puts WELCOME_MSG
|
84
|
-
|
85
|
-
case ARGV[0]
|
86
|
-
when nil
|
87
|
-
start
|
88
|
-
when "help", "--help"
|
89
|
-
usage
|
90
|
-
exit
|
91
|
-
when "start"
|
92
|
-
start
|
93
|
-
when "listen"
|
94
|
-
listen
|
95
|
-
when "start_rsync"
|
96
|
-
start_rsync_daemon
|
97
|
-
when "stop_rsync"
|
98
|
-
stop_rsync_daemon
|
99
|
-
when "manage_workers"
|
100
|
-
manage_workers
|
101
|
-
when "ping"
|
102
|
-
ping_listeners
|
103
|
-
when "gem"
|
104
|
-
ARGV.shift
|
105
|
-
run_gem ARGV.join(' ')
|
106
|
-
when "help"
|
107
|
-
usage
|
108
|
-
when "init"
|
109
|
-
init ARGV[1]
|
110
|
-
when "install_listener"
|
111
|
-
install_listener
|
112
|
-
else
|
113
|
-
puts "Unknown command!"
|
114
|
-
usage
|
115
|
-
exit 1
|
116
|
-
end
|
3
|
+
require 'gorgon/command'
|
4
|
+
Gorgon::Command.run(ARGV)
|
@@ -5,7 +5,7 @@ These steps will guarantee that the listener is always running and it will start
|
|
5
5
|
1. `mkdir ~/.gorgon && cd ~/.gorgon`
|
6
6
|
1. `rvm use ruby-1.9.3` or whatever version of ruby you use.
|
7
7
|
1. `gem install gorgon foreman`
|
8
|
-
1. Place your _gorgon\_listener.json_ in this directory. See [here](https://github.com/
|
8
|
+
1. Place your _gorgon\_listener.json_ in this directory. See [here](https://github.com/nulogy/Gorgon/blob/master/gorgon_listener.json.sample) for a _gorgon\_listener.json_ example.
|
9
9
|
1. `echo 'listener: [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" && `
|
10
10
|
`rvm ruby-1.9.3 do gorgon listen > listener.out 2> listener.err' > Procfile`
|
11
11
|
1. ``rvmsudo foreman export upstart /etc/init -a gorgon -u `whoami` -c listener=1``
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
version: '3'
|
2
|
+
services:
|
3
|
+
rabbitmq:
|
4
|
+
image: "rabbitmq:alpine"
|
5
|
+
ports:
|
6
|
+
- "5672:5672"
|
7
|
+
file_server:
|
8
|
+
build: "file_server"
|
9
|
+
volumes:
|
10
|
+
- .:/opt/gorgon
|
11
|
+
listener:
|
12
|
+
container_name: "gorgon_listener"
|
13
|
+
build: .
|
14
|
+
entrypoint: "sleep infinity"
|
15
|
+
hostname: listener
|
16
|
+
volumes:
|
17
|
+
- .:/opt/gorgon
|
18
|
+
depends_on:
|
19
|
+
- rabbitmq
|
20
|
+
originator:
|
21
|
+
container_name: "gorgon_originator"
|
22
|
+
build: .
|
23
|
+
entrypoint: "sleep infinity"
|
24
|
+
volumes:
|
25
|
+
- .:/opt/gorgon
|
26
|
+
depends_on:
|
27
|
+
- rabbitmq
|
28
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1d8JdZfeqU4sSuHBf05UQUradgWds1W6UFkTm89ZsPAFTJNLO40A603tyYX/kYWdYmbZQev4ExznIpZDChdqTojjjP1qnFESv9NcBUERHo3I79mp2PanQfFnL0VkcJw9XbDAZITc7lTyZymGZZL3FiGNWGiik3m+OhuBebqJ7shhUm9i+1k4LEIEqYPERMOX0dimHJLCw2Fzh+89piYM/yOTZIY3tneDaQPwU6Z7ytRR1g1B+eLaXsCrihE1SeXjy/powYqpbz1EB34uD+aM9Vwiyb/rtcfkTQWA69UA9Niqd7TpsGllyQeu7jbFQ82WQe2GIv09ukG5hVg0pD2Bb arturopie@arturop-mac-2.local
|
data/gorgon.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.add_development_dependency "rake"
|
22
22
|
s.add_development_dependency "test-unit"
|
23
|
-
s.add_development_dependency "rspec", '~>
|
23
|
+
s.add_development_dependency "rspec", '~>3.5.0'
|
24
24
|
|
25
25
|
s.add_runtime_dependency "amqp", '~> 1.1.0'
|
26
26
|
s.add_runtime_dependency "amq-protocol", '~> 1.9.2'
|
@@ -32,6 +32,6 @@ Gem::Specification.new do |s|
|
|
32
32
|
|
33
33
|
# this dependencies are clashing with one of our apps
|
34
34
|
# This problem should be fixed
|
35
|
-
s.add_runtime_dependency "yajl-ruby", '=1.1
|
35
|
+
s.add_runtime_dependency "yajl-ruby", '=1.3.1'
|
36
36
|
s.add_runtime_dependency "uuidtools", '=2.1.3'
|
37
37
|
end
|
data/lib/gorgon/amqp_service.rb
CHANGED
@@ -1,39 +1,41 @@
|
|
1
1
|
require 'gorgon_bunny/lib/gorgon_bunny'
|
2
2
|
require 'yajl'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
module Gorgon
|
5
|
+
class AmqpQueueDecorator
|
6
|
+
def initialize queue
|
7
|
+
@queue = queue
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
def pop
|
11
|
+
m = @queue.pop
|
12
|
+
payload = m[2]
|
13
|
+
return payload
|
14
|
+
end
|
13
15
|
end
|
14
|
-
end
|
15
16
|
|
16
|
-
class AmqpExchangeDecorator
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
class AmqpExchangeDecorator
|
18
|
+
def initialize exchange
|
19
|
+
@exchange = exchange
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
def publish msg
|
23
|
+
serialized_msg = Yajl::Encoder.encode(msg)
|
24
|
+
@exchange.publish serialized_msg
|
25
|
+
end
|
24
26
|
end
|
25
|
-
end
|
26
27
|
|
27
|
-
class AmqpService
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
class AmqpService
|
29
|
+
def initialize connection_config
|
30
|
+
@connection_config = connection_config.merge(:spec => "09")
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
def start_worker file_queue_name, reply_exchange_name
|
34
|
+
GorgonBunny.run @connection_config do |b|
|
35
|
+
queue = b.queue(file_queue_name, :auto_delete => true)
|
36
|
+
exchange = b.exchange(reply_exchange_name, :auto_delete => true)
|
37
|
+
yield AmqpQueueDecorator.new(queue), AmqpExchangeDecorator.new(exchange)
|
38
|
+
end
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|