barbeque 0.0.13 → 0.0.14

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: 4189910f9a93c337aa4baf8491098e3c5cfb0d83
4
- data.tar.gz: 8d460cc32edf6f00514f2448b583ee0e5c857977
3
+ metadata.gz: 5c4a66c06a41f0c69f6b58200d649ecfa9864d32
4
+ data.tar.gz: a99fb1a847e6e661eafa78a087eaec2ad967ce62
5
5
  SHA512:
6
- metadata.gz: 7c50e0ef9258dd7b9fce1940dd4ef3d60d7b0eb29e6d9dc54456de19549c2ce45ccaf56f67f2487e43bb5394d3f026caae42964008e059796ecf3f1f1db4127a
7
- data.tar.gz: 766e2abd01645473c086649441b3f3753a43e6f776d9ea49a28677f258102a60e63f37a557c356159caff8e2aa7b500b17db221ce4dee3726da7c8c04dc4bf7f
6
+ metadata.gz: d0f78d987a36eea2f2ff15e5bdb0e7769ac36cfafae1fb7710b654385722d1090b7c348589c3e26b13d2f98daa2d0bc6a8e384236634b4d53d631e6c68a39959
7
+ data.tar.gz: 2fa5ea52ab2aab1d310da0ddf72090561169886d9f9fbd71273f7ac016ba36dec0e38b58d1d0d830617914fba925186ad29895cb76b7b3f768c4afa54bd820e7
data/README.md CHANGED
@@ -1,29 +1,57 @@
1
1
  # Barbeque [![Build Status](https://travis-ci.org/cookpad/barbeque.svg?branch=master)](https://travis-ci.org/cookpad/barbeque)
2
2
 
3
- ## Status
3
+ Job queue system to run job with Docker
4
4
 
5
- We've just open-sourced this library and documentation is work in progress.
6
- Barbeque is already used on production at Cookpad.
5
+ <img src="https://raw.githubusercontent.com/cookpad/barbeque/master/doc/images/job_definitions.png" height="280px" />
6
+ <img src="https://raw.githubusercontent.com/cookpad/barbeque/master/doc/images/statistics.png" height="280px" />
7
7
 
8
- ## Installation
9
- Add this line to your application's Gemfile:
8
+ ## Project Status
10
9
 
11
- ```ruby
12
- gem 'barbeque'
13
- ```
10
+ Barbeque is under development but already used on production at Cookpad.
11
+ Documentation and open-sourcing plugins are work in progress.
14
12
 
15
- And then execute:
16
- ```bash
17
- $ bundle
18
- ```
13
+ ## What's Barbeque?
14
+
15
+ Barbeque is a job queue system that consists of:
16
+
17
+ - Web console to manage jobs
18
+ - Web API to queue a job
19
+ - Worker to execute a job
20
+
21
+ A job for Barbeque is a command you configured on web console.
22
+ A message serialized by JSON and a job name are given to the command when performed.
23
+ In Barbeque worker, they are done on Docker container.
24
+
25
+ ## Why Barbeque?
26
+
27
+ - You can achieve job-level auto scaling using tools like [Amazon ECS](https://aws.amazon.com/ecs/) and [EC2 Auto Scaling group](https://aws.amazon.com/autoscaling/)
28
+ - It requires a plugin to run job with ECS, but it's not open-sourced for now
29
+ - You don't have to manage infrastructure for each application like Resque or Sidekiq
30
+
31
+ For details, see [Scalable Job Queue System Built with Docker // Speaker Deck](https://speakerdeck.com/k0kubun/scalable-job-queue-system-built-with-docker).
32
+
33
+ ## Deployment
34
+
35
+ ### Web API & console
36
+
37
+ Install barbeque.gem to an empty Rails app and mount `Barbeque::Engine`.
38
+ And deploy it as you like.
39
+
40
+ You also need to prepare MySQL, Amazon SQS and Amazon S3.
41
+
42
+ ### Worker
19
43
 
20
- Or install it yourself as:
21
44
  ```bash
22
- $ gem install barbeque
45
+ $ rake barbeque:worker BARBEQUE_QUEUE=default
23
46
  ```
24
47
 
25
- ## Contributing
26
- Contribution directions go here.
48
+ ## Usage
49
+
50
+ Web API documentation is available at [doc/toc.md](./doc/toc.md).
51
+
52
+ ### Ruby
53
+
54
+ [barbeque\_client.gem](https://github.com/cookpad/barbeque_client) has API client and ActiveJob integration.
27
55
 
28
56
  ## License
29
57
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -4,6 +4,11 @@ require 'hashie'
4
4
 
5
5
  module Barbeque
6
6
  module Configuration
7
+ DEFAULT_CONFIG = {
8
+ 'exception_handler' => 'RailsLogger',
9
+ 'runner' => 'Docker',
10
+ }
11
+
7
12
  def config
8
13
  @config ||= build_config
9
14
  end
@@ -11,7 +16,7 @@ module Barbeque
11
16
  def build_config
12
17
  filename = Rails.root.join('config', 'barbeque.yml').to_s
13
18
  hash = YAML.load(ERB.new(File.read(filename)).result)
14
- Hashie::Mash.new(hash[Rails.env])
19
+ Hashie::Mash.new(DEFAULT_CONFIG.merge(hash[Rails.env]))
15
20
  end
16
21
  end
17
22
 
@@ -0,0 +1,29 @@
1
+ require 'barbeque/configuration'
2
+
3
+ module Barbeque
4
+ module ExceptionHandler
5
+ class << self
6
+ def handle_exception(e)
7
+ handler.handle_exception(e)
8
+ end
9
+
10
+ private
11
+
12
+ def handler
13
+ @handler ||= const_get(Barbeque.config.exception_handler, false)
14
+ end
15
+ end
16
+
17
+ module RailsLogger
18
+ def self.handle_exception(e)
19
+ Rails.logger.error("#{e.inspect}\n#{e.backtrace.join("\n")}")
20
+ end
21
+ end
22
+
23
+ module Raven
24
+ def self.handle_exception(e)
25
+ ::Raven.capture_exception(e)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,3 +1,3 @@
1
1
  module Barbeque
2
- VERSION = '0.0.13'
2
+ VERSION = '0.0.14'
3
3
  end
@@ -1,3 +1,4 @@
1
+ require 'barbeque/exception_handler'
1
2
  require 'barbeque/message_handler'
2
3
  require 'barbeque/message_queue'
3
4
  require 'serverengine'
@@ -53,8 +54,7 @@ module Barbeque
53
54
  handler = MessageHandler.const_get(message.type, false)
54
55
  handler.new(message: message, job_queue: message_queue.job_queue).run
55
56
  rescue => e
56
- # Use Raven.capture_exception
57
- Rails.logger.fatal("[ERROR] #{e.inspect}\n#{e.backtrace.join("\n")}")
57
+ Barbeque::ExceptionHandler.handle_exception(e)
58
58
  end
59
59
 
60
60
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barbeque
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-28 00:00:00.000000000 Z
11
+ date: 2016-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adminlte2-rails
@@ -262,7 +262,7 @@ dependencies:
262
262
  - - ">="
263
263
  - !ruby/object:Gem::Version
264
264
  version: '0'
265
- description: Job queue interface to run job with Docker
265
+ description: Job queue system to run job with Docker
266
266
  email:
267
267
  - takashi-kokubun@cookpad.com
268
268
  executables: []
@@ -348,6 +348,7 @@ files:
348
348
  - lib/barbeque/configuration.rb
349
349
  - lib/barbeque/docker_image.rb
350
350
  - lib/barbeque/engine.rb
351
+ - lib/barbeque/exception_handler.rb
351
352
  - lib/barbeque/execution_log.rb
352
353
  - lib/barbeque/message.rb
353
354
  - lib/barbeque/message/base.rb
@@ -388,5 +389,5 @@ rubyforge_project:
388
389
  rubygems_version: 2.5.1
389
390
  signing_key:
390
391
  specification_version: 4
391
- summary: Job queue interface to run job with Docker
392
+ summary: Job queue system to run job with Docker
392
393
  test_files: []