app42 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app42.gemspec +1 -0
- data/lib/app42/base/constants.rb +5 -1
- data/lib/app42/base/help.rb +186 -162
- data/lib/app42/base/message.rb +3 -2
- data/lib/app42/base/shell.rb +16 -15
- data/lib/app42/base/util.rb +13 -10
- data/lib/app42/command/app.rb +4 -4
- data/lib/app42/command/authorize.rb +1 -1
- data/lib/app42/command/base.rb +10 -10
- data/lib/app42/command/client.rb +24 -21
- data/lib/app42/command/info.rb +23 -0
- data/lib/app42/command/service.rb +5 -5
- data/lib/app42/command/user.rb +1 -1
- data/lib/app42/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f2e93237bd27606f1fce898d696cc584ecf0c81
|
4
|
+
data.tar.gz: 22306a898c0e237d65af4729b03119bc78943c39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eff3f34399f7a747fc522297eb2a2270c716c1fbe9c11064b2e52e055b74dd69ae1edb3685a568025f8cb3a2e6b9506ec275bdd797be0ad6d9c434eded1fa8dd
|
7
|
+
data.tar.gz: 5716d721469c36dfe52a936e225853fdb78a56a2dea06c80bbd94e8cab8bc7e12358bac0e88911fb02fe1685437881166cd2883e02b9369406a040c6223308b6
|
data/app42.gemspec
CHANGED
@@ -5,6 +5,7 @@ require 'app42/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.required_ruby_version = '>= 1.9.2'
|
8
|
+
spec.add_runtime_dependency 'bundler'
|
8
9
|
spec.post_install_message = "Thanks for installing!"
|
9
10
|
spec.name = "app42"
|
10
11
|
spec.version = App42::Version::VERSION::VERSION
|
data/lib/app42/base/constants.rb
CHANGED
@@ -20,12 +20,16 @@ module App42
|
|
20
20
|
# Error codes
|
21
21
|
APP42_HTTP_ERROR_CODES = [ 1500 ]
|
22
22
|
|
23
|
-
DATABASE_NAME_NOT_ALLOWED = %w(mysql couchdb mongodb postgresql database)
|
23
|
+
DATABASE_NAME_NOT_ALLOWED = %w(mysql couchdb mongodb postgresql database sql)
|
24
24
|
|
25
25
|
# regex for special character
|
26
26
|
SPECIAL = "?<>',?[]}{=-)(*&^%$#`~{}@ .+!_/"
|
27
27
|
REGEX = /[#{SPECIAL.gsub(/./){|char| "\\#{char}"}}]/
|
28
28
|
|
29
|
+
# regex for special character (Database Name)
|
30
|
+
DBNAME_SPECIAL = "?<>',?[]}{=-)(*&^%$#`~{}@ .+!/"
|
31
|
+
DBNAME_REGEX = /[#{DBNAME_SPECIAL.gsub(/./){|char| "\\#{char}"}}]/
|
32
|
+
|
29
33
|
# regex for IP Address
|
30
34
|
IP_REGEX = /^([0]?\d\d?|1[0-1,3-9]\d|12[0-6,8-9]|2[0-4]d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.((?!0)|(?!1)|010|(01[0-9]{1,1}&0[1-9]{1,2})|0[0-9]{1,1}[1-9]{1,1}|[2-9]{0,2}|1[0-9]{1,2}|2[0-4]\d|25[0-4])$/
|
31
35
|
|
data/lib/app42/base/help.rb
CHANGED
@@ -39,7 +39,7 @@ module App42
|
|
39
39
|
apps # List all the deployed applications with their meta details
|
40
40
|
appInfo # Show meta information of the application
|
41
41
|
appState # Show current state of the application
|
42
|
-
logs # Returns the log file
|
42
|
+
logs # Returns the log file URL(s) for the application
|
43
43
|
|
44
44
|
Services
|
45
45
|
createService # Creates a new service e.g. MySQL, MongoDB, CouchDB, PostgreSQL etc.
|
@@ -55,6 +55,7 @@ module App42
|
|
55
55
|
supportedServices # List supported services by App42
|
56
56
|
iaasProviders # List supported IaaS providers by App42
|
57
57
|
runtimes # List supported runtimes by App42
|
58
|
+
activities # List all activities with their status
|
58
59
|
|
59
60
|
Help
|
60
61
|
version # Show Ruby client gem version
|
@@ -104,7 +105,7 @@ Example:
|
|
104
105
|
DESC
|
105
106
|
end
|
106
107
|
|
107
|
-
def
|
108
|
+
def addkeys
|
108
109
|
print <<-DESC
|
109
110
|
Usage:
|
110
111
|
app42 addKeys
|
@@ -124,52 +125,65 @@ Example:
|
|
124
125
|
DESC
|
125
126
|
end
|
126
127
|
|
127
|
-
def
|
128
|
+
def clearkeys
|
128
129
|
print <<-DESC
|
129
130
|
Usage:
|
130
131
|
app42 clearKeys
|
131
132
|
|
132
|
-
Clear API key and Secret key
|
133
|
+
Clear API key and Secret key
|
133
134
|
|
134
135
|
Example:
|
135
136
|
app42 clearKeys
|
136
|
-
|
137
|
+
Do you want to delete existing keys? [Yn]: y
|
138
|
+
|
139
|
+
=== API key and Secret key have been deleted. ===
|
137
140
|
DESC
|
138
141
|
end
|
139
142
|
|
140
|
-
def
|
143
|
+
def setupinfra
|
141
144
|
print <<-DESC
|
142
145
|
Usage:
|
143
146
|
app42 setupInfra
|
144
147
|
|
145
|
-
Setup
|
148
|
+
Setup your deployment and runtime environment i.e. Instance(Memory, CPU) and Technology Stack
|
146
149
|
|
147
150
|
Example:
|
148
151
|
$app42 setupInfra
|
149
|
-
1: Shared
|
150
|
-
Select Virtual Machine Type: 1
|
151
|
-
1: Amazon
|
152
|
-
Select IaaS Provider: 1
|
153
152
|
Application Name: demo
|
153
|
+
|
154
154
|
Checking App Name Availability... OK
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
1:
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
155
|
+
|
156
|
+
1: Shared
|
157
|
+
Select Instance Type [Shared]:
|
158
|
+
|
159
|
+
1: Amazon US West-2a
|
160
|
+
Select IaaS Provider [Amazon US West-2a]: 1
|
161
|
+
|
162
|
+
1: Ruby 2.0
|
163
|
+
2: Java 6.0
|
164
|
+
3: Java 7.0
|
165
|
+
4: Php 5.3
|
166
|
+
5: Php 5.5
|
167
|
+
Select Runtime [Ruby 2.0]: 1
|
168
|
+
|
169
|
+
1: Rails 4.0
|
170
|
+
Select Framework [Rails 4.0]:
|
171
|
+
|
172
|
+
1: nginx 1.4.2
|
173
|
+
Select Web Server [nginx 1.4.2]:
|
174
|
+
|
175
|
+
1: 512 MB
|
176
|
+
2: 1024 MB
|
177
|
+
3: 2048 MB
|
178
|
+
Memory Limit [512 MB]:
|
179
|
+
|
180
|
+
Setting up the infrastructure... OK
|
181
|
+
|
182
|
+
Operation is in progress, Please wait.../
|
183
|
+
|
184
|
+
Setup Infra completed successfully.
|
185
|
+
|
186
|
+
Default application has been deployed. You can visit 'demo.aws.app42paas.com' to see the default application.
|
173
187
|
DESC
|
174
188
|
|
175
189
|
end
|
@@ -179,7 +193,7 @@ Example:
|
|
179
193
|
Usage:
|
180
194
|
app42 apps
|
181
195
|
|
182
|
-
|
196
|
+
List all the deployed applications with their meta details
|
183
197
|
|
184
198
|
Example:
|
185
199
|
$app42 apps
|
@@ -200,7 +214,7 @@ Example:
|
|
200
214
|
Usage:
|
201
215
|
app42 deploy
|
202
216
|
|
203
|
-
Deploy application
|
217
|
+
Deploy the application over your runtime environment
|
204
218
|
|
205
219
|
Options:
|
206
220
|
[--app APP] # Name of app, you want to update
|
@@ -211,36 +225,13 @@ Example:
|
|
211
225
|
Would you like to deploy from the current directory? [Yn]: n
|
212
226
|
Binary Deployment Path: /home/ubuntu/workspace/Deploycode/ruby
|
213
227
|
Deploying Application... OK
|
214
|
-
|
228
|
+
Operation is in progress, Please wait....|
|
215
229
|
1 out of 1 Uploaded
|
216
230
|
Application deployed successfully.
|
217
231
|
DESC
|
218
232
|
|
219
233
|
end
|
220
234
|
|
221
|
-
def update
|
222
|
-
print <<-DESC
|
223
|
-
Usage:
|
224
|
-
app42 update
|
225
|
-
|
226
|
-
Update existing application
|
227
|
-
|
228
|
-
Options:
|
229
|
-
[--app APP] # Name of app, you want to update
|
230
|
-
|
231
|
-
Example:
|
232
|
-
$app42 update
|
233
|
-
Enter App Name: demo
|
234
|
-
Would you like to deploy from the current directory? [Yn]: n
|
235
|
-
Binary Deployment Path: /home/ubuntu/workspace/Deploycode/ruby
|
236
|
-
Deploying Application... OK
|
237
|
-
Latest Status....|
|
238
|
-
1 out of 1 Uploaded
|
239
|
-
Application deployed successfully.
|
240
|
-
|
241
|
-
DESC
|
242
|
-
end
|
243
|
-
|
244
235
|
def start
|
245
236
|
print <<-DESC
|
246
237
|
Usage:
|
@@ -290,7 +281,7 @@ Example:
|
|
290
281
|
DESC
|
291
282
|
end
|
292
283
|
|
293
|
-
def
|
284
|
+
def deleteinfra
|
294
285
|
print <<-DESC
|
295
286
|
Usage:
|
296
287
|
app42 deleteInfra
|
@@ -320,9 +311,8 @@ Example:
|
|
320
311
|
$app42 descale --app demo
|
321
312
|
Descale by instance(s): 1
|
322
313
|
Descaling Application demo by instance 1... OK
|
323
|
-
|
324
|
-
|
325
|
-
Latest Status....|
|
314
|
+
|
315
|
+
Operation is in progress, Please wait...|
|
326
316
|
Descale completed successfully.
|
327
317
|
DESC
|
328
318
|
end
|
@@ -341,16 +331,13 @@ Example:
|
|
341
331
|
$app42 scale --app demo
|
342
332
|
Scale by instance(s): 1
|
343
333
|
Scaling Application demo by instance 1... OK
|
344
|
-
|
345
|
-
|
346
|
-
Latest Status....|
|
334
|
+
|
335
|
+
Operation is in progress, Please wait...|
|
347
336
|
Scale completed successfully.
|
348
|
-
|
349
|
-
|
350
337
|
DESC
|
351
338
|
end
|
352
339
|
|
353
|
-
def
|
340
|
+
def appinfo
|
354
341
|
print <<-DESC
|
355
342
|
Usage:
|
356
343
|
app42 appInfo
|
@@ -373,7 +360,7 @@ Example:
|
|
373
360
|
DESC
|
374
361
|
end
|
375
362
|
|
376
|
-
def
|
363
|
+
def appstate
|
377
364
|
print <<-DESC
|
378
365
|
Usage:
|
379
366
|
app42 appState
|
@@ -398,7 +385,7 @@ Example:
|
|
398
385
|
Usage:
|
399
386
|
app42 logs
|
400
387
|
|
401
|
-
Returns the log
|
388
|
+
Returns the log URL(s) for the application
|
402
389
|
|
403
390
|
Example:
|
404
391
|
$app42 logs
|
@@ -415,43 +402,54 @@ Example:
|
|
415
402
|
end
|
416
403
|
|
417
404
|
|
418
|
-
def
|
405
|
+
def createservice
|
419
406
|
print <<-DESC
|
420
407
|
Usage:
|
421
408
|
app42 createService
|
422
409
|
|
423
|
-
Creates a new service
|
410
|
+
Creates a new service e.g. MySQL, MongoDB, CouchDB, PostgreSQL etc.
|
424
411
|
|
425
412
|
Example:
|
426
413
|
$app42 createService
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
414
|
+
Enter Service Name: mysqldemo
|
415
|
+
|
416
|
+
Checking Service Name Availability... OK
|
417
|
+
|
418
|
+
1: MySQL 5.5.1
|
419
|
+
2: Mongodb 2.4
|
420
|
+
3: Couchdb 10.1
|
421
|
+
4: PostgreSQL 9.1
|
422
|
+
Select Service [MySQL 5.5.1]: 1
|
423
|
+
|
424
|
+
Enter Database Name: demodb
|
425
|
+
|
432
426
|
1: Shared
|
433
|
-
Select Virtual Machine Type:
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
427
|
+
Select Virtual Machine Type [Shared]:
|
428
|
+
|
429
|
+
1: Amazon US West-2a
|
430
|
+
Select IaaS Provider [Amazon US West-2a]: 1
|
431
|
+
|
432
|
+
1: 512 MB
|
433
|
+
2: 1024 MB
|
434
|
+
3: 2048 MB
|
435
|
+
Memory Limit [512 MB]: 1
|
436
|
+
|
440
437
|
Creating Service... OK
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
438
|
+
|
439
|
+
Operation is in progress, Please wait...|
|
440
|
+
Service created successfully.
|
441
|
+
|
442
|
+
+---------------+---------------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
443
|
+
| === mysqldemo Details === |
|
444
|
+
+---------------+---------------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
445
|
+
| Database Name | Iaas Provider | Vm Ip | State | User Name | Vm Port | Service Type | Password | Memory | Service Name |
|
446
|
+
+---------------+---------------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
447
|
+
| demodb | Amazon | 10.0.0.52 | RUNNING | j7zz1jsx1bb4eiz1 | 49695 | MySQL 5.5.1 | teh77o4b6kpb22ab6oogfu9lwru9vrlj | 512 MB | mysqldemo |
|
448
|
+
+---------------+---------------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
451
449
|
DESC
|
452
450
|
end
|
453
451
|
|
454
|
-
def
|
452
|
+
def deleteservice
|
455
453
|
print <<-DESC
|
456
454
|
Usage:
|
457
455
|
app42 deleteService
|
@@ -463,13 +461,12 @@ Options:
|
|
463
461
|
|
464
462
|
Example:
|
465
463
|
$app42 deleteService
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
Latest Status....-
|
470
|
-
1 out of 1 deleted
|
471
|
-
Service mysql-demo successfully deleted.
|
464
|
+
Enter Service Name: mysqldemo
|
465
|
+
|
466
|
+
Deleting Service... OK
|
472
467
|
|
468
|
+
Operation is in progress, Please wait...|
|
469
|
+
Service deleted successfully.
|
473
470
|
DESC
|
474
471
|
end
|
475
472
|
|
@@ -482,22 +479,22 @@ Usage:
|
|
482
479
|
|
483
480
|
Example:
|
484
481
|
$app42 services
|
485
|
-
|
486
|
-
|
|
487
|
-
|
488
|
-
| Iaas Provider | Vm
|
489
|
-
|
490
|
-
| Amazon |
|
491
|
-
|
482
|
+
+---------------+---------------+-----------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+
|
483
|
+
| === Service List === |
|
484
|
+
+---------------+---------------+-----------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+
|
485
|
+
| Database Name | Iaas Provider | Name | Vm Ip | State | User Name | Vm Port | Service Type | Password | Memory |
|
486
|
+
+---------------+---------------+-----------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+
|
487
|
+
| demodb | Amazon | mysqldemo | 10.0.0.52 | RUNNING | j7zz1jsx1bb4eiz1 | 49695 | MySQL 5.5.1 | teh77o4b6kpb22ab6oogfu9lwru9vrlj | 512 MB |
|
488
|
+
+---------------+---------------+-----------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+
|
492
489
|
DESC
|
493
490
|
end
|
494
491
|
|
495
|
-
def
|
492
|
+
def serviceinfo
|
496
493
|
print <<-DESC
|
497
494
|
Usage:
|
498
495
|
app42 serviceInfo
|
499
496
|
|
500
|
-
Show
|
497
|
+
Show meta information of the provisioned service
|
501
498
|
|
502
499
|
Options:
|
503
500
|
[--service SERVICE] # Name of service
|
@@ -517,7 +514,7 @@ Example:
|
|
517
514
|
DESC
|
518
515
|
end
|
519
516
|
|
520
|
-
def
|
517
|
+
def supportedservices
|
521
518
|
print <<-DESC
|
522
519
|
Usage:
|
523
520
|
app42 supportedServices
|
@@ -526,14 +523,38 @@ Usage:
|
|
526
523
|
|
527
524
|
Example:
|
528
525
|
$app42 supportedServices
|
529
|
-
|
530
|
-
|
|
531
|
-
|
532
|
-
| Name |
|
533
|
-
|
534
|
-
|
|
535
|
-
| Mongodb | 2.4
|
536
|
-
|
526
|
+
+--------------+--------------+
|
527
|
+
| === App42 PaaS Services === |
|
528
|
+
+--------------+--------------+
|
529
|
+
| Name | Version |
|
530
|
+
+--------------+--------------+
|
531
|
+
| MySQL | 5.5.1 |
|
532
|
+
| Mongodb | 2.4 |
|
533
|
+
| Couchdb | 10.1 |
|
534
|
+
| PostgreSQL | 9.1 |
|
535
|
+
+--------------+--------------+
|
536
|
+
DESC
|
537
|
+
end
|
538
|
+
|
539
|
+
def activities
|
540
|
+
print <<-DESC
|
541
|
+
Usage:
|
542
|
+
app42 activities
|
543
|
+
|
544
|
+
List all activities with their status
|
545
|
+
|
546
|
+
Example:
|
547
|
+
$app42 activities
|
548
|
+
+---------------+-----------+---------+---------+-----------------------+
|
549
|
+
| === User Activities === |
|
550
|
+
+---------------+-----------+---------+---------+-----------------------+
|
551
|
+
| Operation | Status | Name | Type | Date |
|
552
|
+
+---------------+-----------+---------+---------+-----------------------+
|
553
|
+
| setupInfra | COMPLETED | demo | APP | 2013-08-27 06:24:03.0 |
|
554
|
+
| scale | COMPLETED | demo | APP | 2013-08-27 06:32:15.0 |
|
555
|
+
| createService | COMPLETED | couchdb | SERVICE | 2013-08-27 06:33:56.0 |
|
556
|
+
| setupInfra | COMPLETED | demo1 | APP | 2013-08-27 07:00:47.0 |
|
557
|
+
+---------------+-----------+---------+---------+-----------------------+
|
537
558
|
DESC
|
538
559
|
end
|
539
560
|
|
@@ -554,12 +575,13 @@ Example:
|
|
554
575
|
| Ruby | 2.0 |
|
555
576
|
| Java | 6.0 |
|
556
577
|
| Java | 7.0 |
|
578
|
+
| Php | 5.3 |
|
557
579
|
| Php | 5.5 |
|
558
580
|
+--------------+--------------+
|
559
581
|
DESC
|
560
582
|
end
|
561
583
|
|
562
|
-
def
|
584
|
+
def iaasproviders
|
563
585
|
print <<-DESC
|
564
586
|
Usage:
|
565
587
|
app42 iaasProviders
|
@@ -605,7 +627,7 @@ Example:
|
|
605
627
|
DESC
|
606
628
|
end
|
607
629
|
|
608
|
-
def
|
630
|
+
def resetservicepassword
|
609
631
|
print <<-DESC
|
610
632
|
Usage:
|
611
633
|
resetServicePassword
|
@@ -614,85 +636,87 @@ Usage:
|
|
614
636
|
|
615
637
|
Example:
|
616
638
|
$resetServicePassword
|
617
|
-
Enter Service Name:
|
618
|
-
|
639
|
+
Enter Service Name: mysqldemo
|
640
|
+
|
641
|
+
Enter Old Password: teh77o4b6kpb22ab6oogfu9lwru9vrlj
|
642
|
+
|
619
643
|
Resetting Password... OK
|
620
|
-
|
644
|
+
|
645
|
+
Operation is in progress, Please wait.../
|
646
|
+
Service Password has been reset successfully.
|
621
647
|
|
622
|
-
|
623
|
-
Reset Password successful.Your new password is: quzg6bogsu0ak3rwyr0egs8a1ttgc9tt
|
648
|
+
Your new password is: z2qo1vxeadak6jsmt9upobytwptc5eo0
|
624
649
|
DESC
|
625
650
|
end
|
626
651
|
|
627
|
-
def
|
652
|
+
def bindip
|
628
653
|
print <<-DESC
|
629
654
|
Usage:
|
630
655
|
app42 bindIP
|
631
656
|
|
632
|
-
Bind IP to
|
657
|
+
Bind IP to provisioned service
|
633
658
|
|
634
659
|
Example:
|
635
660
|
$app42 bindIP
|
636
|
-
Enter Service Name:
|
661
|
+
Enter Service Name: mysqldemo
|
662
|
+
|
637
663
|
Please Provide Source IP
|
638
|
-
(
|
639
|
-
|
664
|
+
(For public access, use '0.0.0.0'): <IP address>
|
665
|
+
|
640
666
|
Binding IP to service... OK
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
+------------------+--------------+---------------+---------+----------------+-----------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
667
|
+
|
668
|
+
Operation is in progress, Please wait...-
|
669
|
+
Service bind with IP successfully.
|
670
|
+
|
671
|
+
+---------------+---------------+----------------+-----------------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
672
|
+
| === mysqldemo Details === |
|
673
|
+
+---------------+---------------+----------------+-----------------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
674
|
+
| Database Name | Iaas Provider | Vm Ip | Source Ip | State | User Name | Vm Port | Service Type | Password | Memory | Service Name |
|
675
|
+
+---------------+---------------+----------------+-----------------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
676
|
+
| demodb | Amazon | 54.218.127.245 | 122.162.124.222 | RUNNING | j7zz1jsx1bb4eiz1 | 49695 | MySQL 5.5.1 | z2qo1vxeadak6jsmt9upobytwptc5eo0 | 512 MB | mysqldemo |
|
677
|
+
+---------------+---------------+----------------+-----------------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
653
678
|
DESC
|
654
679
|
end
|
655
680
|
|
656
|
-
def
|
681
|
+
def unbindip
|
657
682
|
print <<-DESC
|
658
683
|
Usage:
|
659
684
|
app42 unbindIP
|
660
685
|
|
661
|
-
Unbind
|
686
|
+
Unbind IP from provisioned service
|
662
687
|
|
663
688
|
Example:
|
664
689
|
$app42 unbindIP
|
665
|
-
Enter Service Name:
|
666
|
-
|
667
|
-
|
668
|
-
Unbinding IP to service... OK
|
669
|
-
Please wait it may takes few minutes.
|
690
|
+
Enter Service Name: mysqldemo
|
691
|
+
|
692
|
+
Please Provide Source IP: <IP address>
|
670
693
|
|
671
|
-
|
672
|
-
|
694
|
+
Unbinding IP to service... OK
|
695
|
+
|
696
|
+
Operation is in progress, Please wait...|
|
697
|
+
Service unbind with IP successfully.
|
673
698
|
DESC
|
674
699
|
end
|
675
700
|
|
676
|
-
def
|
701
|
+
def bindinfo
|
677
702
|
print <<-DESC
|
678
703
|
Usage:
|
679
704
|
app42 bindInfo
|
680
705
|
|
681
|
-
Show IP bind information
|
706
|
+
Show IP bind information related to provisioned service
|
682
707
|
|
683
708
|
Example:
|
684
709
|
$app42 bindInfo
|
685
|
-
1:
|
686
|
-
Select Service:
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
710
|
+
1: mysqldemo
|
711
|
+
Select Service [mysqldemo]:
|
712
|
+
|
713
|
+
+---------------+---------------+----------------+-----------------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
714
|
+
| === mysqldemo Details === |
|
715
|
+
+---------------+---------------+----------------+-----------------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
716
|
+
| Database Name | Iaas Provider | Vm Ip | Source Ip | State | User Name | Vm Port | Service Type | Password | Memory | Service Name |
|
717
|
+
+---------------+---------------+----------------+-----------------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
718
|
+
| demodb | Amazon | 54.218.127.245 | 122.162.124.222 | RUNNING | j7zz1jsx1bb4eiz1 | 49695 | MySQL 5.5.1 | z2qo1vxeadak6jsmt9upobytwptc5eo0 | 512 MB | mysqldemo |
|
719
|
+
+---------------+---------------+----------------+-----------------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
696
720
|
DESC
|
697
721
|
end
|
698
722
|
|
data/lib/app42/base/message.rb
CHANGED
@@ -14,8 +14,9 @@ module Message
|
|
14
14
|
NO_BINARY = "No binary exists at the specified location."
|
15
15
|
NO_APP = "No App found."
|
16
16
|
WAIT_FOR_WHILE = "Please be patient... This process may take a while to complete."
|
17
|
-
LATEST_S_WAIT = "
|
18
|
-
|
17
|
+
LATEST_S_WAIT = "\nOperation is in progress, Please wait..."
|
18
|
+
LATEST_S_INTERRUPT = "\nYour request is being processed. Please check the request status after sometime."
|
19
|
+
NOT_A_VALID_NUM = "Instance(s) count should be a valid number and greater than zero."
|
19
20
|
REQUEST_PROGRESS = "\nYour request is in progress. Please check the request status after sometime."
|
20
21
|
LOG_MESSAGE = "Please visit below URL(s) to access app logs"
|
21
22
|
|
data/lib/app42/base/shell.rb
CHANGED
@@ -7,32 +7,33 @@ module App42
|
|
7
7
|
'version',
|
8
8
|
'list',
|
9
9
|
'deploy',
|
10
|
-
'
|
10
|
+
'setupinfra',
|
11
11
|
'keys',
|
12
|
-
'
|
13
|
-
'
|
12
|
+
'clearkeys',
|
13
|
+
'addkeys',
|
14
14
|
'scale',
|
15
15
|
'descale',
|
16
|
-
'
|
16
|
+
'appstate',
|
17
17
|
'apps',
|
18
18
|
'logs',
|
19
|
-
'
|
19
|
+
'appinfo',
|
20
20
|
'releases',
|
21
21
|
'start',
|
22
22
|
'restart',
|
23
23
|
'stop',
|
24
|
-
'
|
25
|
-
'
|
24
|
+
'deleteinfra',
|
25
|
+
'iaasproviders',
|
26
26
|
'runtimes',
|
27
27
|
'services',
|
28
|
-
'
|
29
|
-
'
|
30
|
-
'
|
31
|
-
'
|
32
|
-
'
|
33
|
-
'
|
34
|
-
'
|
35
|
-
'
|
28
|
+
'createservice',
|
29
|
+
'deleteservice',
|
30
|
+
'supportedservices',
|
31
|
+
'activities',
|
32
|
+
'serviceinfo',
|
33
|
+
'resetservicepassword',
|
34
|
+
'bindip',
|
35
|
+
'unbindip',
|
36
|
+
'bindinfo'
|
36
37
|
]
|
37
38
|
|
38
39
|
end
|
data/lib/app42/base/util.rb
CHANGED
@@ -19,11 +19,15 @@ module App42
|
|
19
19
|
#
|
20
20
|
# @return +input string+
|
21
21
|
def input message, choices, indexed = true
|
22
|
-
|
23
|
-
|
22
|
+
if choices.empty?
|
23
|
+
ans = ask Paint["#{message}", :cyan]
|
24
|
+
else
|
25
|
+
list = choices.compact unless choices.empty?
|
26
|
+
ans = ask Paint["#{message}", :cyan],
|
24
27
|
:choices => list,
|
25
28
|
:default => list[0],
|
26
29
|
:indexed => indexed
|
30
|
+
end
|
27
31
|
print_new_line
|
28
32
|
return ans
|
29
33
|
end
|
@@ -125,8 +129,7 @@ module App42
|
|
125
129
|
def check_transaction_status transaction_id, previous_completed, what
|
126
130
|
begin
|
127
131
|
flag = false
|
128
|
-
message "#{Message::LATEST_S_WAIT}",
|
129
|
-
print 'Latest Status....'
|
132
|
+
message "#{Message::LATEST_S_WAIT}", false, 'green'
|
130
133
|
while flag == false do
|
131
134
|
response = status_call transaction_id
|
132
135
|
re_try ||= 1
|
@@ -158,7 +161,7 @@ module App42
|
|
158
161
|
sleep 5
|
159
162
|
end
|
160
163
|
rescue Interrupt
|
161
|
-
|
164
|
+
message "#{Message::LATEST_S_INTERRUPT}", true, 'red'
|
162
165
|
exit!
|
163
166
|
end
|
164
167
|
end
|
@@ -173,7 +176,7 @@ module App42
|
|
173
176
|
response = get_request signature(query_params), resource_url('info', 'transaction'), query_params
|
174
177
|
return response
|
175
178
|
rescue Interrupt
|
176
|
-
|
179
|
+
message "#{Message::LATEST_S_INTERRUPT}", true, 'red'
|
177
180
|
exit!
|
178
181
|
end
|
179
182
|
end
|
@@ -245,7 +248,7 @@ module App42
|
|
245
248
|
# And should not contain any special character
|
246
249
|
def validate_app_and_service_name name, str
|
247
250
|
if str.match(App42::REGEX) || str.length > 30
|
248
|
-
message "#{name} should not contain any special character or white space and
|
251
|
+
message "#{name} should not contain any special character or white space and length should be less than 30.", true, 'red'
|
249
252
|
return false
|
250
253
|
else
|
251
254
|
return str
|
@@ -256,11 +259,11 @@ module App42
|
|
256
259
|
# +database name+ lenght should not be more than 64 character
|
257
260
|
# And should not contain any special character
|
258
261
|
def validate_database_name name, str
|
259
|
-
if str.match(App42::
|
260
|
-
message "
|
262
|
+
if str.match(App42::DBNAME_REGEX) || str.length > 64 || (numeric_including_zero? str)
|
263
|
+
message "Invalid database name. Should be less than 64 characters (Alphabets, alphanumeric and underscore(_) is allowed).", true, 'red'
|
261
264
|
return false
|
262
265
|
elsif App42::DATABASE_NAME_NOT_ALLOWED.include? str
|
263
|
-
message "
|
266
|
+
message "Database Name should not be '#{str}'.", true, 'red'
|
264
267
|
return false
|
265
268
|
else
|
266
269
|
return str
|
data/lib/app42/command/app.rb
CHANGED
@@ -113,8 +113,8 @@ module App42
|
|
113
113
|
#
|
114
114
|
def scale
|
115
115
|
@options[:name] = get_app_name if @options[:name].nil?
|
116
|
-
instance = get_instance __method__ if is_app_exist? @options[:name]
|
117
|
-
scale_or_descal_res = scale_or_descale_app __method__, instance, @options[:name]
|
116
|
+
@options[:instance] = get_instance __method__ if is_app_exist? @options[:name] and @options[:instance].nil?
|
117
|
+
scale_or_descal_res = scale_or_descale_app __method__, @options[:instance], @options[:name]
|
118
118
|
exit! if scale_or_descal_res
|
119
119
|
end
|
120
120
|
|
@@ -123,8 +123,8 @@ module App42
|
|
123
123
|
#
|
124
124
|
def descale
|
125
125
|
@options[:name] = get_app_name if @options[:name].nil?
|
126
|
-
instance = get_instance __method__ if is_app_exist? @options[:name]
|
127
|
-
scale_or_descal_res = scale_or_descale_app __method__, instance, @options[:name]
|
126
|
+
@options[:instance] = get_instance __method__ if is_app_exist? @options[:name] and @options[:instance].nil?
|
127
|
+
scale_or_descal_res = scale_or_descale_app __method__, @options[:instance], @options[:name]
|
128
128
|
exit! if scale_or_descal_res
|
129
129
|
end
|
130
130
|
|
@@ -14,7 +14,7 @@ module App42::Command
|
|
14
14
|
def is_authorize?(api_key, secret_key)
|
15
15
|
if api_key.nil? || secret_key.nil?
|
16
16
|
message "#{Message::ADD_KEY}", true, 'red'
|
17
|
-
puts App42::Base::Help.
|
17
|
+
puts App42::Base::Help.addkeys
|
18
18
|
exit!
|
19
19
|
elsif api_key.size == 1 || secret_key.size == 1
|
20
20
|
message "#{Message::WRONG_KEY}", true, 'red'
|
data/lib/app42/command/base.rb
CHANGED
@@ -39,7 +39,7 @@ module App42
|
|
39
39
|
def get_vm_types
|
40
40
|
vm_type = App42::Command::Config.new.get_vm_type
|
41
41
|
vm_type_array = vm_type['deploymentType'].map(&:capitalize)
|
42
|
-
input "Select
|
42
|
+
input "Select Instance Type", vm_type_array, true
|
43
43
|
end
|
44
44
|
|
45
45
|
# @return iaas providers
|
@@ -62,7 +62,7 @@ module App42
|
|
62
62
|
|
63
63
|
# Ask application name from user and
|
64
64
|
# will wait for user response (user will enter application name)
|
65
|
-
def get_app_name(prompt = Paint['
|
65
|
+
def get_app_name(prompt = Paint['Enter App Name', :cyan])
|
66
66
|
app_name = ask(prompt) {|q| q.each = true}
|
67
67
|
valid_app_name = validate_app_and_service_name "App name", app_name.strip
|
68
68
|
valid_app_name ? (return valid_app_name) : get_app_name
|
@@ -184,7 +184,7 @@ module App42
|
|
184
184
|
query_params = params
|
185
185
|
query_params.store('appName', app_name)
|
186
186
|
|
187
|
-
response = with_progress(Paint["
|
187
|
+
response = with_progress(Paint["Checking App Name Availability", :yellow]) do |s|
|
188
188
|
build_get_request query_params, 'app', 'availability'
|
189
189
|
end
|
190
190
|
|
@@ -233,7 +233,7 @@ module App42
|
|
233
233
|
query_params = params
|
234
234
|
query_params.store('body', body)
|
235
235
|
|
236
|
-
response = with_progress(Paint["
|
236
|
+
response = with_progress(Paint["Setting up the infrastructure", :yellow]) do |s|
|
237
237
|
build_post_request body, query_params, 'app', nil
|
238
238
|
end
|
239
239
|
|
@@ -248,7 +248,7 @@ module App42
|
|
248
248
|
end
|
249
249
|
|
250
250
|
if host_response['success']
|
251
|
-
puts Paint["Default
|
251
|
+
puts Paint["Default application has been deployed. You can visit '#{host_response['appInfo']['appUrl']}' to see the default application.", :green]
|
252
252
|
return true
|
253
253
|
else
|
254
254
|
puts Paint["#{response['description']}", :red]
|
@@ -502,17 +502,17 @@ module App42
|
|
502
502
|
#
|
503
503
|
# ==== Parameters
|
504
504
|
# service_name = service name provided by user
|
505
|
-
#
|
505
|
+
# service_token = service token
|
506
506
|
#
|
507
507
|
# ==== return
|
508
508
|
# true:: if reset password successful
|
509
509
|
# OR
|
510
510
|
# ERROR message in case failed
|
511
|
-
def reset_password service_name,
|
511
|
+
def reset_password service_name, service_token
|
512
512
|
begin
|
513
|
-
body = {'app42'
|
513
|
+
body = {'app42' => {"request"=> {
|
514
514
|
"serviceName" => service_name,
|
515
|
-
"
|
515
|
+
"token" => service_token
|
516
516
|
}}}.to_json
|
517
517
|
|
518
518
|
query_params = params
|
@@ -642,7 +642,7 @@ module App42
|
|
642
642
|
instance = @options[:instance] if @options[:instance]
|
643
643
|
unless instance
|
644
644
|
instance = nil
|
645
|
-
instance = ask Paint[ obj == 'new_vm' ? "No of instances you want?" : "#{obj.capitalize} by instance(s)", :cyan]
|
645
|
+
instance = ask Paint[ obj == 'new_vm' ? "No of instances you want?" : "#{obj.capitalize} by instance(s)", :cyan], :default => 1
|
646
646
|
|
647
647
|
end
|
648
648
|
|
data/lib/app42/command/client.rb
CHANGED
@@ -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('--
|
63
|
-
opts.on('--
|
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
|
|
@@ -83,8 +83,8 @@ module App42
|
|
83
83
|
# @param [Object] args
|
84
84
|
def start(command, args = [])
|
85
85
|
if is_available?(command)
|
86
|
-
parse_options(command, args)
|
87
|
-
execute command
|
86
|
+
parse_options(command.downcase, args)
|
87
|
+
execute command.downcase
|
88
88
|
cmd = App42::Command.const_get(@kclass.to_s.capitalize)
|
89
89
|
begin
|
90
90
|
cmd.new(@options).send(@command)
|
@@ -95,7 +95,7 @@ module App42
|
|
95
95
|
puts e
|
96
96
|
end
|
97
97
|
elsif command == 'help'
|
98
|
-
send(command)
|
98
|
+
send(command.downcase)
|
99
99
|
else
|
100
100
|
puts Paint["app42: Unknown command [#{command}]", :red]
|
101
101
|
App42::Base::Help.how_to
|
@@ -105,7 +105,7 @@ module App42
|
|
105
105
|
|
106
106
|
# @return true OR false
|
107
107
|
def is_available? command
|
108
|
-
App42::Base::APP42_COMMAND.include?(command)
|
108
|
+
App42::Base::APP42_COMMAND.include?(command.downcase)
|
109
109
|
end
|
110
110
|
|
111
111
|
# choose action respective of class
|
@@ -123,7 +123,7 @@ module App42
|
|
123
123
|
when 'deploy'
|
124
124
|
set_cmd(:app, :deploy)
|
125
125
|
|
126
|
-
when '
|
126
|
+
when 'setupinfra'
|
127
127
|
set_cmd(:app, :setup_infra)
|
128
128
|
|
129
129
|
when 'update'
|
@@ -132,10 +132,10 @@ module App42
|
|
132
132
|
when 'keys'
|
133
133
|
set_cmd(:user, :keys)
|
134
134
|
|
135
|
-
when '
|
135
|
+
when 'clearkeys'
|
136
136
|
set_cmd(:user, :clear)
|
137
137
|
|
138
|
-
when '
|
138
|
+
when 'addkeys'
|
139
139
|
set_cmd(:user, :add)
|
140
140
|
|
141
141
|
when 'scale'
|
@@ -144,10 +144,10 @@ module App42
|
|
144
144
|
when 'descale'
|
145
145
|
set_cmd(:app, :descale)
|
146
146
|
|
147
|
-
when '
|
147
|
+
when 'appstate'
|
148
148
|
set_cmd(:info, :state)
|
149
149
|
|
150
|
-
when '
|
150
|
+
when 'appinfo'
|
151
151
|
set_cmd(:info, :info)
|
152
152
|
|
153
153
|
when 'logs'
|
@@ -162,13 +162,13 @@ module App42
|
|
162
162
|
when 'restart'
|
163
163
|
set_cmd(:app, :restart)
|
164
164
|
|
165
|
-
when '
|
165
|
+
when 'deleteinfra'
|
166
166
|
set_cmd(:app, :delete)
|
167
167
|
|
168
168
|
when 'releases'
|
169
169
|
set_cmd(:info, :releases)
|
170
170
|
|
171
|
-
when '
|
171
|
+
when 'iaasproviders'
|
172
172
|
set_cmd(:config, :iaas_providers)
|
173
173
|
|
174
174
|
when 'frameworks'
|
@@ -183,31 +183,34 @@ module App42
|
|
183
183
|
when 'app42-update'
|
184
184
|
set_cmd(:config, :update)
|
185
185
|
|
186
|
-
when '
|
186
|
+
when 'supportedservices'
|
187
187
|
set_cmd(:service, :app42pass_services)
|
188
188
|
|
189
|
+
when 'activities'
|
190
|
+
set_cmd(:info, :activities)
|
191
|
+
|
189
192
|
when 'services'
|
190
193
|
set_cmd(:service, :services)
|
191
194
|
|
192
|
-
when '
|
195
|
+
when 'serviceinfo'
|
193
196
|
set_cmd(:service, :info)
|
194
197
|
|
195
|
-
when '
|
198
|
+
when 'createservice'
|
196
199
|
set_cmd(:service, :create)
|
197
200
|
|
198
|
-
when '
|
201
|
+
when 'deleteservice'
|
199
202
|
set_cmd(:service, :delete)
|
200
203
|
|
201
|
-
when '
|
204
|
+
when 'resetservicepassword'
|
202
205
|
set_cmd(:service, :reset_pass)
|
203
206
|
|
204
|
-
when '
|
207
|
+
when 'bindip'
|
205
208
|
set_cmd(:service, :service_bind)
|
206
209
|
|
207
|
-
when '
|
210
|
+
when 'unbindip'
|
208
211
|
set_cmd(:service, :service_unbind)
|
209
212
|
|
210
|
-
when '
|
213
|
+
when 'bindinfo'
|
211
214
|
set_cmd(:service, :service_bindInfo)
|
212
215
|
|
213
216
|
else
|
data/lib/app42/command/info.rb
CHANGED
@@ -5,6 +5,13 @@ module App42
|
|
5
5
|
module Command
|
6
6
|
class Info < Base
|
7
7
|
|
8
|
+
#
|
9
|
+
# return user activites
|
10
|
+
#
|
11
|
+
def get_activities
|
12
|
+
build_get_request params, 'info', 'activities'
|
13
|
+
end
|
14
|
+
|
8
15
|
|
9
16
|
#
|
10
17
|
# show detailed app information
|
@@ -69,6 +76,22 @@ module App42
|
|
69
76
|
puts table
|
70
77
|
end
|
71
78
|
|
79
|
+
# will return details of user activities like operation, status, date etc.
|
80
|
+
def activities
|
81
|
+
rows, rows_header_final, rows_header = [], [], nil
|
82
|
+
user_activities = get_activities
|
83
|
+
if user_activities['success'] && user_activities['activities']
|
84
|
+
user_activities['activities'].each do |each_activity|
|
85
|
+
rows_header = each_activity.keys
|
86
|
+
rows << each_activity.values
|
87
|
+
end
|
88
|
+
rows_header.map { |e| rows_header_final << camel_case_to_whitespace(e) }
|
89
|
+
|
90
|
+
table = Terminal::Table.new :title => Paint["=== User Activities ===", :green], :headings => rows_header_final, :rows => rows
|
91
|
+
puts table
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
72
95
|
#
|
73
96
|
# list releases
|
74
97
|
#
|
@@ -25,14 +25,14 @@ module App42::Command
|
|
25
25
|
|
26
26
|
# ask service name to user
|
27
27
|
def ask_service_name
|
28
|
-
service_name =
|
28
|
+
service_name = ask Paint["Enter Service Name", :cyan]
|
29
29
|
valid_service_name = validate_app_and_service_name "Service name", service_name.strip
|
30
30
|
valid_service_name ? (return valid_service_name) : ask_service_name
|
31
31
|
end
|
32
32
|
|
33
33
|
# ask old password to user
|
34
|
-
def
|
35
|
-
input "Enter
|
34
|
+
def ask_service_token
|
35
|
+
input "Enter Service Token", [], true
|
36
36
|
end
|
37
37
|
|
38
38
|
# ask source id to user which he want to bind to service
|
@@ -99,8 +99,8 @@ module App42::Command
|
|
99
99
|
# collect service name from user and proceed service resetPassword request
|
100
100
|
def reset_pass
|
101
101
|
@options[:service] = ask_service_name if @options[:service].nil?
|
102
|
-
|
103
|
-
res = reset_password @options[:service],
|
102
|
+
service_token = ask_service_token if is_service_exist? @options[:service]
|
103
|
+
res = reset_password @options[:service], service_token
|
104
104
|
(puts message "Your new password is: #{res['service']['password']}", false, 'green') && exit! if res
|
105
105
|
end
|
106
106
|
|
data/lib/app42/command/user.rb
CHANGED
data/lib/app42/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app42
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShepHertz
|
@@ -10,6 +10,20 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2013-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|