appfront 1.1.6 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/appfront/command/clusters.rb +29 -0
- data/lib/appfront/command/config.rb +28 -42
- data/lib/appfront/command/deploys.rb +19 -1
- data/lib/appfront/command/ps.rb +68 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfdcf55e6a2668a562b0bf1d29894f4013b9908c
|
4
|
+
data.tar.gz: 283bc6f6ab8d5e8ea87187899ca93ac78bb4e377
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbbc96d90e7fed26a042f8dd8818669dbfac2ae542baf2d0b3b63b63850a9e1600f8027ba12af728b04a7033a4046af81ff889414bf6ea3a7b06c7f6a611dca
|
7
|
+
data.tar.gz: 8fd97cb97aacb9627a8aa1b1c8a26dd82477b64013d61d0d4097be125005f023fd8b83111197e7127f8fea138a7fbc31017e738144b849565d638f5b3ceda92f
|
@@ -32,6 +32,35 @@ class Appfront::Command::Clusters < Appfront::Command::Base
|
|
32
32
|
|
33
33
|
end
|
34
34
|
|
35
|
+
def self.status(args, opts)
|
36
|
+
exit 1 unless args[0]
|
37
|
+
uuid = args[0]
|
38
|
+
|
39
|
+
begin
|
40
|
+
system("clear")
|
41
|
+
|
42
|
+
puts "=== Cluster #{uuid} processes activities: \n"
|
43
|
+
data = api.get "/cluster/#{uuid}/status"
|
44
|
+
|
45
|
+
unless data == {}
|
46
|
+
data.each do |f|
|
47
|
+
puts "---"
|
48
|
+
puts "Deploy: #{f['name']}\t uuid: #{f['flow']}"
|
49
|
+
puts "\n"
|
50
|
+
statuses = f['statuses']
|
51
|
+
statuses.each do |s|
|
52
|
+
puts "\t instance: #{s['live_uuid']}\t task: #{s['name']}\t status: #{s['status']}\t last seen on: #{s['last_seen']}\n"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
puts "\n"
|
57
|
+
|
58
|
+
sleep 2
|
59
|
+
end while true
|
60
|
+
rescue Exception
|
61
|
+
system("clear")
|
62
|
+
end
|
63
|
+
|
35
64
|
def self.top(args, opts)
|
36
65
|
exit 1 unless args[0]
|
37
66
|
uuid = args[0]
|
@@ -5,16 +5,17 @@ class Appfront::Command::Config < Appfront::Command::Base
|
|
5
5
|
exit 1
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
find_app! opts
|
11
|
-
|
12
|
-
puts "Setting ENV vars..."
|
13
|
-
|
14
|
-
api.post "/apps/#{@app}/vars", vars: vars
|
15
|
-
|
16
|
-
vars.each { |k, v| puts "#{k}:\t#{v}" }
|
8
|
+
find_deploy! opts
|
17
9
|
|
10
|
+
spinner "Setting ENV vars..." do
|
11
|
+
vars.each do |var|
|
12
|
+
k, v = var.split '=', 2
|
13
|
+
api.post "/flow/#{@deploy}/envs/#{k}", value: v
|
14
|
+
end
|
15
|
+
end
|
16
|
+
puts
|
17
|
+
puts
|
18
|
+
Appfront::Command::Config::ls opts
|
18
19
|
puts
|
19
20
|
puts 'Please use ps:restart command to restart your app when you\'re ready.'
|
20
21
|
end
|
@@ -25,46 +26,31 @@ class Appfront::Command::Config < Appfront::Command::Base
|
|
25
26
|
exit 1
|
26
27
|
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
find_deploy! opts
|
30
|
+
|
31
|
+
spinner "Unsetting ENV vars..." do
|
32
|
+
vars.each do |var|
|
33
|
+
k, v = var.split '=', 2
|
34
|
+
api.delete "/flow/#{@deploy}/envs/#{k}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
puts
|
38
|
+
puts
|
39
|
+
Appfront::Command::Config::ls opts
|
34
40
|
puts
|
35
41
|
puts 'Please use ps:restart command to restart your app when you\'re ready.'
|
36
42
|
end
|
37
43
|
|
38
|
-
def self.
|
39
|
-
|
40
|
-
find_app! opts
|
44
|
+
def self.ls(opts)
|
45
|
+
find_deploy! opts
|
41
46
|
|
42
|
-
|
47
|
+
puts "=== #{@deploy} Config Vars"
|
43
48
|
|
44
|
-
|
49
|
+
vars = api.get("/flow/#{@deploy}/envs")
|
45
50
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
def self.list(opts)
|
50
|
-
find_app! opts
|
51
|
-
|
52
|
-
puts "=== #{@app} Config Vars"
|
53
|
-
|
54
|
-
vars = api.get("/domains/#{@app}")['vars']
|
55
|
-
|
56
|
-
vars.each {|v| puts "#{v['key_name']}:\t#{v['value']}" }
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
def self.parse_vars!(vars)
|
61
|
-
parsed_vars = {}
|
62
|
-
|
63
|
-
vars.each do |var|
|
64
|
-
k, v = var.split '=', 2
|
65
|
-
parsed_vars[k] = v || ''
|
51
|
+
vars.each do |k|
|
52
|
+
k.each_pair {|k,v| puts "#{k}:\t #{v}"}
|
66
53
|
end
|
67
|
-
|
68
|
-
parsed_vars
|
69
54
|
end
|
55
|
+
|
70
56
|
end
|
@@ -90,14 +90,32 @@ class Appfront::Command::Deploys < Appfront::Command::Base
|
|
90
90
|
def self.ls
|
91
91
|
deploys = api.get "/flows"
|
92
92
|
unless deploys.count == 0
|
93
|
-
puts '===
|
93
|
+
puts '=== Tasks:'
|
94
|
+
puts
|
95
|
+
deploys.each do |deploy|
|
96
|
+
next if deploy['execution'] == 'persistent'
|
97
|
+
chars = 30 - deploy['name'].chars.count
|
98
|
+
output = "#{deploy['name']}"
|
99
|
+
for i in 0..chars
|
100
|
+
output = output + ' '
|
101
|
+
end
|
102
|
+
output = output + "---> status: #{deploy['status']}"
|
103
|
+
output = output + "\t Changed Status: ~ #{deploy['last_change']}h ago"
|
104
|
+
puts output
|
105
|
+
|
106
|
+
end
|
107
|
+
puts
|
108
|
+
puts '=== Deploys:'
|
109
|
+
puts
|
94
110
|
deploys.each do |deploy|
|
111
|
+
next if deploy['execution'] == 'volatile'
|
95
112
|
chars = 30 - deploy['name'].chars.count
|
96
113
|
output = "#{deploy['name']}"
|
97
114
|
for i in 0..chars
|
98
115
|
output = output + ' '
|
99
116
|
end
|
100
117
|
output = output + "---> status: #{deploy['status']}"
|
118
|
+
output = output + "\t Changed Status: ~ #{deploy['last_change']}h ago"
|
101
119
|
puts output
|
102
120
|
end
|
103
121
|
else
|
data/lib/appfront/command/ps.rb
CHANGED
@@ -36,7 +36,21 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
36
36
|
loop do
|
37
37
|
sleep 3
|
38
38
|
info = api.get "/flow/#{@deploy}"
|
39
|
-
break if info['status'] == 'deactivated'
|
39
|
+
break if info['status'] == 'deactivated' or info['status'] == 'stopped'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
puts "\n"
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.start(args, opts)
|
46
|
+
find_deploy! opts
|
47
|
+
api.put "/flow/#{@deploy}/start"
|
48
|
+
|
49
|
+
spinner "Starting Deploy..." do
|
50
|
+
loop do
|
51
|
+
sleep 3
|
52
|
+
info = api.get "/flow/#{@deploy}"
|
53
|
+
break if info['status'] == 'available'
|
40
54
|
end
|
41
55
|
end
|
42
56
|
puts "\n"
|
@@ -61,7 +75,7 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
61
75
|
puts "\n"
|
62
76
|
end
|
63
77
|
|
64
|
-
def self.
|
78
|
+
def self.run(settings, opts)
|
65
79
|
find_deploy! opts
|
66
80
|
|
67
81
|
count, mode = nil
|
@@ -72,13 +86,13 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
72
86
|
end
|
73
87
|
|
74
88
|
unless count
|
75
|
-
puts 'Usage: appfront ps:
|
89
|
+
puts 'Usage: appfront ps:run instances=N'
|
76
90
|
exit 1
|
77
91
|
end
|
78
92
|
|
79
93
|
api.put "/flow/#{@deploy}/scale", instances: count
|
80
94
|
|
81
|
-
spinner "
|
95
|
+
spinner "Running deploy instances..." do
|
82
96
|
loop do
|
83
97
|
sleep 3
|
84
98
|
info = api.get "/flow/#{@deploy}"
|
@@ -86,7 +100,56 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
86
100
|
end
|
87
101
|
end
|
88
102
|
|
89
|
-
puts "Now
|
103
|
+
puts "Now running #{count} instances"
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.scale(settings, opts)
|
107
|
+
find_deploy! opts
|
108
|
+
|
109
|
+
count, mode = nil
|
110
|
+
settings.each do |s|
|
111
|
+
p, v = s.split('=',2)
|
112
|
+
count = v if p == 'instances'
|
113
|
+
mode = nil
|
114
|
+
end
|
115
|
+
|
116
|
+
p, v = settings.first.split('=',2)
|
117
|
+
|
118
|
+
if p == 'instances'
|
119
|
+
|
120
|
+
unless count
|
121
|
+
puts 'Usage: appfront ps:scale instances=N'
|
122
|
+
exit 1
|
123
|
+
end
|
124
|
+
|
125
|
+
api.put "/flow/#{@deploy}/scale", instances: count
|
126
|
+
|
127
|
+
spinner "Scaling deploy instances..." do
|
128
|
+
loop do
|
129
|
+
sleep 3
|
130
|
+
info = api.get "/flow/#{@deploy}"
|
131
|
+
break if info['status'] == 'running' or info['status'] == 'new' or info['status'] == 'pending_recovery'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
puts "Now deploying #{count} instances"
|
136
|
+
elsif p == 'memory'
|
137
|
+
count = v
|
138
|
+
|
139
|
+
api.put "/flow/#{@deploy}/memory", memory: count
|
140
|
+
|
141
|
+
spinner "Scaling deploy memory..." do
|
142
|
+
loop do
|
143
|
+
sleep 3
|
144
|
+
info = api.get "/flow/#{@deploy}"
|
145
|
+
break if info['status'] == 'pending_reload' or info['status'] == 'pending_reset'
|
146
|
+
end
|
147
|
+
end
|
148
|
+
puts "Now deploying with #{count} memory"
|
149
|
+
else
|
150
|
+
puts 'Usage: appfront ps:scale instances=N|memory=MB'
|
151
|
+
exit 1
|
152
|
+
end
|
90
153
|
end
|
91
154
|
|
92
155
|
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.8
|
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-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: netrc
|