appfront 1.1.1 → 1.1.2
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/cli.rb +2 -2
- data/lib/appfront/command/alias.rb +4 -4
- data/lib/appfront/command/base.rb +6 -6
- data/lib/appfront/command/deploys.rb +98 -0
- data/lib/appfront/command/domains.rb +57 -0
- data/lib/appfront/command/help.rb +8 -8
- data/lib/appfront/command/logs.rb +2 -2
- data/lib/appfront/command/ps.rb +30 -30
- metadata +4 -3
- data/lib/appfront/command/flows.rb +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a712eae44294a08a398a7ceecbfd86bce312d8de
|
4
|
+
data.tar.gz: 1f48f890d70c64b496e0770187ca1cc130515676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 664fb006c5a03ee49cee182f7725f067a40d884436b7bff2fae71073798095615767a4816bd698bfc8a187a12310f6b72e2061660072288cede383c89e519329
|
7
|
+
data.tar.gz: cfc18346fa7a3b6493e17351a20591f176c1927e791505f806b77fee106bc46354caf5e0b6a239ef2668484e493ab5ca8d4a84950ca073c2689309b27a6ca2db
|
data/lib/appfront/cli.rb
CHANGED
@@ -13,8 +13,8 @@ module Appfront
|
|
13
13
|
opt_parser = OptionParser.new do |opts|
|
14
14
|
opts.banner = "Usage: example.rb [options]"
|
15
15
|
|
16
|
-
opts.on("-
|
17
|
-
options[:
|
16
|
+
opts.on("-d", "--deploy Deploy", "Specify the deploy involved") do |v|
|
17
|
+
options[:deploy] = v
|
18
18
|
end
|
19
19
|
|
20
20
|
opts.on("-p", "--provider Provider", "Specify the provider involved") do |v|
|
@@ -12,19 +12,19 @@ class Appfront::Command::Alias < Appfront::Command::Base
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.version(*opts)
|
15
|
-
puts 'Appfront CLI 1.
|
15
|
+
puts 'Appfront CLI 1.1.2'
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.ls(*opts)
|
19
|
-
Appfront::Command::
|
19
|
+
Appfront::Command::Deploys.list
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.create(args, opts)
|
23
|
-
Appfront::Command::
|
23
|
+
Appfront::Command::Deploys.create args, opts
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.info(args, opts)
|
27
|
-
Appfront::Command::
|
27
|
+
Appfront::Command::Deploys.info opts
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
@@ -36,15 +36,15 @@ class Appfront::Command::Base
|
|
36
36
|
$stdin.gets.to_s.strip
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.
|
40
|
-
if opts[:
|
41
|
-
@
|
39
|
+
def self.find_deploy!(opts)
|
40
|
+
if opts[:deploy]
|
41
|
+
@deploy = opts[:deploy]
|
42
42
|
end
|
43
43
|
|
44
|
-
return true if @
|
44
|
+
return true if @deploy
|
45
45
|
|
46
|
-
puts 'No
|
47
|
-
puts 'Specify which
|
46
|
+
puts 'No deploy specified.'
|
47
|
+
puts 'Specify which deploy to use with --deploy DEPLOY.'
|
48
48
|
exit 1
|
49
49
|
end
|
50
50
|
|
@@ -0,0 +1,98 @@
|
|
1
|
+
class Appfront::Command::Deploys < Appfront::Command::Base
|
2
|
+
|
3
|
+
def self.yaml(opts)
|
4
|
+
find_deploy! opts
|
5
|
+
spinner "Retrieving YAML configuration from Jarvis..." do
|
6
|
+
@file = api.get "/flow/#{@deploy}/yaml"
|
7
|
+
end
|
8
|
+
puts "\nYAML file starts from here: \n\n"
|
9
|
+
puts @file
|
10
|
+
print "\n"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.add(args, opts)
|
14
|
+
spinner "Uploading Deploy YAML configuration to Jarvis..." do
|
15
|
+
api.post "/flow.yaml", file: args[0]
|
16
|
+
end
|
17
|
+
puts "\n"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.update(args, opts)
|
21
|
+
spinner "Updating Deploy YAML configuration to Jarvis..." do
|
22
|
+
api.put "/flow.yaml", file: args[0]
|
23
|
+
end
|
24
|
+
puts "\n"
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.rm(args, opts)
|
28
|
+
find_deploy! opts
|
29
|
+
spinner "Removing Deploy..." do
|
30
|
+
api.delete "/flow/#{@deploy}"
|
31
|
+
end
|
32
|
+
puts "\n"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.info(opts)
|
36
|
+
find_deploy! opts
|
37
|
+
|
38
|
+
h = api.get "/flow/#{@deploy}"
|
39
|
+
|
40
|
+
puts "=== Deploy: #{h['name']}"
|
41
|
+
puts
|
42
|
+
puts "\t Deploy uuid: #{h['uuid']}"
|
43
|
+
puts "\t Status: #{h['status']} "
|
44
|
+
puts "\t Running deploys: #{h['deploys']}"
|
45
|
+
|
46
|
+
if h['domains']
|
47
|
+
puts
|
48
|
+
puts "=== Domains:"
|
49
|
+
h['domains'].each do |domain|
|
50
|
+
puts "\t #{domain['name']}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
puts
|
55
|
+
puts "=== Cluster: "
|
56
|
+
puts "\t name: #{h['cluster_name']}"
|
57
|
+
puts "\t uuid: #{h['cluster']}"
|
58
|
+
puts "\t dns address:\t#{h['cluster_dns']}"
|
59
|
+
|
60
|
+
if h['boxes']
|
61
|
+
h['boxes'].each do |box|
|
62
|
+
puts "\t box address:\t#{box['box']}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
if h['routes'] and h['routes'] != ''
|
67
|
+
puts "\n"
|
68
|
+
puts "=== Internal Addressing:"
|
69
|
+
|
70
|
+
|
71
|
+
h['routes'].each do |r|
|
72
|
+
puts "\t Route: #{r['route'].split('-')[0]} -> #{r['route'].split('-')[1]}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
puts "\n"
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.list
|
81
|
+
deploys = api.get "/flows"
|
82
|
+
unless deploys.count == 0
|
83
|
+
puts '=== Deploys List'
|
84
|
+
deploys.each do |deploy|
|
85
|
+
chars = 30 - deploy['name'].chars.count
|
86
|
+
output = "#{deploy['name']}"
|
87
|
+
for i in 0..chars
|
88
|
+
output = output + ' '
|
89
|
+
end
|
90
|
+
output = output + "---> status: #{deploy['status']}"
|
91
|
+
puts output
|
92
|
+
end
|
93
|
+
else
|
94
|
+
puts '=== You have no deploys.'
|
95
|
+
end
|
96
|
+
puts "\n"
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
class Appfront::Command::Domains < Appfront::Command::Base
|
2
|
+
|
3
|
+
def self.rm(args, opts)
|
4
|
+
exit 1 unless args[0]
|
5
|
+
find_deploy! opts
|
6
|
+
spinner "Removing domain..." do
|
7
|
+
api.delete "/domain/#{args[0]}/#{@deploy}"
|
8
|
+
end
|
9
|
+
puts "\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.add(args, opts)
|
13
|
+
exit 1 unless args[0]
|
14
|
+
puts args[0]
|
15
|
+
find_deploy! opts
|
16
|
+
spinner "Adding domain..." do
|
17
|
+
api.post "/domain/#{args[0]}/#{@deploy}"
|
18
|
+
end
|
19
|
+
puts "\n"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.info(opts)
|
23
|
+
find_domain! opts
|
24
|
+
|
25
|
+
h = api.get "/domain/#{@deploy}"
|
26
|
+
|
27
|
+
puts "=== Domain: #{h['name']}"
|
28
|
+
puts
|
29
|
+
puts "\t Deploy uuid: #{h['uuid']}"
|
30
|
+
puts "\t Status: #{h['status']} "
|
31
|
+
puts "\t Running deploys: #{h['deploys']}"
|
32
|
+
puts
|
33
|
+
puts "=== Cluster: #{h['cluster_name']} ---> #{h['cluster']}"
|
34
|
+
|
35
|
+
puts "\n"
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.list
|
40
|
+
domains = api.get "/domains"
|
41
|
+
unless domains.count == 0
|
42
|
+
puts '=== Domains List'
|
43
|
+
domains.each do |domain|
|
44
|
+
chars = 30 - domain['name'].chars.count
|
45
|
+
output = "name: #{domain['name']}"
|
46
|
+
for i in 0..chars
|
47
|
+
output = output + ' '
|
48
|
+
end
|
49
|
+
output = output + "---> Deploy uuid: #{domain['flow_uuid']} name: #{domain['flow_name']}"
|
50
|
+
puts output
|
51
|
+
end
|
52
|
+
else
|
53
|
+
puts '=== You have no domains.'
|
54
|
+
end
|
55
|
+
puts "\n"
|
56
|
+
end
|
57
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class Appfront::Command::Help < Appfront::Command::Base
|
2
2
|
def self.root_help
|
3
3
|
puts <<-HELP
|
4
|
-
Usage: appfront COMMAND [-
|
4
|
+
Usage: appfront COMMAND [-d DEPLOY] [command-specific-options]
|
5
5
|
|
6
6
|
Primary help topics, type "appfront help TOPIC" for more details:
|
7
7
|
|
8
|
-
|
8
|
+
deploys # manage deploys
|
9
9
|
clusters # manage clusters
|
10
10
|
providers # manager connection with Amazon or DigitalOcean
|
11
11
|
|
@@ -16,14 +16,14 @@ Additional topics:
|
|
16
16
|
HELP
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.
|
19
|
+
def self.deploys
|
20
20
|
puts <<-HELP
|
21
|
-
|
21
|
+
Deploys commands:
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
deploys:create [NAME] # create a new deploy
|
24
|
+
deploys:destroy # permanently destroy an deploy
|
25
|
+
deploys:info # show detailed deploy information
|
26
|
+
deploys:list # show deploys list
|
27
27
|
HELP
|
28
28
|
end
|
29
29
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class Appfront::Command::Logs < Appfront::Command::Base
|
2
2
|
def self.list(opts)
|
3
|
-
|
3
|
+
find_deploy! opts
|
4
4
|
|
5
5
|
max_id = nil
|
6
6
|
|
7
7
|
begin
|
8
|
-
res = api.get "/flow/#{@
|
8
|
+
res = api.get "/flow/#{@deploy}/logs?max_id=#{max_id}"
|
9
9
|
max_id, events = res['max_id'], res['events']
|
10
10
|
events.each {|e| puts e }
|
11
11
|
sleep 2
|
data/lib/appfront/command/ps.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
class Appfront::Command::Ps < Appfront::Command::Base
|
2
2
|
|
3
3
|
def self.reload(args, opts)
|
4
|
-
|
5
|
-
api.put "/flow/#{@
|
4
|
+
find_deploy! opts
|
5
|
+
api.put "/flow/#{@deploy}/reload"
|
6
6
|
|
7
|
-
spinner "Reloading
|
7
|
+
spinner "Reloading Deploy..." do
|
8
8
|
loop do
|
9
9
|
sleep 3
|
10
|
-
info = api.get "/flow/#{@
|
11
|
-
break if info['status'] == 'running'
|
10
|
+
info = api.get "/flow/#{@deploy}"
|
11
|
+
break if info['status'] == 'running' or info['status'] == 'pending_reload'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
puts "\n"
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.force_restart(args, opts)
|
18
|
-
|
19
|
-
api.put "/flow/#{@
|
18
|
+
find_deploy! opts
|
19
|
+
api.put "/flow/#{@deploy}/force-restart"
|
20
20
|
|
21
|
-
spinner "Force restarting
|
21
|
+
spinner "Force restarting Deploy..." do
|
22
22
|
loop do
|
23
23
|
sleep 3
|
24
|
-
info = api.get "/flow/#{@
|
24
|
+
info = api.get "/flow/#{@deploy}"
|
25
25
|
break if info['status'] == 'running'
|
26
26
|
end
|
27
27
|
end
|
@@ -29,13 +29,13 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.stop(args, opts)
|
32
|
-
|
33
|
-
api.put "/flow/#{@
|
34
|
-
|
35
|
-
spinner "Stopping
|
32
|
+
find_deploy! opts
|
33
|
+
api.put "/flow/#{@deploy}/stop"
|
34
|
+
|
35
|
+
spinner "Stopping Deploy..." do
|
36
36
|
loop do
|
37
37
|
sleep 3
|
38
|
-
info = api.get "/flow/#{@
|
38
|
+
info = api.get "/flow/#{@deploy}"
|
39
39
|
break if info['status'] == 'deactivated'
|
40
40
|
end
|
41
41
|
end
|
@@ -43,13 +43,13 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.run(args, opts)
|
46
|
-
|
47
|
-
api.put "/flow/#{@
|
48
|
-
|
49
|
-
spinner "Running
|
46
|
+
find_deploy! opts
|
47
|
+
api.put "/flow/#{@deploy}/run"
|
48
|
+
|
49
|
+
spinner "Running Deploy..." do
|
50
50
|
loop do
|
51
51
|
sleep 3
|
52
|
-
info = api.get "/flow/#{@
|
52
|
+
info = api.get "/flow/#{@deploy}"
|
53
53
|
break if info['status'] == 'running'
|
54
54
|
end
|
55
55
|
end
|
@@ -57,26 +57,26 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def self.scale_up(opts)
|
60
|
-
|
60
|
+
find_deploy! opts
|
61
61
|
|
62
|
-
spinner "Scaling up
|
63
|
-
api.put "/flow/#{@
|
62
|
+
spinner "Scaling up deploy instances..." do
|
63
|
+
api.put "/flow/#{@deploy}/scale/up"
|
64
64
|
end
|
65
65
|
puts "\n"
|
66
66
|
end
|
67
67
|
|
68
68
|
def self.scale_down(opts)
|
69
|
-
|
69
|
+
find_deploy! opts
|
70
70
|
|
71
|
-
spinner "Scaling down
|
72
|
-
api.put "/flow/#{@
|
71
|
+
spinner "Scaling down deploy instances..." do
|
72
|
+
api.put "/flow/#{@deploy}/scale/down"
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
puts "\n"
|
76
76
|
end
|
77
77
|
|
78
78
|
def self.scale(settings, opts)
|
79
|
-
|
79
|
+
find_deploy! opts
|
80
80
|
|
81
81
|
count, mode = nil
|
82
82
|
settings.each do |s|
|
@@ -93,12 +93,12 @@ class Appfront::Command::Ps < Appfront::Command::Base
|
|
93
93
|
params[:scaling] = mode if mode
|
94
94
|
params[:instances] = count
|
95
95
|
|
96
|
-
api.put "/flows/#{@
|
96
|
+
api.put "/flows/#{@deploy}/scaling", params
|
97
97
|
|
98
|
-
spinner "Scaling
|
98
|
+
spinner "Scaling deploy instances..." do
|
99
99
|
loop do
|
100
100
|
sleep 3
|
101
|
-
info = api.get "/flow/#{@
|
101
|
+
info = api.get "/flow/#{@deploy}"
|
102
102
|
break if info['status'] == 'running'
|
103
103
|
end
|
104
104
|
end
|
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.2
|
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-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: netrc
|
@@ -69,7 +69,8 @@ files:
|
|
69
69
|
- lib/appfront/command/base.rb
|
70
70
|
- lib/appfront/command/clusters.rb
|
71
71
|
- lib/appfront/command/config.rb
|
72
|
-
- lib/appfront/command/
|
72
|
+
- lib/appfront/command/deploys.rb
|
73
|
+
- lib/appfront/command/domains.rb
|
73
74
|
- lib/appfront/command/help.rb
|
74
75
|
- lib/appfront/command/logs.rb
|
75
76
|
- lib/appfront/command/providers.rb
|
@@ -1,84 +0,0 @@
|
|
1
|
-
class Appfront::Command::Flows < Appfront::Command::Base
|
2
|
-
|
3
|
-
def self.yaml(opts)
|
4
|
-
find_flow! opts
|
5
|
-
spinner "Retrieving YAML configuration from Jarvis..." do
|
6
|
-
@file = api.get "/flow/#{@flow}/yaml"
|
7
|
-
end
|
8
|
-
puts "\nYAML file starts from here: \n\n"
|
9
|
-
puts @file
|
10
|
-
print "\n"
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.up(args, opts)
|
14
|
-
spinner "Uploading Flow YAML configuration to Jarvis..." do
|
15
|
-
api.post "/flow.yaml", file: args[0]
|
16
|
-
end
|
17
|
-
puts "\n"
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.update(args, opts)
|
21
|
-
spinner "Updating Flow YAML configuration to Jarvis..." do
|
22
|
-
api.put "/flow.yaml", file: args[0]
|
23
|
-
end
|
24
|
-
puts "\n"
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.rm(args, opts)
|
28
|
-
find_flow! opts
|
29
|
-
spinner "Removing Flow..." do
|
30
|
-
api.delete "/flow/#{@flow}"
|
31
|
-
end
|
32
|
-
puts "\n"
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.info(opts)
|
36
|
-
find_flow! opts
|
37
|
-
|
38
|
-
h = api.get "/flow/#{@flow}"
|
39
|
-
|
40
|
-
puts "=== Flow: #{h['name']}"
|
41
|
-
puts
|
42
|
-
puts "\t Flow uuid: #{h['uuid']}"
|
43
|
-
puts "\t Status: #{h['status']} "
|
44
|
-
puts "\t Running deploys: #{h['deploys']}"
|
45
|
-
puts
|
46
|
-
puts "=== Cluster: #{h['cluster_name']} ---> #{h['cluster']}"
|
47
|
-
|
48
|
-
h['boxes'].each do |box|
|
49
|
-
puts "\t Box address:\t#{box['box']}"
|
50
|
-
end
|
51
|
-
|
52
|
-
if h['routes'] and h['routes'] != ''
|
53
|
-
puts "\n"
|
54
|
-
puts "=== Internal Addressing:"
|
55
|
-
|
56
|
-
|
57
|
-
h['routes'].each do |r|
|
58
|
-
puts "\t Route: #{r['route'].split('-')[0]} -> #{r['route'].split('-')[1]}"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
puts "\n"
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.list
|
67
|
-
flows = api.get "/flows"
|
68
|
-
unless flows.count == 0
|
69
|
-
puts '=== Flows List'
|
70
|
-
flows.each do |flow|
|
71
|
-
chars = 30 - flow['name'].chars.count
|
72
|
-
output = "#{flow['name']}"
|
73
|
-
for i in 0..chars
|
74
|
-
output = output + ' '
|
75
|
-
end
|
76
|
-
output = output + "---> status: #{flow['status']}"
|
77
|
-
puts output
|
78
|
-
end
|
79
|
-
else
|
80
|
-
puts '=== You have no flows.'
|
81
|
-
end
|
82
|
-
puts "\n"
|
83
|
-
end
|
84
|
-
end
|