app42 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +119 -0
- data/Rakefile +5 -0
- data/TODO.txt +36 -0
- data/app42.gemspec +41 -0
- data/bin/app42 +15 -0
- data/lib/app42.rb +23 -0
- data/lib/app42/base/constants.rb +33 -0
- data/lib/app42/base/help.rb +717 -0
- data/lib/app42/base/http_helper.rb +46 -0
- data/lib/app42/base/message.rb +35 -0
- data/lib/app42/base/shell.rb +39 -0
- data/lib/app42/base/util.rb +304 -0
- data/lib/app42/client/app42_rest_client.rb +451 -0
- data/lib/app42/client/rest_util.rb +66 -0
- data/lib/app42/command/app.rb +194 -0
- data/lib/app42/command/authorize.rb +29 -0
- data/lib/app42/command/base.rb +660 -0
- data/lib/app42/command/client.rb +232 -0
- data/lib/app42/command/config.rb +185 -0
- data/lib/app42/command/info.rb +101 -0
- data/lib/app42/command/service.rb +196 -0
- data/lib/app42/command/user.rb +140 -0
- data/lib/app42/command/user_key.rb +68 -0
- data/lib/app42/version.rb +13 -0
- data/spec/app42/base/constants_spec.rb +11 -0
- data/spec/app42/command/app_spec.rb +103 -0
- data/spec/app42/command/base_spec.rb +7 -0
- data/spec/app42/command/config_spec.rb +20 -0
- data/spec/app42/command/info_spec.rb +27 -0
- data/spec/app42/command/service_spec.rb +98 -0
- data/spec/app42/command/user_spec.rb +7 -0
- data/spec/app42/command/user_token_spec.rb +40 -0
- data/spec/app42/version_spec.rb +7 -0
- data/spec/app42_spec.rb +2 -0
- data/spec/data/info.yml +16 -0
- data/spec/data/services.yml +25 -0
- data/spec/data/state.yml +16 -0
- data/spec/data/user_services.yml +18 -0
- data/spec/spec_helper.rb +18 -0
- metadata +257 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a5b8f7a110424af73acd4b1847822ae7bfbfe7ed
|
4
|
+
data.tar.gz: aaf5f21ad1ce5e6935d8af8bc3a31e1eb79b83e0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: df400c060594ecdc8d45be5a691aa713e561f54867daf61066c378ffdab8cc5080c663ffe76637add38335085ae85746bd0454c8f03ef2aff5df789673047ced
|
7
|
+
data.tar.gz: 4f1d155bf9b9b876af03124478b5a0a50fa4daa56bc3f6e9d284ff2f294fe367ab1ab4487d9b5ebb0ab2edaf80af8c82ff2b3f018ccf3198e688182a50b04cf4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 PravinKShepHertz
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# App42
|
2
|
+
|
3
|
+
Client library and command-line tool to deploy and manage apps on App42PaaS.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install app42 like any other ruby gem:
|
8
|
+
|
9
|
+
### Linux
|
10
|
+
To install the client gem, you must have ruby installed on your system.
|
11
|
+
|
12
|
+
INSTALL THE NEEDED LIBRARIES
|
13
|
+
|
14
|
+
$ sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev
|
15
|
+
|
16
|
+
DOWNLOAD AND INSTALL RUBY 1.9.3
|
17
|
+
|
18
|
+
$ sudo apt-get update
|
19
|
+
$ sudo apt-get install ruby1.9.3
|
20
|
+
|
21
|
+
INSTALL APP42 CLIENT
|
22
|
+
|
23
|
+
$ gem install app42-0.5.0.gem
|
24
|
+
|
25
|
+
Note: app42 require Ruby 1.9.2 or newer.
|
26
|
+
|
27
|
+
### Mac OS X
|
28
|
+
|
29
|
+
To install the client gem, you must have ruby installed on your system.
|
30
|
+
You can use MacPort to download and compile everything.
|
31
|
+
|
32
|
+
Install MacPort http://www.macports.org/
|
33
|
+
From a terminal window, install Ruby
|
34
|
+
|
35
|
+
$ sudo port install ruby19 _nosuffix
|
36
|
+
$ sudo port select --set ruby ruby19
|
37
|
+
$ alias ruby='/opt/local/bin/ruby1.9'
|
38
|
+
|
39
|
+
INSTALL APP42 CLIENT
|
40
|
+
|
41
|
+
$gem install app42-0.5.0.gem
|
42
|
+
|
43
|
+
Note: app42 require Ruby 1.9.2 or newer.
|
44
|
+
|
45
|
+
### Windows
|
46
|
+
|
47
|
+
To install the client gem, you must have ruby installed on your system.
|
48
|
+
|
49
|
+
Download and install Ruby Installer(http://rubyinstaller.org/) for Windows and set ruby to your path to access App42 from command prompt.
|
50
|
+
|
51
|
+
Then got to command prompt from windows Start menu, Open cmd and install App42 client.
|
52
|
+
|
53
|
+
$ gem install app42-0.5.0.gem
|
54
|
+
|
55
|
+
Note: app42 require Ruby 1.9.2 or newer.
|
56
|
+
|
57
|
+
## Commands
|
58
|
+
|
59
|
+
Usage: app42 COMMAND [command-specific-options]
|
60
|
+
|
61
|
+
App42 primary commands:
|
62
|
+
|
63
|
+
keys # List keys of the current user
|
64
|
+
keys:add # Configure API and secret keys on local system
|
65
|
+
setup-infra # Create infrastructure
|
66
|
+
deploy # Deploy application
|
67
|
+
update # Update existing application
|
68
|
+
scale # Scale application by number of instance
|
69
|
+
descale # Descale application by number of instance
|
70
|
+
service-create # Create a new service
|
71
|
+
service-delete # Delete a provisioned service
|
72
|
+
|
73
|
+
App42 additional commands:
|
74
|
+
|
75
|
+
keys:clear # Clear all API and secret keys from local system
|
76
|
+
apps # List deployed applications
|
77
|
+
start # Start the application
|
78
|
+
stop # Stop the application
|
79
|
+
restart # Restart the application
|
80
|
+
delete # Delete the application
|
81
|
+
info # Show application information
|
82
|
+
state # Show the application state
|
83
|
+
services # List provisioned services
|
84
|
+
app42-services # List the available services
|
85
|
+
iaas-providers # List the available IaaS providers
|
86
|
+
runtimes # List the supported runtimes
|
87
|
+
version # List version
|
88
|
+
app42-update # List the App42PaaS client
|
89
|
+
help # List help
|
90
|
+
COMMAND --help # Display detailed help of specific command
|
91
|
+
|
92
|
+
## Usage
|
93
|
+
|
94
|
+
### $ app42 keys
|
95
|
+
|
96
|
+
=== Your keys ===
|
97
|
+
|
98
|
+
API Key = df1dcdb0-958c-0130-9368-3c970e529c4b
|
99
|
+
|
100
|
+
Secret Key = be9faaf56ff75bacae2ac9712b02c8feb8ffc6bb3381b60e1e9efccccd81086d
|
101
|
+
|
102
|
+
### $ app42 apps
|
103
|
+
|
104
|
+
+-------------------------+------------+-----------------+---------------+---------+-------+
|
105
|
+
| === My Apps === |
|
106
|
+
+-------------------------+------------+-----------------+---------------+---------+-------+
|
107
|
+
| App url | App status | Container count | Iaas provider | Vm type | Name |
|
108
|
+
+-------------------------+------------+-----------------+---------------+---------+-------+
|
109
|
+
| demo.aws.app42paas.com | STOPPED | 4 | Amazon | Shared | demo |
|
110
|
+
| demo1.aws.app42paas.com | RUNNING | 1 | Amazon | Shared | demo1 |
|
111
|
+
+-------------------------+------------+-----------------+---------------+---------+-------+
|
112
|
+
|
113
|
+
## Contributing
|
114
|
+
|
115
|
+
1. Fork it
|
116
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
117
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
118
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
119
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/TODO.txt
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
- Authenticate user at entry point
|
2
|
+
- Authenticate in parent class initializer
|
3
|
+
|
4
|
+
- Auth methods should be instance
|
5
|
+
|
6
|
+
- Move all app deploy interactive details to constants OR globe file
|
7
|
+
|
8
|
+
Code should be enough smart to handle exceptions
|
9
|
+
- BadTarget
|
10
|
+
- AuthError
|
11
|
+
- TargetError
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
- We can store app_url details into local YML
|
17
|
+
- Zip_code, should have proper dir(Probably app_name, May user will have multiple apps)
|
18
|
+
- Rest multipart, should be dynamic for multiple calls
|
19
|
+
|
20
|
+
- Need to improve help class
|
21
|
+
- Need to improve helpers class, All common methods will move to helper.
|
22
|
+
- App update need to work
|
23
|
+
- Separate methods for root help and command help
|
24
|
+
- Shell command and description should be dynamic(get from pass server)
|
25
|
+
|
26
|
+
- Remove extarcted app dir from .app42
|
27
|
+
|
28
|
+
- Exception for invalid argument
|
29
|
+
|
30
|
+
- Rspec test case for all class and methods
|
31
|
+
|
32
|
+
|
33
|
+
#app_name = 'demo'
|
34
|
+
##source_url = '/home/ubuntu/workspace/Deploycode/sinatra/test.zip'
|
35
|
+
##source_url = '/home/ubuntu/workspace/Deploycode/ruby/demo.zip'
|
36
|
+
#source_url = '/home/ubuntu/workspace/Deploycode/java/Calendar.war'
|
data/app42.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'app42/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.required_ruby_version = '>= 1.9.2'
|
8
|
+
spec.post_install_message = "Thanks for installing!"
|
9
|
+
spec.name = "app42"
|
10
|
+
spec.version = App42::Version::VERSION::VERSION
|
11
|
+
spec.authors = ["ShepHertz"]
|
12
|
+
spec.email = ["support@shephertz.com"]
|
13
|
+
spec.description = "Client library and command-line tool to deploy and manage apps on App42PaaS."
|
14
|
+
spec.summary = "Client library and command-line tool to deploy and manage apps on App42PaaS Server."
|
15
|
+
spec.homepage = "http://shephertz.com"
|
16
|
+
spec.license = "MIT"
|
17
|
+
# FIXME, before release
|
18
|
+
# spec.post_install_message = <<-MESSAGE
|
19
|
+
# ! Download and install from: http://rubygems.org/
|
20
|
+
# ! For API access, see: https://github.com/shephertz/app42.rb
|
21
|
+
# MESSAGE
|
22
|
+
|
23
|
+
spec.files = `git ls-files`.split($/)
|
24
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
25
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
spec.add_dependency "bundler", "~> 1.3"
|
29
|
+
spec.add_dependency "rake"
|
30
|
+
spec.add_dependency "highline", "~> 1.6.18"
|
31
|
+
spec.add_dependency "paint", "~> 0.8.6"
|
32
|
+
spec.add_dependency "rest-client", "~> 1.6.1"
|
33
|
+
spec.add_dependency "json_pure", "= 1.6.6"
|
34
|
+
spec.add_dependency "ruby-hmac", "= 0.4.0"
|
35
|
+
spec.add_dependency "interact", "~> 0.5.2"
|
36
|
+
spec.add_dependency "terminal-table", "~> 1.4.2"
|
37
|
+
spec.add_dependency "ipaddress"
|
38
|
+
|
39
|
+
spec.add_development_dependency 'rspec', '~> 2.5'
|
40
|
+
|
41
|
+
end
|
data/bin/app42
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require 'app42'
|
5
|
+
require 'app42/command/client'
|
6
|
+
|
7
|
+
# resolve bin path, ignoring symlinks
|
8
|
+
require "pathname"
|
9
|
+
bin_file = Pathname.new(__FILE__).realpath
|
10
|
+
|
11
|
+
# add self to libpath
|
12
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
13
|
+
|
14
|
+
# start up the app42
|
15
|
+
App42::Command::Client.app42(*ARGV)
|
data/lib/app42.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
|
3
|
+
require 'app42/version'
|
4
|
+
|
5
|
+
command_files = "../app42/{base,client,util}/*.rb"
|
6
|
+
Dir[File.expand_path(command_files, __FILE__)].each do |file|
|
7
|
+
require file
|
8
|
+
end
|
9
|
+
|
10
|
+
module App42
|
11
|
+
|
12
|
+
APP42_AGENT = "app42-gem(#{App42::Version::VERSION::VERSION}) (#{RUBY_PLATFORM}) ruby(#{RUBY_VERSION})"
|
13
|
+
|
14
|
+
def self.user_agent
|
15
|
+
@@user_agent ||= APP42_AGENT
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.user_agent=(agent)
|
19
|
+
@@user_agent = agent
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module App42
|
2
|
+
|
3
|
+
# app42 server version
|
4
|
+
VERSION = 1.0.to_s
|
5
|
+
|
6
|
+
# app42 host url
|
7
|
+
# FIXME, need to fix before release
|
8
|
+
HOST = "http://54.218.127.212:8081/paas/#{VERSION}"
|
9
|
+
|
10
|
+
# app42 configuration directory
|
11
|
+
CONFIG_DIR = "~/.app42".freeze
|
12
|
+
|
13
|
+
# TODO, need to configure for client log
|
14
|
+
LOGS_DIR = "#{CONFIG_DIR}/logs".freeze
|
15
|
+
KEYS_FILE = "#{CONFIG_DIR}/app42paas.yml".freeze
|
16
|
+
|
17
|
+
JSON_MIME_TYPE = "application/json".freeze
|
18
|
+
XML_MIME_TYPE = "application/xml".freeze
|
19
|
+
|
20
|
+
# Error codes
|
21
|
+
APP42_HTTP_ERROR_CODES = [ 1500 ]
|
22
|
+
|
23
|
+
DATABASE_NAME_NOT_ALLOWED = %w(mysql couchdb mongodb postgresql database)
|
24
|
+
|
25
|
+
# regex for special character
|
26
|
+
SPECIAL = "?<>',?[]}{=-)(*&^%$#`~{}@ .+!_/"
|
27
|
+
REGEX = /[#{SPECIAL.gsub(/./){|char| "\\#{char}"}}]/
|
28
|
+
|
29
|
+
# regex for IP Address
|
30
|
+
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
|
+
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,717 @@
|
|
1
|
+
require 'paint'
|
2
|
+
|
3
|
+
# list commands and display help
|
4
|
+
#
|
5
|
+
module App42
|
6
|
+
module Base
|
7
|
+
class Help
|
8
|
+
|
9
|
+
#
|
10
|
+
# details how to use app42 commands
|
11
|
+
#
|
12
|
+
def self.how_to
|
13
|
+
Paint["Usage: app42 COMMAND [command-specific-options]", :blue]
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# list available commands or display help for a specific command
|
18
|
+
#
|
19
|
+
def self.commands
|
20
|
+
|
21
|
+
print <<-USAGE
|
22
|
+
|
23
|
+
#{how_to}
|
24
|
+
|
25
|
+
Key
|
26
|
+
keys # List API key and Secret key
|
27
|
+
addKeys # Add API key and Secret key
|
28
|
+
clearKeys # Clear API key and Secret key
|
29
|
+
|
30
|
+
Applications
|
31
|
+
setupInfra # Setup your deployment and runtime environment i.e. Instance(Memory, CPU) and Technology Stack
|
32
|
+
deploy # Deploy the application over your runtime environment
|
33
|
+
scale # Scale application by number of instance(s)
|
34
|
+
descale # Descale application by number of instance(s)
|
35
|
+
start # Start the application
|
36
|
+
stop # Stop the application
|
37
|
+
restart # Restart the application
|
38
|
+
deleteInfra # Delete the Infrastructure environment
|
39
|
+
apps # List all the deployed applications with their meta details
|
40
|
+
appInfo # Show meta information of the application
|
41
|
+
appState # Show current state of the application
|
42
|
+
logs # Returns the log file URLs for the application
|
43
|
+
|
44
|
+
Services
|
45
|
+
createService # Creates a new service e.g. MySQL, MongoDB, CouchDB, PostgreSQL etc.
|
46
|
+
deleteService # Delete provisioned service
|
47
|
+
services # List all the provisioned services with their meta details
|
48
|
+
serviceInfo # Show meta information of the provisioned service
|
49
|
+
resetServicePassword # Reset password of provisioned service
|
50
|
+
bindIP # Bind IP to provisioned service
|
51
|
+
unbindIP # Unbind IP from provisioned service
|
52
|
+
bindInfo # Show IP bind information related to provisioned service
|
53
|
+
|
54
|
+
Misc
|
55
|
+
supportedServices # List supported services by App42
|
56
|
+
iaasProviders # List supported IaaS providers by App42
|
57
|
+
runtimes # List supported runtimes by App42
|
58
|
+
|
59
|
+
Help
|
60
|
+
version # Show Ruby client gem version
|
61
|
+
help # List available commands and their description
|
62
|
+
COMMAND --help # Display detailed help of a specific command
|
63
|
+
USAGE
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.keys_help
|
67
|
+
print <<-USAGE
|
68
|
+
#{how_to}
|
69
|
+
app42 api_key:add [KEY] # add a api key for the current user
|
70
|
+
app42 secret_key:add [KEY] # add a Secret Key for the current user
|
71
|
+
app42 keys:clear # remove all authentication keys from the current user
|
72
|
+
|
73
|
+
USAGE
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
# call help methods
|
78
|
+
def Help.usage command
|
79
|
+
if self.respond_to?(command)
|
80
|
+
send command
|
81
|
+
elsif self.respond_to?(command.split(':').last)
|
82
|
+
send command.split(':').last
|
83
|
+
elsif self.respond_to?(command.split('-').join('_'))
|
84
|
+
send command.split('-').join('_')
|
85
|
+
else
|
86
|
+
Paint["Sorry..!!, Help is not available.\n", :red]
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
class << self
|
92
|
+
|
93
|
+
def keys
|
94
|
+
print <<-DESC
|
95
|
+
Usage:
|
96
|
+
app42 keys
|
97
|
+
|
98
|
+
List API key and Secret key
|
99
|
+
|
100
|
+
Example:
|
101
|
+
=== API/Secret Key ===
|
102
|
+
API Key = <apiKey>
|
103
|
+
Secret Key = <secretKey>
|
104
|
+
DESC
|
105
|
+
end
|
106
|
+
|
107
|
+
def addKeys
|
108
|
+
print <<-DESC
|
109
|
+
Usage:
|
110
|
+
app42 addKeys
|
111
|
+
|
112
|
+
Add API key and Secret key
|
113
|
+
|
114
|
+
Options:
|
115
|
+
[--apiKey=API_KEY] # API Key to add.
|
116
|
+
[--secretKey=SECRET_KEY] # Secret Key to add.
|
117
|
+
|
118
|
+
Example:
|
119
|
+
$app42 addKeys
|
120
|
+
== Enter your App42PaaS keys ==
|
121
|
+
Enter API Key:: <apiKey>
|
122
|
+
Enter Secret Key:: <secretKey>
|
123
|
+
Adding keys...done
|
124
|
+
DESC
|
125
|
+
end
|
126
|
+
|
127
|
+
def clearKeys
|
128
|
+
print <<-DESC
|
129
|
+
Usage:
|
130
|
+
app42 clearKeys
|
131
|
+
|
132
|
+
Clear API key and Secret key from dev system
|
133
|
+
|
134
|
+
Example:
|
135
|
+
app42 clearKeys
|
136
|
+
== Local credentials cleared ==
|
137
|
+
DESC
|
138
|
+
end
|
139
|
+
|
140
|
+
def setupInfra
|
141
|
+
print <<-DESC
|
142
|
+
Usage:
|
143
|
+
app42 setupInfra
|
144
|
+
|
145
|
+
Setup the complete runtime environment
|
146
|
+
|
147
|
+
Example:
|
148
|
+
$app42 setupInfra
|
149
|
+
1: Shared
|
150
|
+
Select Virtual Machine Type: 1
|
151
|
+
1: Amazon
|
152
|
+
Select IaaS Provider: 1
|
153
|
+
Application Name: demo
|
154
|
+
Checking App Name Availability... OK
|
155
|
+
1: Ruby
|
156
|
+
2: Java
|
157
|
+
3: Php
|
158
|
+
4: Node
|
159
|
+
Select Runtime: 2
|
160
|
+
1: Grails 1.3.7
|
161
|
+
Select Framework: 1
|
162
|
+
1: Tomcat 6.0.36
|
163
|
+
Select Web Server: 1
|
164
|
+
1: 512MB
|
165
|
+
2: 1024MB
|
166
|
+
3: 2048MB
|
167
|
+
Memory Limit: 1
|
168
|
+
Creating Infrastructure... OK
|
169
|
+
Latest Status....|
|
170
|
+
Setup Infrastructure successfully done.
|
171
|
+
|
172
|
+
Default Application Deployed. URL is : demo.aws.app42paas.com
|
173
|
+
DESC
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
def apps
|
178
|
+
print <<-DESC
|
179
|
+
Usage:
|
180
|
+
app42 apps
|
181
|
+
|
182
|
+
Deploy the application over runtime environment
|
183
|
+
|
184
|
+
Example:
|
185
|
+
$app42 apps
|
186
|
+
|
187
|
+
+------------------------+------------+-----------------+---------------+---------+------+
|
188
|
+
| === My Apps === |
|
189
|
+
+------------------------+------------+-----------------+---------------+---------+------+
|
190
|
+
| App Url | App Status | Container Count | Iaas Provider | Vm Type | Name |
|
191
|
+
+------------------------+------------+-----------------+---------------+---------+------+
|
192
|
+
| demo.aws.app42paas.com | RUNNING | 1 | Amazon | Shared | demo |
|
193
|
+
+------------------------+------------+-----------------+---------------+---------+------+
|
194
|
+
DESC
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
def deploy
|
199
|
+
print <<-DESC
|
200
|
+
Usage:
|
201
|
+
app42 deploy
|
202
|
+
|
203
|
+
Deploy application
|
204
|
+
|
205
|
+
Options:
|
206
|
+
[--app APP] # Name of app, you want to update
|
207
|
+
|
208
|
+
Example:
|
209
|
+
$app42 deploy
|
210
|
+
Enter App Name: demo
|
211
|
+
Would you like to deploy from the current directory? [Yn]: n
|
212
|
+
Binary Deployment Path: /home/ubuntu/workspace/Deploycode/ruby
|
213
|
+
Deploying Application... OK
|
214
|
+
Latest Status....|
|
215
|
+
1 out of 1 Uploaded
|
216
|
+
Application deployed successfully.
|
217
|
+
DESC
|
218
|
+
|
219
|
+
end
|
220
|
+
|
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
|
+
def start
|
245
|
+
print <<-DESC
|
246
|
+
Usage:
|
247
|
+
app42 start
|
248
|
+
|
249
|
+
Start the application
|
250
|
+
|
251
|
+
Options:
|
252
|
+
[--app APP] # Name of app, you want to start
|
253
|
+
|
254
|
+
Example:
|
255
|
+
$app42 start --app demo
|
256
|
+
Starting app demo ...Done
|
257
|
+
DESC
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
def stop
|
262
|
+
print <<-DESC
|
263
|
+
Usage:
|
264
|
+
app42 stop
|
265
|
+
|
266
|
+
Stop the application
|
267
|
+
|
268
|
+
Options:
|
269
|
+
[--app APP] # Name of app, you want to stop
|
270
|
+
|
271
|
+
Example:
|
272
|
+
$app42 stop --app demo
|
273
|
+
Stopping app demo ...Done
|
274
|
+
DESC
|
275
|
+
end
|
276
|
+
|
277
|
+
def restart
|
278
|
+
print <<-DESC
|
279
|
+
Usage:
|
280
|
+
app42 restart
|
281
|
+
|
282
|
+
Restart the application
|
283
|
+
|
284
|
+
Options:
|
285
|
+
[--app APP] # Name of app, you want to restart
|
286
|
+
|
287
|
+
Example:
|
288
|
+
$app42 start --app demo
|
289
|
+
Restarting app demo ...Done
|
290
|
+
DESC
|
291
|
+
end
|
292
|
+
|
293
|
+
def deleteInfra
|
294
|
+
print <<-DESC
|
295
|
+
Usage:
|
296
|
+
app42 deleteInfra
|
297
|
+
|
298
|
+
Delete the Infrastructure environment
|
299
|
+
|
300
|
+
Options:
|
301
|
+
[--app APP] # Name of app, you want to delete
|
302
|
+
|
303
|
+
Example:
|
304
|
+
$app42 deleteInfra --app demo
|
305
|
+
Deleting app demo ...Done
|
306
|
+
DESC
|
307
|
+
end
|
308
|
+
|
309
|
+
def descale
|
310
|
+
print <<-DESC
|
311
|
+
Usage:
|
312
|
+
app42 descale
|
313
|
+
|
314
|
+
Descale application by number of instance(s)
|
315
|
+
|
316
|
+
Options:
|
317
|
+
[--app APP] # Name of app, you want to descale
|
318
|
+
|
319
|
+
Example:
|
320
|
+
$app42 descale --app demo
|
321
|
+
Descale by instance(s): 1
|
322
|
+
Descaling Application demo by instance 1... OK
|
323
|
+
Please wait... It may take few minutes to complete.
|
324
|
+
|
325
|
+
Latest Status....|
|
326
|
+
Descale completed successfully.
|
327
|
+
DESC
|
328
|
+
end
|
329
|
+
|
330
|
+
def scale
|
331
|
+
print <<-DESC
|
332
|
+
Usage:
|
333
|
+
app42 scale
|
334
|
+
|
335
|
+
Scale application by number of instance(s)
|
336
|
+
|
337
|
+
Options:
|
338
|
+
[--app APP] # Name of app, you want to scale
|
339
|
+
|
340
|
+
Example:
|
341
|
+
$app42 scale --app demo
|
342
|
+
Scale by instance(s): 1
|
343
|
+
Scaling Application demo by instance 1... OK
|
344
|
+
Please wait... It may take few minutes to complete.
|
345
|
+
|
346
|
+
Latest Status....|
|
347
|
+
Scale completed successfully.
|
348
|
+
|
349
|
+
|
350
|
+
DESC
|
351
|
+
end
|
352
|
+
|
353
|
+
def appInfo
|
354
|
+
print <<-DESC
|
355
|
+
Usage:
|
356
|
+
app42 appInfo
|
357
|
+
|
358
|
+
Show the meta information of the application
|
359
|
+
|
360
|
+
Options:
|
361
|
+
[--app APP] # Name of app, you want to info
|
362
|
+
|
363
|
+
Example:
|
364
|
+
$app42 appInfo --app demo
|
365
|
+
Application Name: demo
|
366
|
+
+------------------------+------------+---------------+------+----------+----------------+--------+
|
367
|
+
| === demo Info === |
|
368
|
+
+------------------------+------------+---------------+------+----------+----------------+--------+
|
369
|
+
| App Url | App Status | Iaas Provider | Name | Runtime | Instance Count | Memory |
|
370
|
+
+------------------------+------------+---------------+------+----------+----------------+--------+
|
371
|
+
| demo.aws.app42paas.com | RUNNING | Amazon | demo | Ruby 2.0 | 1 | 512 MB |
|
372
|
+
+------------------------+------------+---------------+------+----------+----------------+--------+
|
373
|
+
DESC
|
374
|
+
end
|
375
|
+
|
376
|
+
def appState
|
377
|
+
print <<-DESC
|
378
|
+
Usage:
|
379
|
+
app42 appState
|
380
|
+
|
381
|
+
Show current state of the application
|
382
|
+
|
383
|
+
Options:
|
384
|
+
[--app APP] # Name of app
|
385
|
+
|
386
|
+
Example:
|
387
|
+
$app42 appState --app demo
|
388
|
+
+--------------------+
|
389
|
+
| === demo State === |
|
390
|
+
+--------------------+
|
391
|
+
| RUNNING |
|
392
|
+
+--------------------+
|
393
|
+
DESC
|
394
|
+
end
|
395
|
+
|
396
|
+
def logs
|
397
|
+
print <<-DESC
|
398
|
+
Usage:
|
399
|
+
app42 logs
|
400
|
+
|
401
|
+
Returns the log URLs for the application
|
402
|
+
|
403
|
+
Example:
|
404
|
+
$app42 logs
|
405
|
+
Enter App Name: demo
|
406
|
+
Please visit below URL(s) to access app logs
|
407
|
+
|
408
|
+
+----------------------------------------------------------------------------+
|
409
|
+
| Log URL(s) |
|
410
|
+
+----------------------------------------------------------------------------+
|
411
|
+
| demo.aws.app42paas.com/getInstanceLog?id=fi1nyi7bh68nvz0riyqrfup8lkm57qiu |
|
412
|
+
| demo.aws.app42paas.com/getInstanceLog?id=v1bta5rg2tsycat31r3pzc28sa7d1bjy |
|
413
|
+
+----------------------------------------------------------------------------+
|
414
|
+
DESC
|
415
|
+
end
|
416
|
+
|
417
|
+
|
418
|
+
def createService
|
419
|
+
print <<-DESC
|
420
|
+
Usage:
|
421
|
+
app42 createService
|
422
|
+
|
423
|
+
Creates a new service
|
424
|
+
|
425
|
+
Example:
|
426
|
+
$app42 createService
|
427
|
+
1: Mysql
|
428
|
+
2: Mongodb
|
429
|
+
Select Service: 1
|
430
|
+
Enter Service Name: mysql-demo
|
431
|
+
Enter Database Name: demo_dev
|
432
|
+
1: Shared
|
433
|
+
Select Virtual Machine Type: 1
|
434
|
+
1: Amazon
|
435
|
+
Select IaaS Provider: 1
|
436
|
+
1: 512MB
|
437
|
+
2: 1024MB
|
438
|
+
3: 2048MB
|
439
|
+
Memory Limit: 1
|
440
|
+
Creating Service... OK
|
441
|
+
Latest Status....|
|
442
|
+
Service successfully created.
|
443
|
+
|
444
|
+
+---------------+---------------+---------+---------------+------------------+---------+--------------+----------------------------------+--------------+
|
445
|
+
| === mysql-demo Details === |
|
446
|
+
+---------------+---------------+---------+---------------+------------------+---------+--------------+----------------------------------+--------------+
|
447
|
+
| Database Name | Iaas Provider | Vm Type | Vm Ip | User Name | Vm Port | Service Type | Password | Service Name |
|
448
|
+
+---------------+---------------+---------+---------------+------------------+---------+--------------+----------------------------------+--------------+
|
449
|
+
| demo_dev | Amazon | Shared | xx.yyy.zzz.aa | xxxxxxxxxxxxxxxx | 45074 | mysql55 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | mysql-demo |
|
450
|
+
+---------------+---------------+---------+---------------+------------------+---------+--------------+----------------------------------+--------------+
|
451
|
+
DESC
|
452
|
+
end
|
453
|
+
|
454
|
+
def deleteService
|
455
|
+
print <<-DESC
|
456
|
+
Usage:
|
457
|
+
app42 deleteService
|
458
|
+
|
459
|
+
Delete the provisioned service
|
460
|
+
|
461
|
+
Options:
|
462
|
+
[--service SERVICE] # Name of service
|
463
|
+
|
464
|
+
Example:
|
465
|
+
$app42 deleteService
|
466
|
+
1: mysql-demo
|
467
|
+
2: mysql-test
|
468
|
+
Select Service: 1
|
469
|
+
Latest Status....-
|
470
|
+
1 out of 1 deleted
|
471
|
+
Service mysql-demo successfully deleted.
|
472
|
+
|
473
|
+
DESC
|
474
|
+
end
|
475
|
+
|
476
|
+
def services
|
477
|
+
print <<-DESC
|
478
|
+
Usage:
|
479
|
+
app42 services
|
480
|
+
|
481
|
+
List the all provisioned services with their meta details
|
482
|
+
|
483
|
+
Example:
|
484
|
+
$app42 services
|
485
|
+
+---------------+---------+----------+--------------+
|
486
|
+
| === Service List === |
|
487
|
+
+---------------+---------+----------+--------------+
|
488
|
+
| Iaas Provider | Vm Type | Name | Service Type |
|
489
|
+
+---------------+---------+----------+--------------+
|
490
|
+
| Amazon | Shared | demo_dev | mysql55 |
|
491
|
+
+---------------+---------+----------+--------------+
|
492
|
+
DESC
|
493
|
+
end
|
494
|
+
|
495
|
+
def serviceInfo
|
496
|
+
print <<-DESC
|
497
|
+
Usage:
|
498
|
+
app42 serviceInfo
|
499
|
+
|
500
|
+
Show the meta information of the provisioned service
|
501
|
+
|
502
|
+
Options:
|
503
|
+
[--service SERVICE] # Name of service
|
504
|
+
|
505
|
+
Example:
|
506
|
+
$app42 serviceInfo
|
507
|
+
1: mysqldemo
|
508
|
+
Select Service: 1
|
509
|
+
|
510
|
+
+---------------+---------------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
511
|
+
| === mysqldemo Details === |
|
512
|
+
+---------------+---------------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
513
|
+
| Database Name | Iaas Provider | Vm Ip | State | User Name | Vm Port | Service Type | Password | Memory | Service Name |
|
514
|
+
+---------------+---------------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
515
|
+
| demodb | Amazon | 10.0.0.52 | RUNNING | 5hk1tmdmkr16b94f | 52108 | MySQL 5.5.1 | 2otwxwpu8mskmmvwt7bx4r2fzw4ytls0 | 512 MB | mysqldemo |
|
516
|
+
+---------------+---------------+-----------+---------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
517
|
+
DESC
|
518
|
+
end
|
519
|
+
|
520
|
+
def supportedServices
|
521
|
+
print <<-DESC
|
522
|
+
Usage:
|
523
|
+
app42 supportedServices
|
524
|
+
|
525
|
+
List the supported services by App42
|
526
|
+
|
527
|
+
Example:
|
528
|
+
$app42 supportedServices
|
529
|
+
+--------------+-----------------+
|
530
|
+
| === App42 PaaS Services === |
|
531
|
+
+--------------+-----------------+
|
532
|
+
| Name | Service Version |
|
533
|
+
+--------------+-----------------+
|
534
|
+
| Mysql | 5.5.1 |
|
535
|
+
| Mongodb | 2.4 |
|
536
|
+
+--------------+-----------------+
|
537
|
+
DESC
|
538
|
+
end
|
539
|
+
|
540
|
+
def runtimes
|
541
|
+
print <<-DESC
|
542
|
+
Usage:
|
543
|
+
app42 runtimes
|
544
|
+
|
545
|
+
List the supported runtimes
|
546
|
+
|
547
|
+
Example:
|
548
|
+
$app42 runtimes
|
549
|
+
+--------------+--------------+
|
550
|
+
| === Available Runtimes === |
|
551
|
+
+--------------+--------------+
|
552
|
+
| Name | Version |
|
553
|
+
+--------------+--------------+
|
554
|
+
| Ruby | 2.0 |
|
555
|
+
| Java | 6.0 |
|
556
|
+
| Java | 7.0 |
|
557
|
+
| Php | 5.5 |
|
558
|
+
+--------------+--------------+
|
559
|
+
DESC
|
560
|
+
end
|
561
|
+
|
562
|
+
def iaasProviders
|
563
|
+
print <<-DESC
|
564
|
+
Usage:
|
565
|
+
app42 iaasProviders
|
566
|
+
|
567
|
+
List the supported IaaS providers by App42
|
568
|
+
|
569
|
+
Example:
|
570
|
+
$app42 iaasProviders
|
571
|
+
+-----------------+-----------------+
|
572
|
+
| === Available IaaS Providers === |
|
573
|
+
+-----------------+-----------------+
|
574
|
+
| Name | Zone |
|
575
|
+
+-----------------+-----------------+
|
576
|
+
| Amazon | US West-2a |
|
577
|
+
+-----------------+-----------------+
|
578
|
+
|
579
|
+
DESC
|
580
|
+
end
|
581
|
+
|
582
|
+
|
583
|
+
def app42_update
|
584
|
+
print <<-DESC
|
585
|
+
Usage:
|
586
|
+
app42 app42-update
|
587
|
+
|
588
|
+
Update App42PaaS client(app42)
|
589
|
+
-> Download app42 client, In a terminal, go to the folder where you have downloaded the client and run client update command.
|
590
|
+
|
591
|
+
Example:
|
592
|
+
$app42 app42-update
|
593
|
+
Uninstalling current app42 client
|
594
|
+
Remove executables:
|
595
|
+
app42
|
596
|
+
|
597
|
+
in addition to the gem? [Yn] y
|
598
|
+
Removing app42
|
599
|
+
Successfully uninstalled app42-0.5.0
|
600
|
+
Installing latest app42 client
|
601
|
+
Successfully installed app42-0.5.0
|
602
|
+
1 gem installed
|
603
|
+
Installing ri documentation for app42-0.5.0...
|
604
|
+
Installing RDoc documentation for app42-0.5.0...
|
605
|
+
DESC
|
606
|
+
end
|
607
|
+
|
608
|
+
def resetServicePassword
|
609
|
+
print <<-DESC
|
610
|
+
Usage:
|
611
|
+
resetServicePassword
|
612
|
+
|
613
|
+
Reset the password of provisioned service
|
614
|
+
|
615
|
+
Example:
|
616
|
+
$resetServicePassword
|
617
|
+
Enter Service Name: mysql_demo
|
618
|
+
Enter Old Password: 1pc8a09ise98nutrqzouj5ya98vtd08y
|
619
|
+
Resetting Password... OK
|
620
|
+
Please wait it may takes few minutes.
|
621
|
+
|
622
|
+
Latest Status....
|
623
|
+
Reset Password successful.Your new password is: quzg6bogsu0ak3rwyr0egs8a1ttgc9tt
|
624
|
+
DESC
|
625
|
+
end
|
626
|
+
|
627
|
+
def bindIP
|
628
|
+
print <<-DESC
|
629
|
+
Usage:
|
630
|
+
app42 bindIP
|
631
|
+
|
632
|
+
Bind IP to a service
|
633
|
+
|
634
|
+
Example:
|
635
|
+
$app42 bindIP
|
636
|
+
Enter Service Name: mysql_demo
|
637
|
+
Please Provide Source IP
|
638
|
+
(0.0.0.0, for public access): 0.0.0.0/0
|
639
|
+
Please provide the time duration you want to access service(0 for unlimited access[in hours]): 2
|
640
|
+
Binding IP to service... OK
|
641
|
+
Please wait it may takes few minutes.
|
642
|
+
|
643
|
+
Latest Status....|
|
644
|
+
Bind service successful.
|
645
|
+
|
646
|
+
+------------------+--------------+---------------+---------+----------------+-----------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
647
|
+
| === mysql_demo Details === |
|
648
|
+
+------------------+--------------+---------------+---------+----------------+-----------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
649
|
+
| Database Name | Os | Iaas Provider | Vm Type | Vm Ip | Source Ip | User Name | Vm Port | Service Type | Password | Memory | Service Name |
|
650
|
+
+------------------+--------------+---------------+---------+----------------+-----------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
651
|
+
| demo_development | Ubuntu 12.10 | Amazon | Shared | 54.218.127.245 | 0.0.0.0/0 | 4gxu2btjrh7p1ku5 | 20830 | MySQL 5.5.1 | c8f6ynn0p065wzh7i2802pi5nfpfyr58 | 512 MB | mysql_demo |
|
652
|
+
+------------------+--------------+---------------+---------+----------------+-----------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
653
|
+
DESC
|
654
|
+
end
|
655
|
+
|
656
|
+
def unbindIP
|
657
|
+
print <<-DESC
|
658
|
+
Usage:
|
659
|
+
app42 unbindIP
|
660
|
+
|
661
|
+
Unbind service from the application
|
662
|
+
|
663
|
+
Example:
|
664
|
+
$app42 unbindIP
|
665
|
+
Enter Service Name: mysql_demo
|
666
|
+
Please Provide Source IP
|
667
|
+
(0.0.0.0, for public access): 0.0.0.0/0
|
668
|
+
Unbinding IP to service... OK
|
669
|
+
Please wait it may takes few minutes.
|
670
|
+
|
671
|
+
Latest Status....-
|
672
|
+
Unbind service successful.
|
673
|
+
DESC
|
674
|
+
end
|
675
|
+
|
676
|
+
def bindInfo
|
677
|
+
print <<-DESC
|
678
|
+
Usage:
|
679
|
+
app42 bindInfo
|
680
|
+
|
681
|
+
Show IP bind information
|
682
|
+
|
683
|
+
Example:
|
684
|
+
$app42 bindInfo
|
685
|
+
1: mysql_demo
|
686
|
+
Select Service: 1
|
687
|
+
+------------------+--------------+---------------+---------+----------------+-----------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
688
|
+
| === mysql_demo Details === |
|
689
|
+
+------------------+--------------+---------------+---------+----------------+-----------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
690
|
+
| Database Name | Os | Iaas Provider | Vm Type | Vm Ip | Source Ip | User Name | Vm Port | Service Type | Password | Memory | Service Name |
|
691
|
+
+------------------+--------------+---------------+---------+----------------+-----------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
692
|
+
| demo_development | Ubuntu 12.10 | Amazon | Shared | 54.218.127.245 | 0.0.0.0/0 | 4gxu2btjrh7p1ku5 | 20830 | MySQL 5.5.1 | c8f6ynn0p065wzh7i2802pi5nfpfyr58 | 512 MB | mysql_demo |
|
693
|
+
+------------------+--------------+---------------+---------+----------------+-----------+------------------+---------+--------------+----------------------------------+--------+--------------+
|
694
|
+
|
695
|
+
|
696
|
+
DESC
|
697
|
+
end
|
698
|
+
|
699
|
+
def version
|
700
|
+
print <<-DESC
|
701
|
+
Usage:
|
702
|
+
app42 version
|
703
|
+
|
704
|
+
Show Ruby client gem version
|
705
|
+
|
706
|
+
Example:
|
707
|
+
$app42 version
|
708
|
+
App42 current version: 0.5.3
|
709
|
+
DESC
|
710
|
+
|
711
|
+
end
|
712
|
+
|
713
|
+
end
|
714
|
+
|
715
|
+
end
|
716
|
+
end
|
717
|
+
end
|