nex_client 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nex_client/cli.rb +15 -1
- data/lib/nex_client/commands/addons.rb +8 -3
- data/lib/nex_client/commands/apps.rb +25 -2
- data/lib/nex_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d9e6166df47119dad5f9ed37162f90dc09fed76
|
4
|
+
data.tar.gz: ba61368242bbc4c1226dfe31c7e0c1b9252134ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3f09ff9d2cff8c5bda7c140f2f2b5bca6eab183948dc1835ee83c211e4742717ae0b314e236884dd68ca501489816433aad2044bc24ab980d357c0d1e3c0079
|
7
|
+
data.tar.gz: 438a36987ec311f99257200e643d389129397565fe0e67bdb80e3b179a8e9bb14fa37641831721c0c675b4fbee942bc4495bd55cf80a51881f5bf1e6fc5ad50e
|
data/lib/nex_client/cli.rb
CHANGED
@@ -36,6 +36,7 @@ module NexClient
|
|
36
36
|
c.description = 'Create addons for your apps. Available addons: mysql | redis | mongo26'
|
37
37
|
c.example 'create mysql addon for myapp', 'nex-cli addons:create mysql myapp'
|
38
38
|
c.example 'create redis addon for myapp', 'nex-cli addons:create redis myapp'
|
39
|
+
c.option '--size SIZE', Integer, 'specify container size (default: 2, min: 1, max: 20). Container will have N shares of CPU and N*128M of memory.'
|
39
40
|
c.action do |args, options|
|
40
41
|
NexClient::Commands::Addons.create(args,options)
|
41
42
|
end
|
@@ -119,10 +120,12 @@ module NexClient
|
|
119
120
|
c.syntax = 'nex-cli apps:create DOCKER_IMAGE[:tag] [options]'
|
120
121
|
c.summary = 'Create apps'
|
121
122
|
c.description = 'Create new docker applications'
|
122
|
-
c.example 'create new
|
123
|
+
c.example 'create new web-ruby application', 'nex-cli apps:create maestrano/web-ruby'
|
124
|
+
c.example 'create new web-ruby application with increased container size', 'nex-cli apps:create maestrano/web-ruby --size 8'
|
123
125
|
c.option '--env MYVAR=value,MYVAR2=value,...', Array, 'comma separated list of env variables'
|
124
126
|
c.option '--env-file FILE', String, 'newline separated list of env variables (MYVAR=1) or YAML file'
|
125
127
|
c.option '--no-ssl', 'disable SSL support (enabled by default)'
|
128
|
+
c.option '--size SIZE', Integer, 'specify container size (default: 2, min: 1, max: 20). Container will have N shares of CPU and N*128M of memory.'
|
126
129
|
c.option '--storage', 'enable persistent storage (/!\ only one node allowed)'
|
127
130
|
c.option '--owner ORGANIZATION_HANDLE', 'specify an organisation as owner (organization admin only)'
|
128
131
|
c.action do |args, options|
|
@@ -229,6 +232,17 @@ module NexClient
|
|
229
232
|
end
|
230
233
|
end
|
231
234
|
|
235
|
+
command :'apps:update' do |c|
|
236
|
+
c.syntax = 'nex-cli apps:update APP_NAME [options]'
|
237
|
+
c.summary = 'Update apps settings'
|
238
|
+
c.description = 'Update application settings'
|
239
|
+
c.example 'change container size to 4', 'nex-cli apps:update myapp --size 4'
|
240
|
+
c.option '--size SIZE', Integer, 'change container size (default: 2, min: 1, max: 20). Container will have N shares of CPU and N*128M of memory.'
|
241
|
+
c.action do |args, options|
|
242
|
+
NexClient::Commands::Apps.update(args,options)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
232
246
|
command :'apps:vars' do |c|
|
233
247
|
c.syntax = 'nex-cli apps:vars APP_NAME [options]'
|
234
248
|
c.summary = 'Manage app environment variables'
|
@@ -6,7 +6,7 @@ module NexClient
|
|
6
6
|
|
7
7
|
SCALING_DIRECTIONS = [:up,:down]
|
8
8
|
ADDONS_TITLE = "Addons".colorize(:red)
|
9
|
-
ADDONS_HEADERS = ['
|
9
|
+
ADDONS_HEADERS = ['name','status','service','size','nodes','app'].map(&:upcase)
|
10
10
|
|
11
11
|
def self.list(args,opts)
|
12
12
|
filters = {}
|
@@ -71,7 +71,12 @@ module NexClient
|
|
71
71
|
return false
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
# Attributes
|
75
|
+
attrs = {}
|
76
|
+
attrs[:service] = svc_name
|
77
|
+
attrs[:container_size] = opts.size if opts.size.present?
|
78
|
+
|
79
|
+
addon = NexClient::Addon.new(attrs)
|
75
80
|
addon.relationships.attributes = { app: { data: { type: 'apps', id: app.id } } }
|
76
81
|
addon.save
|
77
82
|
|
@@ -149,10 +154,10 @@ module NexClient
|
|
149
154
|
app = self.format_app(record)
|
150
155
|
node_count = self.format_node_count(record)
|
151
156
|
[
|
152
|
-
record.id,
|
153
157
|
record.name,
|
154
158
|
record.status,
|
155
159
|
record.service,
|
160
|
+
record.container_size,
|
156
161
|
node_count,
|
157
162
|
app
|
158
163
|
]
|
@@ -8,7 +8,7 @@ module NexClient
|
|
8
8
|
|
9
9
|
SCALING_DIRECTIONS = [:up,:down]
|
10
10
|
APPS_TITLE = "App Details".colorize(:green)
|
11
|
-
APPS_HEADERS = ['
|
11
|
+
APPS_HEADERS = ['name','status','image','ssl','storage','preferred region','size','nodes','owner'].map(&:upcase)
|
12
12
|
|
13
13
|
VARS_TITLE = "Environment Variables".colorize(:blue)
|
14
14
|
VARS_HEADERS = ['key','value'].map(&:upcase)
|
@@ -98,6 +98,7 @@ module NexClient
|
|
98
98
|
# Meta attributes
|
99
99
|
attrs[:ssl_enabled] = !opts.no_ssl if opts.no_ssl.present?
|
100
100
|
attrs[:persistent_storage] = opts.storage if opts.storage.present?
|
101
|
+
attrs[:container_size] = opts.size if opts.size.present?
|
101
102
|
|
102
103
|
# Env variables via command line
|
103
104
|
if opts.env.present?
|
@@ -142,6 +143,27 @@ module NexClient
|
|
142
143
|
self.display_apps(NexClient::App.includes(:owner).find(e.id).first)
|
143
144
|
end
|
144
145
|
|
146
|
+
def self.update(args,opts)
|
147
|
+
name = args.first
|
148
|
+
e = NexClient::App.find(name: name).first
|
149
|
+
|
150
|
+
# Display error
|
151
|
+
unless e
|
152
|
+
error("Error! Could not find app: #{name}")
|
153
|
+
return false
|
154
|
+
end
|
155
|
+
|
156
|
+
# Attributes
|
157
|
+
attrs = {}
|
158
|
+
attrs[:container_size] = opts.size if opts.size.present?
|
159
|
+
|
160
|
+
# Update
|
161
|
+
e.update_attributes(attrs)
|
162
|
+
|
163
|
+
# Display app
|
164
|
+
self.display_apps(NexClient::App.includes(:owner).find(e.id).first)
|
165
|
+
end
|
166
|
+
|
145
167
|
def self.destroy(args,opts)
|
146
168
|
name = args.first
|
147
169
|
e = NexClient::App.find(name: name).first
|
@@ -281,6 +303,7 @@ module NexClient
|
|
281
303
|
# Update and reload the resource
|
282
304
|
e.update_attributes(vars: vars)
|
283
305
|
e = NexClient::App.find(e.id).first
|
306
|
+
success("Successfully updated env vars. You may want to restart your app...")
|
284
307
|
end
|
285
308
|
|
286
309
|
# Display all vars
|
@@ -352,13 +375,13 @@ module NexClient
|
|
352
375
|
owner = self.format_owner(record)
|
353
376
|
node_count = self.format_node_count(record)
|
354
377
|
[
|
355
|
-
record.id,
|
356
378
|
record.name,
|
357
379
|
record.status,
|
358
380
|
record.image,
|
359
381
|
record.ssl_enabled,
|
360
382
|
record.persistent_storage,
|
361
383
|
record.preferred_region,
|
384
|
+
record.container_size,
|
362
385
|
node_count,
|
363
386
|
owner
|
364
387
|
]
|
data/lib/nex_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nex_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Lachaume
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|