robot_sweatshop 0.1.5 → 0.1.6

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: a4c125a8f67b9ce641d746be4fea9d5811924675
4
- data.tar.gz: b15915e3189e482a6130437040c6c8625e5dfdc2
3
+ metadata.gz: dba386e07d0e4cced4e3f798b2e8b0bad86f7fbf
4
+ data.tar.gz: d45191b2778dd0da0c68a3fa894af7b69adc6155
5
5
  SHA512:
6
- metadata.gz: 0cc634d9cd96a474729a12c5a8881fa83627ee6233b3d36e2923f43893f49593398ea2d8d98a663eb986b7f94b4b2ea4a483710f412677e040d485430be9cc02
7
- data.tar.gz: 69d52e4e53a8cfdc7acc50d9bc6456f0524fabe58b1c33cf392f87f67b54b411997f714cff1572aa6526776c8257185de461185285c627d5e5ddd11ccbb7fb0e
6
+ metadata.gz: bacf799921528b9999ba5f4bf14f007f471dc25804ac573f7a0024ee0911e5120bb8cdabd7525a74b2fa4fa8740b0461738fb2d9fe83d9c7012a3367f1eb7d99
7
+ data.tar.gz: 6f1799495398e16f2d50e3be43728513367dece4c5a7cca81354aaeb4893e656b85e88e869cb783e232fcce85c1631c25d3a0a578af10430ea098c439ccec9e2
data/README.md CHANGED
@@ -6,12 +6,11 @@ Robot Sweatshop is a single-purpose CI server that runs collections of arbitrary
6
6
 
7
7
  # Usage
8
8
 
9
- ```
10
- gem install robot_sweatshop
11
- sweatshop start
12
- ```
9
+ First install [ZMQ as described in the EZMQ gem](https://github.com/colstrom/ezmq). Then `gem install robot_sweatshop`.
13
10
 
14
- Robot Sweatshop uses Eye to handle its services and will set up and configure everything for you.
11
+ You can now use `sweatshop config` to configure the processes, `sweatshop setup` to ensure the directories in your config exist, and `sweatshop start` to run everything.
12
+
13
+ Robot Sweatshop uses [Eye](https://github.com/kostya/eye) to handle its processes so you can use its commandline tool to monitor their status.
15
14
 
16
15
  After configuring a job, POST a payload to `localhost:8080/:format/payload-for/:job`. For example, triggering a Bitbucket Git POST hook on `localhost:8080/bitbucket/payload-for/example` will parse the payload and run the 'example' job with the payload data in the environment.
17
16
 
@@ -24,20 +23,19 @@ Currently supported formats:
24
23
 
25
24
  # Configuration
26
25
 
27
- The server isn't much help without a job to run. Run `sudo -E sweatshop job <name>` to create a new job or edit an existing one.
28
-
29
- You can also use `sudo -E sweatshop config` to create and edit a user configuration at `/etc/robot_sweatshop/config.yaml`.
26
+ The server isn't much help without a job to run. Run `sweatshop job <name>` to create a new job or edit an existing one.
30
27
 
31
28
  Not sure if your job is valid? Run `sweatshop job --inspection <name>` to see if there's something you overlooked.
32
29
 
33
30
  # Security
34
31
 
35
- _TODO: Support for running as a custom user via eye uid/gid_
32
+ You probably don't want to run Robot Sweatshop as a sudo user. Create a testing user and group and point to them in the configuration file to run Robot Sweatshop processes with those permissions.
36
33
 
37
34
  # Roadmap
38
35
 
39
36
  - CLI job running
40
- - Common scrips such as git repo syncing
37
+ - custom/empty payloads
38
+ - Common scrips such as git repo syncing and creating a job run ID
41
39
  - Support for multiple workers
42
40
  - Better logging for the processes
43
41
  - Improved architecture:
data/bin/lib/setup.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'fileutils'
2
+ require 'configatron'
3
+ require_relative 'common'
4
+ require_relative '../../config'
5
+
6
+ config_directories = [
7
+ configatron.common.logfile_directory,
8
+ configatron.common.pidfile_directory,
9
+ configatron.common.user_config_directory,
10
+ configatron.queue.moneta_directory,
11
+ configatron.assembler.job_directory,
12
+ configatron.worker.workspace_directory
13
+ ]
14
+ config_directories.each do |directory|
15
+ user = configatron.common.user
16
+ group = configatron.common.group
17
+ if Dir.exists? directory
18
+ notify :info, "'#{directory}' already exists"
19
+ else
20
+ FileUtils.mkdir_p directory
21
+ notify :success, "Created '#{directory}' and set owner as #{user}:#{group}"
22
+ end
23
+ FileUtils.chown_R user, group, directory
24
+ notify :success, "Recursively set owner of '#{directory}' as #{user}:#{group}\n\n"
25
+ end
data/bin/sweatshop CHANGED
@@ -10,7 +10,7 @@ require_relative 'lib/config'
10
10
  require_relative '../config'
11
11
 
12
12
  program :name, 'Robot Sweatshop'
13
- program :version, '0.1.1'
13
+ program :version, '0.1.2'
14
14
  program :description, 'A lightweight, unopinionated CI server'
15
15
  program :help, 'Author', 'Justin Scott <jvscott@gmail.com>'
16
16
 
@@ -53,6 +53,14 @@ command :stop do |c|
53
53
  end
54
54
  end
55
55
 
56
+ command :setup do |c|
57
+ c.syntax = 'sweatshop setup'
58
+ c.description = 'Create the directories and set permissions as specified in the config.'
59
+ c.action do
60
+ require_relative 'lib/setup'
61
+ end
62
+ end
63
+
56
64
  command :directory do |c|
57
65
  c.syntax = 'sweatshop directory'
58
66
  c.description = 'Return the path that Robot Sweatshop runs from.'
data/config.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'fileutils'
2
1
  require 'configatron'
3
2
  require 'yaml'
4
3
 
@@ -15,16 +14,3 @@ configurations.each do |config_path|
15
14
  configatron.configure_from_hash hash
16
15
  end
17
16
  end
18
-
19
- config_directories = [
20
- configatron.common.logfile_directory,
21
- configatron.common.pidfile_directory,
22
- configatron.common.user_config_directory,
23
- configatron.queue.moneta_directory,
24
- configatron.assembler.job_directory,
25
- configatron.worker.workspace_directory
26
- ]
27
- config_directories.each do |directory|
28
- FileUtils.mkdir_p directory unless Dir.exists? directory
29
- # TODO: set chmod to appropriate user
30
- end
data/config.yaml CHANGED
@@ -2,6 +2,8 @@ common:
2
2
  pidfile_directory: /var/run/robot_sweatshop
3
3
  logfile_directory: /var/log/robot_sweatshop
4
4
  user_config_directory: /etc/robot_sweatshop
5
+ user: jscott
6
+ group: nogroup
5
7
 
6
8
  input:
7
9
  http:
data/robot_sweatshop.eye CHANGED
@@ -12,6 +12,8 @@ Eye.application :robot_sweatshop do
12
12
  trigger :flapping, times: 10, within: 1.minute, retry_in: 10.minutes
13
13
  check :cpu, every: 10.seconds, below: 100, times: 3
14
14
  working_dir "#{__dir__}/lib"
15
+ uid "#{configatron.common.user}"
16
+ gid "#{configatron.common.group}"
15
17
 
16
18
  group 'input' do
17
19
  process :http do
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'robot_sweatshop'
3
- gem.version = '0.1.5'
3
+ gem.version = '0.1.6'
4
4
  gem.licenses = 'MIT'
5
5
  gem.authors = ['Justin Scott']
6
6
  gem.email = 'jvscott@gmail.com'
@@ -12,6 +12,8 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = `git ls-files -- kintama/**/*`.split("\n")
13
13
  gem.executables = `git ls-files -- bin/sweatshop`.split("\n").map { |f| File.basename(f) }
14
14
 
15
+ gem.required_ruby_version = '>= 2.1'
16
+
15
17
  gem.add_runtime_dependency 'sinatra'
16
18
  gem.add_runtime_dependency 'ezmq'
17
19
  gem.add_runtime_dependency 'faker'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robot_sweatshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Scott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -181,6 +181,7 @@ files:
181
181
  - bin/lib/config.rb
182
182
  - bin/lib/inspect.rb
183
183
  - bin/lib/job.rb
184
+ - bin/lib/setup.rb
184
185
  - bin/lib/start.rb
185
186
  - bin/sweatshop
186
187
  - config.rb
@@ -228,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
229
  requirements:
229
230
  - - ">="
230
231
  - !ruby/object:Gem::Version
231
- version: '0'
232
+ version: '2.1'
232
233
  required_rubygems_version: !ruby/object:Gem::Requirement
233
234
  requirements:
234
235
  - - ">="