app42 0.5.9 → 0.5.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a1b5e706f83bc170fb06160de374c77912e5d53
4
- data.tar.gz: e4294db156a5bbd323aed881022b7c34ef49ae39
3
+ metadata.gz: 2ef81a41d58513f52552f8bb1b014d174984ab74
4
+ data.tar.gz: 1816b48b8e55b9eca9ef16f338c2ebdec661c3f4
5
5
  SHA512:
6
- metadata.gz: 6d2b686b7711fd5e5d0206f8dd2fbb9e6da4a911b022cc111942374ab1493c595f460657a2fb91779fc3d0ce7415df7893bb1794937adb2c9c2ba596832128ef
7
- data.tar.gz: 6e247caef14644a2917c2298a26b2cbea9adf308bb37b8ddd557608543303bcbea8e2e73260e2e52134d3645596d102d38578cbedff25a568e97d8ef0bb55290
6
+ metadata.gz: 23f3a6c61c981d7fb4a5f54628e1a6143d0f88d769920c82d26f655d2386b80828eda8f43b2c3f95b3155b6263b63d4079f715de129b2aa11e5ddb0247fdecd8
7
+ data.tar.gz: d1e95bae60ebc1caf63aed7fba33c1bcf0fe2747419ad859584a2bdc308ae69e44a88b24e32af2b821e1ce40669d17220f433659bcdbdfc8c4401787fc7c0070
data/RELEASE.md CHANGED
@@ -8,4 +8,11 @@ Client library and command-line tool to deploy and manage apps on App42PaaS.
8
8
 
9
9
  - Application Vertical scale and descale
10
10
  - BPaaS setup start and stop
11
- - Upload backup for service
11
+ - Upload backup for service
12
+
13
+ ### 0.5.10 (13-12-2013)
14
+
15
+ - Service Vertical scale and descale
16
+ - BPaaS setup upgrade
17
+
18
+
@@ -52,6 +52,8 @@ module App42
52
52
  startService # Start the service
53
53
  restartService # Restart the service
54
54
  stopService # Stop the service
55
+ scaleService # Vertically scale service by number of Kontena(s)
56
+ descaleService # Vertically descale services by number of Kontena(s)
55
57
  uploadBackup # Upload file data into a service
56
58
  services # List all the provisioned services with their meta details
57
59
  serviceInfo # Show meta information of the provisioned service
@@ -72,6 +74,7 @@ module App42
72
74
  startBPaaS # Start the BPaaS
73
75
  stopBPaaS # Stop the BPaaS
74
76
  setupInfo # Show setup information
77
+ upgradeBPaas # Upgrade BPaaS by choosing required configuration
75
78
  setups # List all the setups
76
79
 
77
80
  Help
@@ -413,7 +416,7 @@ Example:
413
416
  2: Vertical
414
417
  Choose Scale Type [Horizontal]: 2
415
418
 
416
- Vertical descale by kontena power(s) [1]:
419
+ Vertical scale by kontena power(s) [1]:
417
420
  Scaling Application demo by kontena(s) 1... OK
418
421
 
419
422
  Operation is in progress, Please wait...|
@@ -620,6 +623,50 @@ Example:
620
623
 
621
624
  end
622
625
 
626
+ def scaleservice
627
+ print <<-DESC
628
+ Usage:
629
+ app42 scaleService
630
+ Vertically scale service by number of kontena(s)
631
+
632
+ Options:
633
+ [--service SERVICE] # Name of service, you want to scale
634
+
635
+ Example:
636
+ $app42 scaleService
637
+ Enter Service Name: mysqldb
638
+
639
+ Vertical scale by kontena power(s) [1]: 1
640
+ Scaling Service 'mysqldb' by kontena 1... OK
641
+
642
+ Operation is in progress, Please wait...|
643
+ Service scale completed successfully.
644
+ DESC
645
+
646
+ end
647
+
648
+ def descaleservice
649
+ print <<-DESC
650
+ Usage:
651
+ app42 descaleService
652
+ Vertically descale service by number of kontena(s)
653
+
654
+ Options:
655
+ [--service SERVICE] # Name of service, you want to scale
656
+
657
+ Example:
658
+ $app42 descaleService
659
+ Enter Service Name: mysqldb
660
+
661
+ Vertical descale by kontena power(s) [1]: 1
662
+ Descaling Service 'mysqldb' by kontena 1... OK
663
+
664
+ Operation is in progress, Please wait...|
665
+ Service descale completed successfully.
666
+ DESC
667
+
668
+ end
669
+
623
670
  def restartservice
624
671
  print <<-DESC
625
672
  Usage:
@@ -1023,6 +1070,31 @@ Example:
1023
1070
  DESC
1024
1071
  end
1025
1072
 
1073
+ def upgradebpaas
1074
+ print <<-DESC
1075
+ Usage:
1076
+ app42 upgradeBPaaS
1077
+
1078
+ Upgrade BPaaS by choosing required configuration
1079
+
1080
+ Example:
1081
+ $app42 upgradeBPaaS
1082
+ Enter Setup Name: demo
1083
+
1084
+ 1: Light
1085
+ 2: Medium
1086
+ 3: Heavy
1087
+ Select Flavour [Light]: 2
1088
+
1089
+ Upgrading Setup... OK
1090
+
1091
+ Operation is in progress, Please wait...-
1092
+
1093
+ BPaaS setup demo upgraded successfully.
1094
+
1095
+ DESC
1096
+ end
1097
+
1026
1098
  def version
1027
1099
  print <<-DESC
1028
1100
  Usage:
@@ -34,6 +34,8 @@ module App42
34
34
  'startservice',
35
35
  'restartservice',
36
36
  'stopservice',
37
+ 'scaleservice',
38
+ 'descaleservice',
37
39
  'uploadbackup',
38
40
  'resetservicepassword',
39
41
  'bindip',
@@ -41,6 +43,7 @@ module App42
41
43
  'bindinfo',
42
44
  'setupbpaas',
43
45
  'startbpaas',
46
+ 'upgradebpaas',
44
47
  'stopbpaas',
45
48
  'deletesetup',
46
49
  'setupinfo',
@@ -329,6 +329,38 @@ module App42
329
329
  puts Paint[" Command cancelled.", :red]
330
330
  exit!
331
331
  end
332
+ end
333
+
334
+ # upgrade setup cloud API, as a
335
+ #
336
+ # ==== Parameters
337
+ # setup_name = setup_name provided by user
338
+ # flavour = flavour provided by user
339
+ #
340
+ # ==== return
341
+ # true:: if cloud setup upgraded
342
+ # OR
343
+ # ERROR message in case failed
344
+ def upgrade_clouldapi setup_name, flavour
345
+ begin
346
+ response = with_progress(Paint["Upgrading Setup", :yellow]) do |s|
347
+ query_params = params
348
+ body = {'app42' => {"request"=> {
349
+ "setupName" => setup_name,
350
+ "flavour" => flavour
351
+ }}}.to_json
352
+
353
+ query_params.store('body', body)
354
+ build_put_request body, query_params, 'setup/upgrade', nil
355
+ end
356
+ transaction_success = check_transaction_status response["transactionId"], previous_completed = 0, 'deleted' if response["success"] == true && response["transactionId"]
357
+ response['success'] ? (return true) : (message "#{response['description']}", true, 'red')
358
+ rescue Interrupt
359
+ puts Paint[" Command cancelled.", :red]
360
+ exit!
361
+ rescue Exception => e
362
+ puts e
363
+ end
332
364
  end
333
365
 
334
366
 
@@ -502,7 +534,7 @@ module App42
502
534
  query_params = params
503
535
  query_params.store('body', body)
504
536
 
505
- response = with_progress( Paint[ what.to_s == 'vscale' ? "Scaling Application #{app_name} by kontena(s) #{kontena}" : "Descaling Application #{app_name} by kontena(s) #{kontena}", :yellow]) do |s|
537
+ response = with_progress( Paint[ what.to_s == 'vscale' ? "Scaling Application '#{app_name}' by kontena(s) #{kontena}" : "Descaling Application '#{app_name}' by kontena(s) #{kontena}", :yellow]) do |s|
506
538
  build_post_request body, query_params, "app", what
507
539
  end
508
540
 
@@ -518,6 +550,30 @@ module App42
518
550
  end
519
551
  end
520
552
 
553
+ # vertical scale or descale service by no of kontena,
554
+ # expect +what+ as operation and kontena as no of kontena
555
+ def vscale_or_vdescale_service what, kontena, service_name
556
+ begin
557
+ body = {'app42' => {"request"=> {
558
+ 'serviceName' => service_name,
559
+ "kontenaPower" => kontena.to_s
560
+ }}}.to_json
561
+ query_params = params
562
+ query_params.store('body', body)
563
+ response = with_progress( Paint[ what.to_s == 'vscale' ? "Scaling Service '#{service_name}' by kontena #{kontena}" : "Descaling Service '#{service_name}' by kontena #{kontena}", :yellow]) do |s|
564
+ build_post_request body, query_params, "service", what
565
+ end
566
+ check_transaction_status response["transactionId"], previous_completed = 0, "#{what}d" if response["success"] == true && response["transactionId"]
567
+ response['success'] ? (return true) : (message "#{response['description']}", true, 'red')
568
+ rescue Interrupt
569
+ puts Paint[" Command cancelled.", :red]
570
+ exit!
571
+ rescue Exception => e
572
+ puts e
573
+ exit!
574
+ end
575
+ end
576
+
521
577
  # common methods for app42paas config request like runtimes,frameworks etc
522
578
  def interactive_get resource, get_obj
523
579
  begin
@@ -59,8 +59,8 @@ module App42
59
59
  opts_parser = OptionParser.new do |opts|
60
60
  opts.banner = "\nAvailable options:\n\n"
61
61
 
62
- opts.on('--apiKey API_KEY') { |api| @options[:api] = api }
63
- opts.on('--secretKey SECRET_KEY') { |secret| @options[:secret] = secret }
62
+ opts.on('--apiKey API_KEY') { |api| @options[:api] = api }
63
+ opts.on('--secretKey SECRET_KEY') { |secret| @options[:secret] = secret }
64
64
  opts.on('-a API_KEY') { |api| @options[:api] = api }
65
65
  opts.on('-s SECRET_KEY') { |secret| @options[:secret] = secret }
66
66
 
@@ -216,6 +216,12 @@ module App42
216
216
  when 'stopservice'
217
217
  set_cmd(:service, :stop)
218
218
 
219
+ when 'scaleservice'
220
+ set_cmd(:service, :vscale)
221
+
222
+ when 'descaleservice'
223
+ set_cmd(:service, :vdescale)
224
+
219
225
  when 'uploadbackup'
220
226
  set_cmd(:service, :uploadbackup)
221
227
 
@@ -238,7 +244,10 @@ module App42
238
244
  set_cmd(:setup, :start)
239
245
 
240
246
  when 'stopbpaas'
241
- set_cmd(:setup, :stop)
247
+ set_cmd(:setup, :stop)
248
+
249
+ when 'upgradebpaas'
250
+ set_cmd(:setup, :upgrade_cloud_api)
242
251
 
243
252
  when 'deletesetup'
244
253
  set_cmd(:setup, :delete_cloud_api)
@@ -32,6 +32,7 @@ module App42::Command
32
32
  # ask service name to user
33
33
  def ask_service_name
34
34
  service_name = ask Paint["Enter Service Name", :cyan]
35
+ print_new_line
35
36
  valid_service_name = validate_app_and_service_name "Service name", service_name.strip
36
37
  valid_service_name ? (return valid_service_name) : ask_service_name
37
38
  end
@@ -124,6 +125,24 @@ module App42::Command
124
125
  exit! if response
125
126
  end
126
127
 
128
+ # read +service name+ and number of +instance+ from user
129
+ # then vertically scale service by no of instance
130
+ def vscale
131
+ @options[:service] = ask_service_name if @options[:service].nil?
132
+ @options[:kontena] = get_kontena "Vertical scale" if is_service_exist? @options[:service] and @options[:kontena].nil?
133
+ vscale_or_vdescal_res = vscale_or_vdescale_service __method__, @options[:kontena], @options[:service]
134
+ exit! if vscale_or_vdescal_res
135
+ end
136
+
137
+ # read +app name+ and number of +instance+ from user
138
+ # then vertically descale app by no of instance
139
+ def vdescale
140
+ @options[:service] = ask_service_name if @options[:service].nil?
141
+ @options[:kontena] = get_kontena "Vertical descale" if is_service_exist? @options[:service] and @options[:kontena].nil?
142
+ vscale_or_vdescal_res = vscale_or_vdescale_service __method__, @options[:kontena], @options[:service]
143
+ exit! if vscale_or_vdescal_res
144
+ end
145
+
127
146
  # read +app name+ and number of +instance+ from user
128
147
  # then vertically descale app by no of instance
129
148
  def uploadbackup
@@ -38,6 +38,15 @@ module App42
38
38
  exit! if response
39
39
  end
40
40
 
41
+ # collect BPaaS setup name from user and proceed BPaaS upgrade request
42
+ def upgrade_cloud_api
43
+ @options[:setup] = get_setup_name if @options[:setup].nil?
44
+ print_new_line
45
+ flavour = get_flavour
46
+ response = upgrade_clouldapi @options[:setup], flavour if is_setup_name_exist? @options[:setup]
47
+ exit! if response
48
+ end
49
+
41
50
  # return setup type
42
51
  def get_setup_type
43
52
  setup_type_hash = {}
data/lib/app42/version.rb CHANGED
@@ -3,7 +3,7 @@ module App42
3
3
  module VERSION
4
4
  MAJOR = 0
5
5
  MINOR = 5
6
- TINY = 9
6
+ TINY = 10
7
7
  PRE = "alpha"
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app42
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - ShepHertz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-04 00:00:00.000000000 Z
11
+ date: 2013-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler