vx-worker 0.3.0.pre0 → 0.3.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a191dee94cb01a6620420e3739eab93dae138e1
4
- data.tar.gz: 32849707818830f282a6af4c0f9e83d7cc9d7f91
3
+ metadata.gz: f90646fd30f7005ecc81621ae81743e794a30acc
4
+ data.tar.gz: caf487d0602e547e7a079d616b9939358801f159
5
5
  SHA512:
6
- metadata.gz: 3a66ad52567249f726d3f685906e81b0bbc67bda4adeeab76fe0780f5ed05cf6a739f6c5854e46cbaa1f204d85d104e39d6ee777cb1677e35996f0c18632fcab
7
- data.tar.gz: acd583b29ea3b59afd002c42ce87fc3e37f56f8fdfb6528d42e5bb1745aefa69488d2f78d85006512c98ddca51b11edcf627d3941290c01d9a705e95bab6ff9a
6
+ metadata.gz: df8bd48f4532605208141ff4eacffe77fdf51abf310afb91c9582ab47c6006c50bce33f66c74dcea6446a52b25e58453d0860431c89cb311e7c9f74c3ea98c94
7
+ data.tar.gz: dba72da68461c00e9cbeec6c4bf1ebe859ac9b56819a7b7bfc165e4ebda8d20b797e15b65fc7d3ed612f87fef632da16f3cb95838f1e60d2a4bd33f0fad5a670
data/.gitignore CHANGED
@@ -18,3 +18,8 @@ tmp
18
18
  fixtures/
19
19
  .tmp/
20
20
  .vagrant/
21
+ dist/vx-worker.dsc
22
+ dist/debian.control
23
+ dist/debian.changelog
24
+ dist/debian.rules
25
+ log/
data/.travis.yml CHANGED
@@ -2,4 +2,5 @@ rvm:
2
2
  - 2.0.0
3
3
  - 2.1.0
4
4
 
5
+ before_script: mkdir -p log
5
6
  script: "bundle exec rake travis"
data/bin/vx-worker CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.expand_path("../../lib/vx/worker", __FILE__)
3
+ require File.expand_path("../../lib/vx/worker", File.realdirpath(__FILE__))
4
4
 
5
5
  cli = Vx::Worker::CLI.new
6
6
  cli.run
data/lib/vx/worker/cli.rb CHANGED
@@ -7,7 +7,6 @@ module Vx
7
7
  class CLI
8
8
 
9
9
  include Helper::Config
10
- include Helper::Logger
11
10
  include Common::EnvFile
12
11
 
13
12
  def initialize
@@ -1,6 +1,4 @@
1
1
  require 'hashr'
2
- require 'logger'
3
- require 'vx/common/tagged_logging'
4
2
 
5
3
  module Vx
6
4
  module Worker
@@ -8,15 +6,12 @@ module Vx
8
6
 
9
7
  extend Hashr::EnvDefaults
10
8
 
11
- @@null_logger = Logger.new("/dev/null")
12
-
13
9
  self.env_namespace = 'vx'
14
10
  self.raise_missing_keys = true
15
11
 
16
12
  define amqp_url: nil,
17
13
  run: "docker",
18
14
  timeout: 30 * 60,
19
- logger: Common::TaggedLogging.new(Logger.new STDOUT),
20
15
 
21
16
  workers: 1,
22
17
  path_prefix: nil,
@@ -45,10 +40,6 @@ module Vx
45
40
  self[:path_prefix] || Dir.pwd
46
41
  end
47
42
 
48
- def null_logger
49
- @@null_logger
50
- end
51
-
52
43
  def connector_options
53
44
  self[self.run]
54
45
  end
@@ -14,13 +14,11 @@ module Vx
14
14
  model Message::PerformJob
15
15
 
16
16
  def perform(message)
17
- Worker.logger.tagged self.class.consumer_id do
18
- job = Job.new message
19
- number = Thread.current[:consumer_id] || 0
20
- path_prefix = "/tmp/.test/job.#{number}"
21
- Worker.perform(job, path_prefix)
22
- ack!
23
- end
17
+ job = Job.new message
18
+ number = Thread.current[:consumer_id] || 0
19
+ path_prefix = "/tmp/.worker/job.#{number}"
20
+ Worker.perform(job, path_prefix)
21
+ ack!
24
22
  end
25
23
 
26
24
  end
@@ -18,7 +18,7 @@ module Vx
18
18
  end
19
19
 
20
20
  def initialize(job, _)
21
- @job = job
21
+ @job = job
22
22
  end
23
23
 
24
24
  def perform
@@ -0,0 +1,13 @@
1
+ require 'active_support/notifications'
2
+
3
+ module Vx
4
+ module Worker
5
+ module Helper::Instrument
6
+
7
+ def instrument(event, payload, &block)
8
+ ActiveSupport::Notifications.instrument("#{event}.worker", payload, &block)
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ require 'airbrake'
2
+
3
+ Airbrake.configure do |config|
4
+ if ENV['AIRBRAKE_API_KEY']
5
+ config.api_key = ENV['AIRBRAKE_API_KEY']
6
+ config.host = ENV['AIRBRAKE_HOST']
7
+ config.port = ENV['AIRBRAKE_PORT'] || 80
8
+ config.secure = config.port == 443
9
+ end
10
+ end
@@ -1,3 +1,31 @@
1
+ require 'airbrake'
1
2
  require 'vx/common/amqp'
3
+ require 'active_support/notifications'
2
4
 
3
- Vx::Common::AMQP.setup(Vx::Worker.logger, url: Vx::Worker.config.amqp_url)
5
+ module Vx
6
+ module Worker
7
+ module AMQP
8
+ Middleware = Struct.new(:app) do
9
+ def call(env)
10
+ prop = env[:properties] || {}
11
+ head = prop[:headers] || {}
12
+
13
+ Vx::Instrumentation.with("@fields" => head) do
14
+ app.call(env)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ Vx::Common::AMQP.configure do |c|
23
+ c.content_type = 'application/x-protobuf'
24
+ c.instrumenter = ActiveSupport::Notifications
25
+ c.on_error = ->(e, env) {
26
+ Vx::Instrumentation.handle_exception("worker", e, env)
27
+ Airbrake.notify(e, env)
28
+ }
29
+ c.use :pub, Vx::Worker::AMQP::Middleware
30
+ c.use :sub, Vx::Worker::AMQP::Middleware
31
+ end
@@ -0,0 +1,3 @@
1
+ require 'vx/instrumentation'
2
+
3
+ Vx::Instrumentation.install "#{Vx::Worker.root}/log/worker.json"
data/lib/vx/worker/job.rb CHANGED
@@ -5,8 +5,6 @@ module Vx
5
5
  module Worker
6
6
  class Job
7
7
 
8
- include Helper::Logger
9
-
10
8
  attr_reader :output, :message, :output_counter
11
9
 
12
10
  def initialize(perform_job_message)
@@ -17,7 +15,13 @@ module Vx
17
15
 
18
16
  def add_to_output(str)
19
17
  output << str
20
- logger.debug str.strip if logger.level == 0
18
+ end
19
+
20
+ def instrumentation
21
+ {
22
+ job_id: message.job_id,
23
+ build_id: message.id
24
+ }
21
25
  end
22
26
 
23
27
  def add_command_to_output(cmd)
@@ -40,7 +44,13 @@ module Vx
40
44
  tm: output_counter,
41
45
  log: str
42
46
  )
43
- JobLogsConsumer.publish log
47
+ JobLogsConsumer.publish(
48
+ log,
49
+ headers: {
50
+ build_id: log.build_id,
51
+ job_id: log.job_id
52
+ }
53
+ )
44
54
  log
45
55
  end
46
56
 
@@ -3,15 +3,11 @@ module Vx
3
3
 
4
4
  LogJob = Struct.new(:app) do
5
5
 
6
- include Helper::Logger
6
+ include Helper::Instrument
7
7
 
8
8
  def call(env)
9
- logger.tagged("job #{env.job.message.id}.#{env.job.message.job_id}") do
10
- logger.info "starting job"
11
- rs = app.call env
12
- logger.info "done job"
13
- rs
14
- end
9
+ instrument("starting_job", env.job.instrumentation)
10
+ app.call env
15
11
  end
16
12
 
17
13
  end
@@ -5,14 +5,19 @@ module Vx
5
5
 
6
6
  RunScript = Struct.new(:app) do
7
7
 
8
- include Helper::Logger
9
8
  include Helper::Config
9
+ include Helper::Instrument
10
10
  include Common::Helper::UploadShCommand
11
11
 
12
12
  def call(env)
13
13
  if env.spawner
14
- code = run_script(env)
15
- run_after_script(env)
14
+ code = instrument("run_script", env.job.instrumentation) do
15
+ run_script(env)
16
+ end
17
+
18
+ instrument("run_after_script", env.job.instrumentation) do
19
+ run_after_script(env)
20
+ end
16
21
 
17
22
  if code == 0
18
23
  app.call env
@@ -8,25 +8,28 @@ module Vx
8
8
  StartConnector = Struct.new(:app) do
9
9
 
10
10
  include Helper::Config
11
- include Helper::Logger
11
+ include Helper::Instrument
12
12
 
13
13
  def call(env)
14
14
  options = config.connector_options
15
- options.merge! logger: logger
16
15
  env.connector = ContainerConnector.lookup(config.run, options)
16
+
17
+ instrument("starting_container", env.job.instrumentation)
18
+
17
19
  env.connector.start do |spawner|
18
20
  env.job.add_to_output "using #{Socket.gethostname}##{spawner.id}\n"
19
- logger.tagged("#{spawner.id}") do
20
- begin
21
- env.spawner = spawner
22
- app.call env
23
- ensure
24
- env.spawner = spawner
25
- end
21
+
22
+ instrument("container_started", env.job.instrumentation.merge(container: spawner.id))
23
+
24
+ begin
25
+ env.spawner = spawner
26
+ app.call env
27
+ ensure
28
+ env.spawner = spawner
26
29
  end
27
30
  end
28
31
  end
29
- end
30
32
 
33
+ end
31
34
  end
32
35
  end
@@ -1,12 +1,13 @@
1
1
  require 'vx/message'
2
2
  require 'vx/common/error_notifier'
3
+ require 'airbrake'
3
4
 
4
5
  module Vx
5
6
  module Worker
6
7
 
7
8
  UpdateJobStatus = Struct.new(:app) do
8
9
 
9
- include Helper::Logger
10
+ include Helper::Instrument
10
11
 
11
12
  STARTED = 2
12
13
  FINISHED = 3
@@ -22,9 +23,9 @@ module Vx
22
23
  rescue ::Timeout::Error => e
23
24
  env.job.add_to_output("\n\nERROR: #{e.message}\n")
24
25
  rescue ::Exception => e
25
- env.job.add_to_output("\n\nERROR: #{e.inspect}\n")
26
- logger.error("ERROR: #{e.inspect}\n BACKTRACE:\n#{e.backtrace.map{|i| " #{i}" }.join("\n")}")
27
- Common::ErrorNotifier.notify(e)
26
+ $stderr.puts "#{e.inspect}"
27
+ $stderr.puts e.backtrace.map{|b| " #{b}" }.join("\n")
28
+ Airbrake.notify(e, (env || {}).to_h)
28
29
  end
29
30
 
30
31
  msg = "\nDone. Your build exited with %s.\n"
@@ -45,6 +46,10 @@ module Vx
45
46
  private
46
47
 
47
48
  def update_status(job, status)
49
+ instrument(
50
+ "update_job_status",
51
+ job.instrumentation.merge(status: status)
52
+ )
48
53
  publish_status create_message(job, status)
49
54
  end
50
55
 
@@ -60,8 +65,13 @@ module Vx
60
65
  end
61
66
 
62
67
  def publish_status(message)
63
- logger.info "delivered job status #{message.inspect}"
64
- JobStatusConsumer.publish message
68
+ JobStatusConsumer.publish(
69
+ message,
70
+ headers: {
71
+ build_id: message.build_id,
72
+ job_id: message.job_id
73
+ }
74
+ )
65
75
  end
66
76
 
67
77
  end
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module Worker
3
- VERSION = "0.3.0.pre0"
3
+ VERSION = "0.3.0.pre1"
4
4
  end
5
5
  end
data/lib/vx/worker.rb CHANGED
@@ -25,8 +25,8 @@ module Vx
25
25
  autoload :RunScript, File.expand_path("../worker/middlewares/run_script", __FILE__)
26
26
 
27
27
  module Helper
28
- autoload :Logger, File.expand_path("../worker/helper/logger", __FILE__)
29
28
  autoload :Config, File.expand_path("../worker/helper/config", __FILE__)
29
+ autoload :Instrument, File.expand_path("../worker/helper/instrument", __FILE__)
30
30
  end
31
31
 
32
32
  extend self
@@ -34,14 +34,6 @@ module Vx
34
34
  @@root = Pathname.new File.expand_path('../../..', __FILE__)
35
35
  @@config_mutex = Mutex.new
36
36
 
37
- def logger
38
- if ENV['CI_WORKER_SILENT']
39
- config.null_logger
40
- else
41
- config.logger
42
- end
43
- end
44
-
45
37
  def configure
46
38
  yield config
47
39
  config
@@ -7,9 +7,10 @@ describe Vx::Worker::Job do
7
7
  subject { job }
8
8
 
9
9
  context "just created" do
10
- its(:message) { should eq message }
11
- its(:output) { should be_an_instance_of(Vx::Common::OutputBuffer) }
12
- its(:output_counter) { should eq 0 }
10
+ its(:message) { should eq message }
11
+ its(:output) { should be_an_instance_of(Vx::Common::OutputBuffer) }
12
+ its(:output_counter) { should eq 0 }
13
+ its(:instrumentation) { should eq(job_id: 2, build_id: 1) }
13
14
  end
14
15
 
15
16
  context "publish_job_log_message" do
data/spec/spec_helper.rb CHANGED
@@ -23,5 +23,6 @@ RSpec.configure do |config|
23
23
  }
24
24
  =end
25
25
  end
26
+ Vx::Worker.initialize!
26
27
  end
27
28
  end
data/vx-worker.gemspec CHANGED
@@ -20,8 +20,10 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency 'vx-common', "= 0.2.1"
22
22
  spec.add_runtime_dependency 'vx-message', "= 0.4.1"
23
- spec.add_runtime_dependency 'vx-container_connector', "= 0.2.3"
24
- spec.add_runtime_dependency 'vx-common-amqp', '~> 0.2.6'
23
+ spec.add_runtime_dependency 'vx-container_connector', "= 0.2.6"
24
+ spec.add_runtime_dependency 'vx-common-amqp', '= 0.3.7'
25
+ spec.add_runtime_dependency 'vx-instrumentation', '= 0.0.8'
26
+
25
27
  spec.add_runtime_dependency 'hashr', '= 0.0.22'
26
28
 
27
29
  spec.add_development_dependency "bundler", "~> 1.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vx-worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.pre0
4
+ version: 0.3.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-24 00:00:00.000000000 Z
11
+ date: 2014-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vx-common
@@ -44,28 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.2.3
47
+ version: 0.2.6
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.2.3
54
+ version: 0.2.6
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: vx-common-amqp
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.2.6
61
+ version: 0.3.7
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.2.6
68
+ version: 0.3.7
69
+ - !ruby/object:Gem::Dependency
70
+ name: vx-instrumentation
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.0.8
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.0.8
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: hashr
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -124,17 +138,6 @@ files:
124
138
  - Rakefile
125
139
  - Vagrantfile
126
140
  - bin/vx-worker
127
- - dist/build.sh
128
- - dist/debian/changelog.mk
129
- - dist/debian/ci_env
130
- - dist/debian/compat
131
- - dist/debian/control.mk
132
- - dist/debian/postrm
133
- - dist/debian/preinst
134
- - dist/debian/rules
135
- - dist/debian/script
136
- - dist/debian/source/format
137
- - dist/debian/upstart
138
141
  - docker/.gitignore
139
142
  - docker/Dockerfile
140
143
  - docker/build.sh
@@ -169,8 +172,10 @@ files:
169
172
  - lib/vx/worker/docker.rb
170
173
  - lib/vx/worker/ext/string.rb
171
174
  - lib/vx/worker/helper/config.rb
172
- - lib/vx/worker/helper/logger.rb
175
+ - lib/vx/worker/helper/instrument.rb
176
+ - lib/vx/worker/initializers/airbrake.rb
173
177
  - lib/vx/worker/initializers/amqp.rb
178
+ - lib/vx/worker/initializers/instrumentation.rb
174
179
  - lib/vx/worker/job.rb
175
180
  - lib/vx/worker/local.rb
176
181
  - lib/vx/worker/middlewares/log_job.rb
data/dist/build.sh DELETED
@@ -1,77 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- PACKAGE_NAME="vx-worker"
6
-
7
- GIT_LAST_LOG=$(git log -n1 --format=oneline)
8
- GIT_BUILD_NUMBER=$(git rev-list HEAD | wc -l | sed -e 's/ *//g' | xargs -n1 printf %04d)
9
- GIT_LAST_TAG=$(git describe --abbrev=0 --tags)
10
- GIT_VERSION=$(echo $GIT_LAST_TAG | sed -e "s/^v//g")
11
- GIT_DATE=$(git log -n1 --format="%aD")
12
-
13
- RELEASE_VERSION=$(echo $GIT_VERSION | ruby -e "puts Gem::Version.new(STDIN.read).release.to_s")
14
- RELEASE_SHORT_VERSION=$(echo $GIT_VERSION | ruby -e "puts Gem::Version.new(STDIN.read).release.to_s.split('.')[0..1].join('.')")
15
-
16
- VERSION="${RELEASE_VERSION}.rev${GIT_BUILD_NUMBER}"
17
- PACKAGE_NAME_AND_VERSION="${PACKAGE_NAME}_${VERSION}"
18
- WORKDIR=".tmp/${PACKAGE_NAME_AND_VERSION}"
19
-
20
- function notice() {
21
- echo " ---> $1"
22
- }
23
-
24
- function git_export () {
25
- rm -rf .tmp
26
- mkdir -p $WORKDIR
27
- notice "export code to $WORKDIR"
28
- git archive master | tar -x -C $WORKDIR
29
- }
30
-
31
- function package_gems () {
32
- notice "packaging gems"
33
- (cd $WORKDIR && bundle package > /dev/null)
34
- }
35
-
36
- function generate_debian () {
37
- notice "generating debian scripts"
38
-
39
- dst=${WORKDIR}/debian
40
- src=dist/debian
41
-
42
- pushd .tmp > /dev/null
43
- tar -czf "${PACKAGE_NAME_AND_VERSION}.orig.tar.gz" ${PACKAGE_NAME_AND_VERSION}
44
- popd > /dev/null
45
-
46
- cp -r $src $dst
47
-
48
- cat $dst/control.mk | sed -e "s/%PACKAGE_NAME%/${PACKAGE_NAME}/g" > $dst/control
49
- cat $dst/changelog.mk | sed -e "s/%VERSION%/${VERSION}/g" | sed -e "s/%DATE%/${GIT_DATE}/g" > $dst/changelog
50
- }
51
-
52
- function run_vagrant () {
53
- notice "run build in vagrant"
54
-
55
- cat > .tmp/build.sh <<EOF
56
- set -e
57
- set -x
58
-
59
- (cd ${PACKAGE_NAME_AND_VERSION} && debuild -i -us -uc -S)
60
-
61
- mv ${PACKAGE_NAME_AND_VERSION} work
62
- EOF
63
- vagrant up
64
- vagrant provision
65
- }
66
-
67
-
68
- function build () {
69
- notice "Building ${PACKAGE_NAME_AND_VERSION}"
70
-
71
- git_export
72
- package_gems
73
- generate_debian
74
- run_vagrant
75
- }
76
-
77
- build
@@ -1,6 +0,0 @@
1
- vx-worker (%VERSION%) UNRELEASED; urgency=low
2
-
3
- * bump
4
-
5
- -- Dmitry Galinsky <dima.exe@gmail.com> %DATE%
6
-
data/dist/debian/ci_env DELETED
@@ -1,7 +0,0 @@
1
- # RABBITMQ_URL=amqp://guest:guest@localhost/%2f
2
-
3
- # VX_WORKERS=4
4
- # VX_DOCKER_IMAGE=dmexe/precise
5
-
6
- # AIRBRAKE_API_KEY=<key>
7
- # AIRBRAKE_HOST=<host>
data/dist/debian/compat DELETED
@@ -1 +0,0 @@
1
- 5
@@ -1,12 +0,0 @@
1
- Source: vx-worker
2
- Section: ruby
3
- Priority: optional
4
- Maintainer: Dmitry Galinsky <dima.exe@gmail.com>
5
- Build-Depends: debhelper (>= 9.0), vx-embeded-ruby, vx-embeded-bundler, git-core
6
- Standards-Version: 3.9.3
7
- Homepage: http://www.ruby-lang.org/
8
-
9
- Package: %PACKAGE_NAME%
10
- Architecture: any
11
- Depends: ${shlibs:Depends}, ${misc:Depends}, vx-embeded-ruby, vx-embeded-bundler, adduser
12
- Description: Vexor worker.
data/dist/debian/postrm DELETED
@@ -1,35 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- # summary of how this script can be called:
6
- # * <postrm> `remove'
7
- # * <postrm> `purge'
8
- # * <old-postrm> `upgrade' <new-version>
9
- # * <new-postrm> `failed-upgrade' <old-version>
10
- # * <new-postrm> `abort-install'
11
- # * <new-postrm> `abort-install' <old-version>
12
- # * <new-postrm> `abort-upgrade' <old-version>
13
- # * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
14
- # for details, see http://www.debian.org/doc/debian-policy/ or
15
- # the debian-policy package
16
-
17
- case "$1" in
18
- purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
19
- if test "x$1" == "xpurge"
20
- then
21
- userdel -r vx-worker || true
22
- rm -rf /var/lib/vexor/worker
23
- rm -f /var/log/upstart/vx-worker.log
24
- fi
25
- ;;
26
-
27
- *)
28
- echo "postrm called with unknown argument \`$1'" >&2
29
- exit 0
30
- esac
31
-
32
- #DEBHELPER#
33
-
34
- exit 0
35
-
data/dist/debian/preinst DELETED
@@ -1,27 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- # summary of how this script can be called:
6
- # * <new-preinst> `install'
7
- # * <new-preinst> `install' <old-version>
8
- # * <new-preinst> `upgrade' <old-version>
9
- # * <old-preinst> `abort-upgrade' <new-version>
10
- #
11
- # for details, see http://www.debian.org/doc/debian-policy/ or
12
- # the debian-policy package
13
-
14
- if [ "$1" == "install" ] || [ "$1" == "upgrade" ]; then
15
-
16
- if ! id vx-worker 1> /dev/null 2>&1; then
17
- groupadd -f -r vx-worker
18
- useradd -d /var/lib/vexor/worker -g vx-worker -G docker -c "Vexor worker daemon" -s /usr/sbin/nologin -r vx-worker
19
- fi
20
-
21
- install -m 750 -o vx-worker -g vx-worker -d /var/lib/vexor/worker
22
- fi
23
-
24
- #DEBHELPER#
25
-
26
- exit 0
27
-
data/dist/debian/rules DELETED
@@ -1,22 +0,0 @@
1
- #!/usr/bin/make -f
2
- # Sample debian/rules that uses debhelper.
3
- # GNU copyright 1997 to 1999 by Joey Hess.
4
-
5
- BUNDLE = /opt/vexor/bin/bundle
6
- DIST = $(shell pwd)/debian/vx-worker/opt/vexor/worker
7
-
8
- %:
9
- dh $@
10
-
11
- override_dh_auto_install:
12
- $(BUNDLE) install --without development --local --standalone
13
- mkdir -p $(DIST)
14
- cp -r bin $(DIST)
15
- cp -r docker $(DIST)
16
- cp -r lib $(DIST)
17
- cp -r bundle $(DIST)
18
- rm -rf $(DIST)/debian
19
- mkdir -p debian/vx-worker/etc/vexor
20
- install -m 0644 debian/ci_env debian/vx-worker/etc/vexor/ci
21
- mkdir -p debian/vx-worker/opt/vexor/bin
22
- install -m 0755 debian/script debian/vx-worker/opt/vexor/bin/worker
data/dist/debian/script DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
-
3
- RUBY=/opt/vexor/ruby/bin/ruby
4
- REQ=/opt/vexor/worker/bundle/bundler/setup.rb
5
-
6
- exec ${RUBY} -r ${REQ} /opt/vexor/worker/bin/vx-worker $*
@@ -1 +0,0 @@
1
- 1.0
data/dist/debian/upstart DELETED
@@ -1,18 +0,0 @@
1
- description "start and stop the vexor worker"
2
- version "1.0"
3
-
4
- start on filesystem or runlevel [2345]
5
- stop on runlevel [!2345]
6
-
7
- respawn
8
-
9
- console log
10
-
11
- script
12
- home=/var/lib/vexor/worker
13
- user=vx-worker
14
- command=/opt/vexor/bin/worker
15
-
16
- chdir $home
17
- su -s /bin/sh -c "exec $command" $user
18
- end script
@@ -1,11 +0,0 @@
1
- module Vx
2
- module Worker
3
- module Helper::Logger
4
-
5
- def logger
6
- Worker.logger
7
- end
8
-
9
- end
10
- end
11
- end