appfront 1.1.2 → 1.1.5
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/lib/appfront/command.rb +1 -1
- data/lib/appfront/command/alias.rb +1 -1
- data/lib/appfront/command/clusters.rb +77 -8
- data/lib/appfront/command/deploys.rb +16 -6
- data/lib/appfront/command/domains.rb +1 -1
- data/lib/appfront/command/help.rb +7 -7
- data/lib/appfront/command/logs.rb +3 -0
- data/lib/appfront/command/ps.rb +3 -20
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d8fbd24675c2d2e610a25c286472775cfed2c59
|
4
|
+
data.tar.gz: 9b5e8bedad0c80cf1e9ee21d6fb19807360552ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5785e91792aa30388b42d4c50a44bc0405d90f5692fa3ded3f2061ae265beb476d70b93a11f4de2d3cfacfc37e48b6acbb4626fd291b21968fa0e026414a8e8f
|
7
|
+
data.tar.gz: 361f3a7566298ee5b4a04aacebff7e780f763457a66006f05e8352dd216c7954d564c2ff378624826c8bf0cbed0e64ce7cac9db2619d89ec71691544dca56a2c
|
data/lib/appfront/command.rb
CHANGED
@@ -1,25 +1,95 @@
|
|
1
1
|
class Appfront::Command::Clusters < Appfront::Command::Base
|
2
2
|
|
3
|
-
def self.
|
3
|
+
def self.ls
|
4
4
|
clusters = api.get "/clusters"
|
5
5
|
puts '=== Clusters List:'
|
6
6
|
clusters.each do |cl|
|
7
7
|
puts "Cluster #{cl['uuid']} ---> Name: #{cl['name']} \tProvider: #{cl['provider']}"
|
8
8
|
end
|
9
|
+
print "\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.ps(args, opts)
|
13
|
+
exit 1 unless args[0]
|
14
|
+
uuid = args[0]
|
15
|
+
|
16
|
+
puts "=== Cluster #{uuid} TOP: \n"
|
17
|
+
data = api.get "/cluster/#{uuid}/top"
|
18
|
+
|
19
|
+
unless data == {}
|
20
|
+
data.each do |b|
|
21
|
+
puts "\t ---"
|
22
|
+
puts "\t Box: #{b['address']}\t started: #{b['started']} \t memory: #{b['free_memory']}/#{b['memory']} MB"
|
23
|
+
puts "\n"
|
24
|
+
deploys = b['deploys']
|
25
|
+
deploys.each do |d|
|
26
|
+
puts "\t === #{d['deploy']} \t\t started: vuoto \t memory: #{d['memory']} MB \t cpu_usage: #{d['cpu']}%"
|
27
|
+
end
|
28
|
+
puts "\n"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
puts "\n"
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.top(args, opts)
|
36
|
+
exit 1 unless args[0]
|
37
|
+
uuid = args[0]
|
38
|
+
|
39
|
+
begin
|
40
|
+
system("clear")
|
41
|
+
|
42
|
+
puts "=== Cluster #{uuid} TOP: \n"
|
43
|
+
data = api.get "/cluster/#{uuid}/top"
|
44
|
+
|
45
|
+
unless data == {}
|
46
|
+
data.each do |b|
|
47
|
+
puts "\t ---"
|
48
|
+
puts "\t Box: #{b['address']}\t started: #{b['started']} \t memory: #{b['free_memory']}/#{b['memory']} MB"
|
49
|
+
puts "\n"
|
50
|
+
deploys = b['deploys']
|
51
|
+
deploys.each do |d|
|
52
|
+
puts "\t === #{d['deploy']} \t\t started: vuoto \t memory: #{d['memory']} MB \t cpu_usage: #{d['cpu']}%"
|
53
|
+
end
|
54
|
+
puts "\n"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
puts "\n"
|
58
|
+
|
59
|
+
sleep 2
|
60
|
+
end while true
|
61
|
+
rescue Exception
|
62
|
+
system("clear")
|
9
63
|
end
|
10
64
|
|
11
65
|
def self.info(args, opts)
|
12
66
|
exit 1 unless args[0]
|
13
67
|
uuid = args[0]
|
14
|
-
exit 1 unless opts[:provider]
|
15
|
-
exit 1 unless opts[:provider] == 'amazon' or opts[:provider] == 'digitalocean' or opts[:provider] == 'manual'
|
68
|
+
#exit 1 unless opts[:provider]
|
69
|
+
#exit 1 unless opts[:provider] == 'amazon' or opts[:provider] == 'digitalocean' or opts[:provider] == 'manual'
|
70
|
+
|
16
71
|
c = api.get "/cluster/#{uuid}"
|
17
72
|
puts "=== Cluster #{uuid}: \n"
|
18
73
|
puts "\t === Name: #{c['name']}\n"
|
74
|
+
puts "\t === DNS Name: #{c['dns']}\n"
|
19
75
|
puts "\t === Token: #{c['token']}\n"
|
20
76
|
puts "\t === Region: #{c['region']}\n"
|
77
|
+
puts "\n"
|
21
78
|
puts "\t === Active Boxes: #{c['boxes']}\n"
|
79
|
+
if c['addresses']
|
80
|
+
c['addresses'].each do |box|
|
81
|
+
puts "\t box address:\t#{box}"
|
82
|
+
end
|
83
|
+
end
|
22
84
|
puts "\n"
|
85
|
+
if c['started']
|
86
|
+
puts "\t === Booting Boxes: #{c['started'].count}\n"
|
87
|
+
c['started'].each do |box|
|
88
|
+
puts "\t box address:\t#{box}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
puts "\n"
|
92
|
+
|
23
93
|
end
|
24
94
|
|
25
95
|
def self.create(args, opts)
|
@@ -71,8 +141,8 @@ class Appfront::Command::Clusters < Appfront::Command::Base
|
|
71
141
|
def self.scale_up(args, opts)
|
72
142
|
exit 1 unless args[0]
|
73
143
|
uuid = args[0]
|
74
|
-
exit 1 unless opts[:provider]
|
75
|
-
exit 1 unless opts[:provider] == 'amazon' or opts[:provider] == 'digitalocean'
|
144
|
+
#exit 1 unless opts[:provider]
|
145
|
+
#exit 1 unless opts[:provider] == 'amazon' or opts[:provider] == 'digitalocean'
|
76
146
|
|
77
147
|
spinner "Scaling UP cluster #{uuid}..." do
|
78
148
|
api.put "/provider/cluster/#{uuid}/scale/up"
|
@@ -84,9 +154,8 @@ class Appfront::Command::Clusters < Appfront::Command::Base
|
|
84
154
|
def self.scale_down(args, opts)
|
85
155
|
uuid = args[0]
|
86
156
|
exit 1 unless args[0]
|
87
|
-
exit 1 unless opts[:provider]
|
88
|
-
exit 1 unless opts[:provider] == 'amazon' or opts[:provider] == 'digitalocean'
|
89
|
-
exit 1 unless args[0]
|
157
|
+
#exit 1 unless opts[:provider]
|
158
|
+
#exit 1 unless opts[:provider] == 'amazon' or opts[:provider] == 'digitalocean'
|
90
159
|
|
91
160
|
spinner "Scaling DOWN cluster #{uuid}..." do
|
92
161
|
api.put "/provider/cluster/#{uuid}/scale/down"
|
@@ -10,6 +10,14 @@ class Appfront::Command::Deploys < Appfront::Command::Base
|
|
10
10
|
print "\n"
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.attach(args, opts)
|
14
|
+
find_deploy! opts
|
15
|
+
spinner "Attaching deploy to cluster..." do
|
16
|
+
api.post "/cluster/#{args[0]}/attach", deploy: @deploy
|
17
|
+
end
|
18
|
+
puts "\n"
|
19
|
+
end
|
20
|
+
|
13
21
|
def self.add(args, opts)
|
14
22
|
spinner "Uploading Deploy YAML configuration to Jarvis..." do
|
15
23
|
api.post "/flow.yaml", file: args[0]
|
@@ -51,11 +59,13 @@ class Appfront::Command::Deploys < Appfront::Command::Base
|
|
51
59
|
end
|
52
60
|
end
|
53
61
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
62
|
+
if h['cluster']
|
63
|
+
puts
|
64
|
+
puts "=== Cluster: "
|
65
|
+
puts "\t name: #{h['cluster_name']}"
|
66
|
+
puts "\t uuid: #{h['cluster']}"
|
67
|
+
puts "\t dns address:\t#{h['cluster_dns']}"
|
68
|
+
end
|
59
69
|
|
60
70
|
if h['boxes']
|
61
71
|
h['boxes'].each do |box|
|
@@ -77,7 +87,7 @@ class Appfront::Command::Deploys < Appfront::Command::Base
|
|
77
87
|
|
78
88
|
end
|
79
89
|
|
80
|
-
def self.
|
90
|
+
def self.ls
|
81
91
|
deploys = api.get "/flows"
|
82
92
|
unless deploys.count == 0
|
83
93
|
puts '=== Deploys List'
|
@@ -20,10 +20,10 @@ Additional topics:
|
|
20
20
|
puts <<-HELP
|
21
21
|
Deploys commands:
|
22
22
|
|
23
|
-
deploys:
|
24
|
-
deploys:
|
25
|
-
deploys:
|
26
|
-
deploys:
|
23
|
+
deploys:destroy -d [deploy uuid] # permanently destroy an deploy
|
24
|
+
deploys:info -d [deploy uuid] # show detailed deploy information
|
25
|
+
deploys:list # show deploys list
|
26
|
+
deploys:attach -d [deploy uuid] [cluster uuid] # attach cluster to a deploy
|
27
27
|
HELP
|
28
28
|
end
|
29
29
|
|
@@ -32,9 +32,9 @@ Deploys commands:
|
|
32
32
|
Clusters commands:
|
33
33
|
|
34
34
|
clusters:create -p [provider] [NAME] [type] [region] # create a new cluster
|
35
|
-
clusters:rm
|
36
|
-
clusters:info
|
37
|
-
clusters:list
|
35
|
+
clusters:rm [cluster uuid] # permanently destroy a cluster
|
36
|
+
clusters:info [cluster uuid] # show detailed cluster information
|
37
|
+
clusters:list [cluster uuid] # show clusters list
|
38
38
|
HELP
|
39
39
|
end
|
40
40
|
|
data/lib/appfront/command/ps.rb
CHANGED
@@ -42,20 +42,6 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
42
42
|
puts "\n"
|
43
43
|
end
|
44
44
|
|
45
|
-
def self.run(args, opts)
|
46
|
-
find_deploy! opts
|
47
|
-
api.put "/flow/#{@deploy}/run"
|
48
|
-
|
49
|
-
spinner "Running Deploy..." do
|
50
|
-
loop do
|
51
|
-
sleep 3
|
52
|
-
info = api.get "/flow/#{@deploy}"
|
53
|
-
break if info['status'] == 'running'
|
54
|
-
end
|
55
|
-
end
|
56
|
-
puts "\n"
|
57
|
-
end
|
58
|
-
|
59
45
|
def self.scale_up(opts)
|
60
46
|
find_deploy! opts
|
61
47
|
|
@@ -90,20 +76,17 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
90
76
|
exit 1
|
91
77
|
end
|
92
78
|
|
93
|
-
|
94
|
-
params[:instances] = count
|
95
|
-
|
96
|
-
api.put "/flows/#{@deploy}/scaling", params
|
79
|
+
api.put "/flow/#{@deploy}/scale", instances: count
|
97
80
|
|
98
81
|
spinner "Scaling deploy instances..." do
|
99
82
|
loop do
|
100
83
|
sleep 3
|
101
84
|
info = api.get "/flow/#{@deploy}"
|
102
|
-
break if info['status'] == 'running'
|
85
|
+
break if info['status'] == 'running' or info['status'] == 'new' or info['status'] == 'pending_recovery'
|
103
86
|
end
|
104
87
|
end
|
105
88
|
|
106
|
-
puts "Now
|
89
|
+
puts "Now deploying #{count} instances"
|
107
90
|
end
|
108
91
|
|
109
92
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appfront
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Appfront
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: netrc
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.6.1
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: launchy
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 2.4.2
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 2.4.2
|
55
41
|
description: Appfront Command Line Tool
|
56
42
|
email: hello@appfront.io
|
57
43
|
executables:
|