haile 0.4.3 → 1.0.0
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 +4 -4
- data/bin/haile +13 -32
- data/haile.gemspec +1 -0
- data/lib/haile/client.rb +13 -6
- data/lib/haile/version.rb +1 -1
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db770953f74bb5bcb8041ce341cdefc7e2fd2669
|
4
|
+
data.tar.gz: d098d73d67bd058ad36451cb2ffb65fb8dfe03c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0852eefb5573646bde1b98b0b323a1ccc5602f124de955aaf6a098a3166d1cf0e902cf65e79bba8aa0c7d8329b007cc585ffa9b34b80ced0718947f729176fcf
|
7
|
+
data.tar.gz: 5a478cd0deeff304daa58aac98cf8dcee85c781ff82c5184e47526f596eefbc2043d0d033aa68bb91b412ccef3c968e267b909ff37111f25995259bd49930b74
|
data/bin/haile
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'haile'))
|
4
4
|
require 'trollop'
|
5
5
|
|
6
|
-
SUB_COMMANDS = %w[endpoints kill kill_tasks
|
6
|
+
SUB_COMMANDS = %w[endpoints kill kill_tasks upstart scale list list_tasks search docker_deploy]
|
7
7
|
|
8
8
|
global_opts = Trollop.options do
|
9
9
|
version Haile::VERSION
|
@@ -12,14 +12,14 @@ Usage: haile [global options] [command] [options]
|
|
12
12
|
|
13
13
|
Available commands:
|
14
14
|
|
15
|
-
kill
|
16
|
-
kill_tasks
|
17
|
-
list
|
18
|
-
list_tasks
|
19
|
-
scale
|
20
|
-
search
|
21
|
-
|
22
|
-
docker_deploy
|
15
|
+
kill Kill an app and remove it from Marathon.
|
16
|
+
kill_tasks Kill a task or tasks belonging to a specified app.
|
17
|
+
list Show a list of running apps and their options.
|
18
|
+
list_tasks Show a list of an app's running tasks.
|
19
|
+
scale Scale the number of app instances.
|
20
|
+
search Search the current list of apps.
|
21
|
+
upstart Start a new app, or update existing app from a config file
|
22
|
+
docker_deploy Update the docker image tag of an app.
|
23
23
|
|
24
24
|
Global options:
|
25
25
|
EOS
|
@@ -48,17 +48,9 @@ cmd_opts = case cmd
|
|
48
48
|
Trollop.options do
|
49
49
|
opt :id, 'A unique identifier for the app.', :short => '-i', :required => true, :type => String
|
50
50
|
end
|
51
|
-
when '
|
51
|
+
when 'upstart'
|
52
52
|
Trollop.options do
|
53
|
-
opt :
|
54
|
-
opt :command, 'The command to start the app.', :short => '-C', :type => String
|
55
|
-
opt :executor, 'The mesos executor to be used to launch the app.', :short => '-X', :type => String
|
56
|
-
opt :num_instances, 'The number of instances to run (default 1).', :default => 1, :short => '-n'
|
57
|
-
opt :cpus, 'The number of CPUs to give to this app, can be a fraction (default 1.0).', :default => 1.0, :short => '-c'
|
58
|
-
opt :mem, 'The memory limit for this app, in MB, can be a fraction (default 10.0).', :default => 10.0, :short => '-m'
|
59
|
-
opt :uri, 'URIs to download and unpack into the working directory.', :short => '-u', :type => :strings
|
60
|
-
opt :env, 'Environment variables to add to the process, as NAME=VALUE.', :short => '-e', :type => :strings
|
61
|
-
opt :constraint, 'Placement constraint for tasks, e.g. hostname:UNIQUE or rackid:CLUSTER', :type => :strings
|
53
|
+
opt :config, 'The JSON config file for this app.', :required => true, :short => '-c', :type => String
|
62
54
|
end
|
63
55
|
when 'scale'
|
64
56
|
Trollop.options do
|
@@ -124,19 +116,8 @@ end
|
|
124
116
|
case cmd
|
125
117
|
when 'endpoints'
|
126
118
|
puts haile.endpoints(cmd_opts[:id]).parsed_response
|
127
|
-
when '
|
128
|
-
|
129
|
-
:instances => cmd_opts[:num_instances] || 1,
|
130
|
-
:uris => cmd_opts[:uri] || [],
|
131
|
-
:cmd => cmd_opts[:command],
|
132
|
-
:env => cmd_opts[:env].nil? ? {} : Hash[cmd_opts[:env].map { |e| e.split('=', 2) }],
|
133
|
-
:cpus => cmd_opts[:cpus] || 1.0,
|
134
|
-
:mem => cmd_opts[:mem] || 10.0,
|
135
|
-
:constraints => (cmd_opts[:constraint] || []).map { |c| c.split(':') }
|
136
|
-
}
|
137
|
-
app_opts[:executor] = cmd_opts[:executor] unless cmd_opts[:executor] == nil
|
138
|
-
puts "Starting app '#{cmd_opts[:id]}'"
|
139
|
-
puts haile.start(cmd_opts[:id], app_opts)
|
119
|
+
when 'upstart'
|
120
|
+
haile.upstart(cmd_opts[:config])
|
140
121
|
when 'scale'
|
141
122
|
puts "Scaling app '#{cmd_opts[:id]}' to #{cmd_opts[:num_instances]} instances"
|
142
123
|
res = haile.scale(cmd_opts[:id], cmd_opts[:num_instances])
|
data/haile.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_dependency "trollop", "~> 2.0"
|
21
21
|
spec.add_dependency "httparty", "~> 0.11"
|
22
22
|
spec.add_dependency "multi_json", "~> 1.8"
|
23
|
+
spec.add_dependency 'colorize', '~> 0.7.7', '>= 0.7.7'
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
26
|
spec.add_development_dependency "rake", "~> 0"
|
data/lib/haile/client.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'multi_json'
|
3
|
+
require 'colorize'
|
3
4
|
|
4
5
|
module Haile
|
5
6
|
class Client
|
@@ -60,10 +61,17 @@ module Haile
|
|
60
61
|
wrap_request(:get, url)
|
61
62
|
end
|
62
63
|
|
63
|
-
def
|
64
|
-
body =
|
65
|
-
|
66
|
-
wrap_request(:
|
64
|
+
def upstart(config_file)
|
65
|
+
body = JSON.parse(open(config_file).read)
|
66
|
+
id = body['id']
|
67
|
+
app = wrap_request(:get, "/v2/apps/#{id}").parsed_response['app']
|
68
|
+
if !!app
|
69
|
+
puts "Updating app #{id}...".green
|
70
|
+
wrap_request(:put, "/v2/apps/#{id}", :body => body)
|
71
|
+
else
|
72
|
+
puts "Starting app #{id}...".blue
|
73
|
+
wrap_request(:post, '/v2/apps/', :body => body)
|
74
|
+
end
|
67
75
|
end
|
68
76
|
|
69
77
|
def docker_deploy(id, image)
|
@@ -82,8 +90,7 @@ module Haile
|
|
82
90
|
"with a docker image."
|
83
91
|
return Haile::Response.error(msg)
|
84
92
|
end
|
85
|
-
|
86
|
-
puts "#{id}: #{resp.to_s}"
|
93
|
+
wrap_request(:put, "/v2/apps/#{id}", :body => app)
|
87
94
|
end
|
88
95
|
|
89
96
|
def scale(id, num_instances)
|
data/lib/haile/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobi Knaup
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-09-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: trollop
|
@@ -53,6 +53,26 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '1.8'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: colorize
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.7.7
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.7.7
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 0.7.7
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.7.7
|
56
76
|
- !ruby/object:Gem::Dependency
|
57
77
|
name: bundler
|
58
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
139
|
version: '0'
|
120
140
|
requirements: []
|
121
141
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.5.1
|
123
143
|
signing_key:
|
124
144
|
specification_version: 4
|
125
145
|
summary: Ruby client for Marathon REST API
|