gorgon 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2697c5404498b1f1605746aa77f4812b3c106538
4
- data.tar.gz: 8785ea9e49a5994a35e83f08b65106cfbc9369a4
3
+ metadata.gz: eef07ed03530c2480e46991f18ffaedcb485dd2e
4
+ data.tar.gz: 69d4d71b43c58958eafbb489e9fea40aac62eea1
5
5
  SHA512:
6
- metadata.gz: b407fe9b9ccff0e2f6eefe038dff6bae1b71ab323622621fa98dbff3b92bb5ac55188990fdd7182b01349e7f6c13136f2c6b3ec1bdd1a76ddf214d0bce362361
7
- data.tar.gz: e2846f05b7d0cd1213261356973a756dc75ee507a9c24e80e67bcbf3e22687ab59c15e8dd0449a07dcc9b27c3a9e3a8d319d7874cb54a33650adf94afe9c6144
6
+ metadata.gz: e546e88bc56e0e7d91a87691246d0ba555fdacb344f0cc832c968ce0f07599db929123061da6b6608f3d27cf7d754c82655153a193a0b9e0ca226d632841d397
7
+ data.tar.gz: fc1d646ada5533fdd070a7cdaeabdf61a3219f8edca3150fe69aabe62afebbea33c257515692bb1847133f6a1f9ecd470b0388b80554621cb05571d6ec831705
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gorgon (0.8.0)
4
+ gorgon (0.8.1)
5
5
  amqp (~> 1.1.0)
6
6
  awesome_print
7
7
  colorize (~> 0.5.8)
data/README.md CHANGED
@@ -26,14 +26,10 @@ Gotchas
26
26
 
27
27
  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
28
  * gorgon.json
29
- * test/gorgon_callbacks/after\_sync.rb
30
- * test/gorgon_callbacks/before\_creating\_workers.rb
31
- * test/gorgon_callbacks/after\_creating\_workers.rb
32
- * test/gorgon_callbacks/before\_start.rb
33
- * test/gorgon_callbacks/after\_complete.rb
34
- * ~/.gorgon/gorgon_listener.json
29
+ * {test, spec}/gorgon_callbacks/gorgon_callbacks.rb
30
+ * gorgon_listener.json (located in your project root or in ~/.gorgon/)
35
31
 
36
- If you modify ~/.gorgon/gorgon_listener.json, make sure you restart the listener by running `sudo restart gorgon`
32
+ If you modify ~/.gorgon/gorgon_listener.json, make sure you restart the listener.
37
33
 
38
34
  Configuration
39
35
  ---------------------
@@ -42,13 +38,14 @@ Configuration
42
38
  This file contains project-specific settings for gorgon, such as:
43
39
 
44
40
  * The connection information for AMQP
45
- * Information about how clients can rsync the working directory (optional)
41
+ * The connection information for File Server
42
+ * Information about how clients can rsync the working directory (optional). See more info [here](/rsync_transport.md)
46
43
  * Files that can be excluded by rsync
47
- * Files containing Ruby code to be used as callbacks
44
+ * Callback file containing Ruby code to be used as callbacks
48
45
  * A glob for generating the list of test files
49
46
  * The file used for Originator's logs
50
47
 
51
- See [gorgon.json example](/gorgon.json.sample) for more details.
48
+ See [gorgon.json example](/gorgon.json.sample) for an example file.
52
49
 
53
50
  ### gorgon_listener.json
54
51
  This file contains the listener-specific settings, such as:
@@ -11,4 +11,6 @@ These steps will guarantee that the listener is always running and it will start
11
11
  1. ``rvmsudo foreman export upstart /etc/init -a gorgon -u `whoami` -c listener=1``
12
12
  1. `sudo start gorgon`
13
13
  1. open ’/etc/init/gorgon.conf’ and add `start on runlevel [2345]` at the top of the file
14
- 1. Check if listener is running: Run `tail /tmp/gorgon-remote.log` and the last line should say “Waiting for jobs…”
14
+ 1. Check if listener is running: Run `tail /tmp/gorgon-remote.log` and the last line should say “Waiting for jobs…”
15
+
16
+ If you modify ~/.gorgon/gorgon_listener.json, make sure you restart the listener by running `sudo restart gorgon`
@@ -1,7 +1,7 @@
1
1
  module Settings
2
2
  class FilesContent
3
3
  attr_accessor :amqp_host, :file_server_host, :sync_exclude, :files, :originator_log_file,
4
- :callbacks, :callbacks_dir
4
+ :callbacks
5
5
 
6
6
  TEST_UNIT_GLOB = "test/**/*_test.rb"
7
7
  RSPEC_GLOB = "spec/**/*_spec.rb"
@@ -25,7 +25,7 @@ module Settings
25
25
 
26
26
  def self.create_gorgon_json content
27
27
  if File.exist? GORGON_JSON_FILE
28
- puts "gorgo.json exists. Skipping..."
28
+ puts "#{GORGON_JSON_FILE} exists. Skipping..."
29
29
  return
30
30
  end
31
31
 
@@ -34,8 +34,8 @@ module Settings
34
34
  file_server: {host: content.file_server_host},
35
35
  job: {
36
36
  sync: {
37
- exclude: content.sync_exclude
38
- # TODO: add rsync_transport config
37
+ exclude: content.sync_exclude,
38
+ rsync_transport: "ssh"
39
39
  }
40
40
  },
41
41
  files: content.files
@@ -45,12 +45,11 @@ module Settings
45
45
  config[:originator_log_file] = log_file if log_file
46
46
 
47
47
  if content.callbacks
48
- create_callback_files(content)
48
+ create_callback_file(content)
49
49
 
50
- config[:job][:callbacks] = content.callbacks.inject({}) do |callbacks, e|
51
- callbacks[e[:name]] = "#{content.callbacks_dir}/#{e[:file_name]}"
52
- callbacks
53
- end
50
+ config[:job][:callbacks] = {
51
+ callbacks_class_file: content.callbacks[:file_name]
52
+ }
54
53
  end
55
54
 
56
55
  puts "Creating #{GORGON_JSON_FILE}..."
@@ -59,23 +58,17 @@ module Settings
59
58
  end
60
59
  end
61
60
 
62
- def self.create_callback_files content
63
- FileUtils.mkdir_p content.callbacks_dir
64
- content.callbacks.each do |callback|
65
- create_callback_file content.callbacks_dir, callback
66
- end
67
- end
68
-
69
- def self.create_callback_file dir, callback
70
- file_path = "#{dir}/#{callback[:file_name]}"
61
+ def self.create_callback_file(content)
62
+ file_path = content.callbacks[:file_name]
71
63
  if File.exist? file_path
72
64
  puts "#{file_path} already exists. Skipping..."
73
65
  return
74
66
  end
75
67
 
76
68
  puts "Creating #{file_path}..."
69
+ FileUtils.mkdir_p(File.dirname(file_path))
77
70
  File.open(file_path, 'w') do |f|
78
- f.write callback[:content]
71
+ f.write content.callbacks[:file_content]
79
72
  end
80
73
  end
81
74
  end
@@ -14,95 +14,89 @@ module Settings
14
14
  private
15
15
 
16
16
  def create_callbacks
17
- @callbacks_dir = "#{get_app_subdir}gorgon_callbacks"
18
- @callbacks = [{name: :after_sync, file_name: "after_sync.rb",
19
- content: after_sync_content},
20
- {name: :before_creating_workers, file_name: "before_creating_workers.rb",
21
- content: before_creating_workers_content},
22
- {name: :after_creating_workers, file_name: "after_creating_workers.rb",
23
- content: after_creating_workers_content},
24
- {name: :before_start, file_name: "before_start.rb",
25
- content: before_start_content}]
17
+ @callbacks = {
18
+ file_name: "#{get_app_subdir}/gorgon_callbacks/gorgon_callbacks.rb",
19
+ file_content: callback_file_content
20
+ }
26
21
  end
27
22
 
28
23
  def get_app_subdir
29
24
  if Dir.exist? "test"
30
- "test/"
25
+ "test"
31
26
  elsif Dir.exist? "spec"
32
- "spec/"
27
+ "spec"
33
28
  elsif Dir.exist? "lib"
34
- "lib/"
29
+ "lib"
35
30
  else
36
31
  ""
37
32
  end
38
33
  end
39
34
 
40
- def after_sync_content
35
+ def callback_file_content
41
36
  <<-'CONTENT'
42
- require 'bundler'
43
- require 'open4'
44
-
45
- Bundler.with_clean_env do
37
+ class GorgonCallbacks < Gorgon::DefaultCallbacks
46
38
  BUNDLE_LOG_FILE||="/tmp/gorgon-bundle-install.log "
39
+ def after_sync
40
+ require 'bundler'
41
+ require 'open4'
47
42
 
48
- pid, stdin, stdout, stderr = Open4::popen4 "bundle install > #{BUNDLE_LOG_FILE} 2>&1 "
49
-
50
- ignore, status = Process.waitpid2 pid
43
+ Bundler.with_clean_env do
51
44
 
52
- if status.exitstatus != 0
53
- raise "ERROR: 'bundle install' failed.\n#{stderr.read}"
54
- end
55
- end
56
- CONTENT
57
- end
45
+ pid, stdin, stdout, stderr = Open4::popen4 "bundle install > #{BUNDLE_LOG_FILE} 2>&1 "
58
46
 
59
- def before_creating_workers_content
60
- <<-'CONTENT'
61
- ENV["TEST_ENV_NUMBER"] = Process.pid.to_s
62
- ENV["RAILS_ENV"] = 'remote_test'
47
+ ignore, status = Process.waitpid2 pid
63
48
 
64
- pid, stdin, stdout, stderr = Open4::popen4 "TEST_ENV_NUMBER=#{Process.pid.to_s} RAILS_ENV='remote_test' bundle exec rake db:setup"
65
- ignore, status = Process.waitpid2 pid
49
+ if status.exitstatus != 0
50
+ raise "ERROR: 'bundle install' failed.\n#{stderr.read}"
51
+ end
52
+ end
53
+ end
66
54
 
67
- if status.exitstatus != 0
68
- raise "ERROR: 'rake db:setup' failed.\n#{stderr.read}\n#{stdout.read}"
69
- end
55
+ def before_creating_workers
56
+ ENV["TEST_ENV_NUMBER"] = Process.pid.to_s
57
+ ENV["RAILS_ENV"] = 'remote_test'
70
58
 
71
- spec_helper_file = File.expand_path('../../spec_helper.rb', __FILE__)
72
- test_helper_file = File.expand_path('../../test_helper.rb', __FILE__)
59
+ pid, stdin, stdout, stderr = Open4::popen4 "TEST_ENV_NUMBER=#{Process.pid.to_s} RAILS_ENV='remote_test' bundle exec rake db:setup"
60
+ ignore, status = Process.waitpid2 pid
73
61
 
74
- require spec_helper_file if File.exist?(spec_helper_file)
75
- require test_helper_file if File.exist?(test_helper_file)
76
- CONTENT
62
+ if status.exitstatus != 0
63
+ raise "ERROR: 'rake db:setup' failed.\n#{stderr.read}\n#{stdout.read}"
77
64
  end
78
65
 
79
- def after_creating_workers_content
80
- <<-'CONTENT'
81
- require 'rake'
82
- load './Rakefile'
66
+ spec_helper_file = File.expand_path('../../spec_helper.rb', __FILE__)
67
+ test_helper_file = File.expand_path('../../test_helper.rb', __FILE__)
83
68
 
84
- begin
85
- if Rails.env = 'remote_test'
86
- Rake::Task['db:drop'].execute
69
+ require spec_helper_file if File.exist?(spec_helper_file)
70
+ require test_helper_file if File.exist?(test_helper_file)
87
71
  end
88
- rescue Exception => ex
89
- puts "Error dropping test database:\n #{ex}"
90
- end
91
- CONTENT
92
- end
93
72
 
94
- def before_start_content
95
- <<-'CONTENT'
96
- require 'rake'
97
- load './Rakefile'
73
+ def before_start
74
+ require 'rake'
75
+ load './Rakefile'
98
76
 
99
- begin
100
- Rails.env = 'remote_test'
101
- ENV['TEST_ENV_NUMBER'] = Process.pid.to_s
77
+ begin
78
+ Rails.env = 'remote_test'
79
+ ENV['TEST_ENV_NUMBER'] = Process.pid.to_s
102
80
 
103
- Rake::Task['db:reset'].invoke
81
+ Rake::Task['db:reset'].invoke
82
+ end
83
+ end
84
+
85
+ def after_creating_workers
86
+ require 'rake'
87
+ load './Rakefile'
88
+
89
+ begin
90
+ if Rails.env = 'remote_test'
91
+ Rake::Task['db:drop'].execute
92
+ end
93
+ rescue Exception => ex
94
+ puts "Error dropping test database:\n #{ex}"
95
+ end
96
+ end
104
97
  end
105
98
 
99
+ Gorgon.callbacks = GorgonCallbacks.new
106
100
  CONTENT
107
101
  end
108
102
  end
@@ -1,3 +1,3 @@
1
1
  module Gorgon
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
@@ -0,0 +1,20 @@
1
+ Rsync Transport Documentation
2
+ =============================
3
+
4
+ In gorgon.json, you can change how files are uploaded from Originator to File Server and downloaded from File Server to Listeners.
5
+ This setting is "rsync_transport" which could be either "ssh" or "anonymous"
6
+
7
+ SSH Transport
8
+ -------------
9
+
10
+ If you are using this setting, originator and all listeners should have SSH passwordless access to File Server. You can follow [these steps](http://www.linuxproblem.org/art_9.html) to setup SSH login without password.
11
+
12
+ Anonymous Transport
13
+ -------------------
14
+
15
+ If you are using this setting, you need to run the following in the File Server:
16
+
17
+ ```bash
18
+ mkdir -p ~/.gorgon/file_dir # here is where gorgon will push files under test
19
+ gorgon start_rsync ~/.gorgon/file_dir
20
+ ```
@@ -21,7 +21,7 @@ Run `rspec` and make sure all tests pass.
21
21
 
22
22
  1. Install [RabbitMQ](https://www.rabbitmq.com/download.html).
23
23
 
24
- 2. Add Gorgon to the Gemfile: `gem 'gorgon', '0.7.1'`
24
+ 2. Add Gorgon to the Gemfile: `gem 'gorgon', '0.8.1'`
25
25
 
26
26
  3. `bundle`
27
27
 
@@ -58,6 +58,11 @@ Run `rspec` and make sure all tests pass.
58
58
  cp config/environments/test.rb config/environments/remote_test.rb
59
59
  ```
60
60
 
61
+ ### Setting up SSH access
62
+
63
+ In this tutorial, we are using [SSH Transport](/rsync_transport.md) to move source code files. This requires you to have SSH access without password to File Server (in this case, to localhost).
64
+ To check if you have SSH access without password, running ```ssh localhost``` should not ask for a password. If it asks for a password, follow [these steps](http://www.linuxproblem.org/art_9.html) to setup passwordless SSH access.
65
+
61
66
  ### Run Gorgon Listener
62
67
 
63
68
  1. Download a listener configuration sample:
@@ -73,13 +78,6 @@ Run `rspec` and make sure all tests pass.
73
78
  gorgon listen
74
79
  ```
75
80
 
76
- ### Run File Server
77
-
78
- ```bash
79
- mkdir -p ~/.gorgon/file_dir # here is where gorgon will push files under test
80
- gorgon start_rsync ~/.gorgon/file_dir
81
- ```
82
-
83
81
  ### Run Gorgon
84
82
 
85
83
  Now, you are ready to run Gorgon.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorgon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Fitzsimmons
@@ -270,6 +270,7 @@ files:
270
270
  - lib/gorgon_bunny/lib/gorgon_bunny/transport.rb
271
271
  - lib/gorgon_bunny/lib/gorgon_bunny/version.rb
272
272
  - lib/gorgon_bunny/lib/gorgon_bunny/versioned_delivery_tag.rb
273
+ - rsync_transport.md
273
274
  - spec/acceptance/run_tests_spec.rb
274
275
  - spec/acceptance_spec_helper.rb
275
276
  - spec/callback_handler_spec.rb