gv-valley 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/valley +68 -53
- data/gv-valley.gemspec +1 -1
- data/lib/gv/valley/app.rb +2 -1
- data/lib/gv/valley/balancer.rb +6 -3
- data/lib/gv/valley/file_server.rb +1 -1
- data/lib/gv/valley/version.rb +1 -1
- data/test/gv/test_app.rb +1 -1
- data/test/gv/test_etcd.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f0c6b2b1055b28c5a27bf64bb68e146b5dfd3b9
|
4
|
+
data.tar.gz: 6cfac4214935634628a53a1578de31acab5376a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcf8de1fe095ad062872a637a71f5a2f30b27c82c7d2143296a8b637746789f2caaf2a26427525250fcc3f45be015232ff373e959c12dbdae1e472f396402a0b
|
7
|
+
data.tar.gz: ef25b695f731ce1e841da5edf251ff0335101c557c4585b4815c6ebf31f2371cfe63a5f55dfc592e047bb3ed33a4cbb1a5c94a7f740905faaf8b2cff4c551d11
|
data/bin/valley
CHANGED
@@ -26,36 +26,39 @@ end
|
|
26
26
|
# Apps API
|
27
27
|
|
28
28
|
command :'apps:deploy' do |c|
|
29
|
-
c.syntax = 'valley apps:deploy
|
29
|
+
c.syntax = 'valley apps:deploy'
|
30
30
|
c.description = 'deploys app'
|
31
|
+
c.option '--app STRING', String, 'App name'
|
31
32
|
c.action do |args, options|
|
32
33
|
|
33
34
|
DRb.start_service
|
34
35
|
service = GV::Valley::Deployer.random_service
|
35
|
-
service.deploy
|
36
|
+
service.deploy options.app, &Sticks::Pipe::Blocks.stream
|
36
37
|
DRb.stop_service
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
41
|
command :'apps:config' do |c|
|
41
|
-
c.syntax = 'valley apps:config
|
42
|
+
c.syntax = 'valley apps:config'
|
42
43
|
c.description = 'shows app config'
|
44
|
+
c.option '--app STRING', String, 'App name'
|
43
45
|
c.action do |args, options|
|
44
46
|
|
45
47
|
DRb.start_service
|
46
|
-
puts GV::Valley::App.find!(
|
48
|
+
puts GV::Valley::App.find!(options.app)['config']
|
47
49
|
DRb.stop_service
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
51
53
|
command :'apps:config add' do |c|
|
52
|
-
c.syntax = 'valley apps:config add
|
54
|
+
c.syntax = 'valley apps:config add KEY=VALUE [KEY=VALUE]'
|
53
55
|
c.description = 'adds item to app config'
|
56
|
+
c.option '--app STRING', String, 'App name'
|
54
57
|
c.action do |args, options|
|
55
58
|
|
56
59
|
DRb.start_service
|
57
60
|
|
58
|
-
name =
|
61
|
+
name = options.app
|
59
62
|
config = Hash[args.map{|kv| kv.split("=")}]
|
60
63
|
app = GV::Valley::App.find!(name)
|
61
64
|
app["config"].update(config)
|
@@ -68,13 +71,14 @@ command :'apps:config add' do |c|
|
|
68
71
|
end
|
69
72
|
|
70
73
|
command :'apps:config remove' do |c|
|
71
|
-
c.syntax = 'valley apps:config remove
|
74
|
+
c.syntax = 'valley apps:config remove KEY [KEY]'
|
72
75
|
c.description = 'removes item from app config'
|
76
|
+
c.option '--app STRING', String, 'App name'
|
73
77
|
c.action do |args, options|
|
74
78
|
|
75
79
|
DRb.start_service
|
76
80
|
|
77
|
-
name =
|
81
|
+
name = options.app
|
78
82
|
app = GV::Valley::App.find!(name)
|
79
83
|
args.each do |key|
|
80
84
|
app["config"].delete(key)
|
@@ -88,24 +92,26 @@ command :'apps:config remove' do |c|
|
|
88
92
|
end
|
89
93
|
|
90
94
|
command :'apps:ps' do |c|
|
91
|
-
c.syntax = 'valley apps:ps
|
95
|
+
c.syntax = 'valley apps:ps'
|
92
96
|
c.description = 'shows app processes'
|
97
|
+
c.option '--app STRING', String, 'App name'
|
93
98
|
c.action do |args, options|
|
94
99
|
|
95
100
|
DRb.start_service
|
96
|
-
puts GV::Valley::App.find!(
|
101
|
+
puts GV::Valley::App.find!(options.app)['ps'].map{|type,ps| {type => ps['scale']} }
|
97
102
|
DRb.stop_service
|
98
103
|
end
|
99
104
|
end
|
100
105
|
|
101
106
|
command :'apps:ps scale' do |c|
|
102
|
-
c.syntax = 'valley apps:ps scale
|
107
|
+
c.syntax = 'valley apps:ps scale TYPE=SCALE [TYPE=SCALE]'
|
103
108
|
c.description = 'shows app processes'
|
109
|
+
c.option '--app STRING', String, 'App name'
|
104
110
|
c.action do |args, options|
|
105
111
|
|
106
112
|
DRb.start_service
|
107
113
|
|
108
|
-
name =
|
114
|
+
name = options.app
|
109
115
|
ps = Hash[args.map{|kv| kv.split("=")}]
|
110
116
|
app = GV::Valley::App.find!(name)
|
111
117
|
ps.each do |key,scale|
|
@@ -123,24 +129,26 @@ command :'apps:ps scale' do |c|
|
|
123
129
|
end
|
124
130
|
|
125
131
|
command :'apps:domains' do |c|
|
126
|
-
c.syntax = 'valley apps:domains
|
132
|
+
c.syntax = 'valley apps:domains'
|
127
133
|
c.description = 'shows app domains'
|
134
|
+
c.option '--app STRING', String, 'App name'
|
128
135
|
c.action do |args, options|
|
129
136
|
|
130
137
|
DRb.start_service
|
131
|
-
puts GV::Valley::App.find!(
|
138
|
+
puts GV::Valley::App.find!(options.app)['domains']
|
132
139
|
DRb.stop_service
|
133
140
|
end
|
134
141
|
end
|
135
142
|
|
136
143
|
command :'apps:domains add' do |c|
|
137
|
-
c.syntax = 'valley apps:domains add
|
144
|
+
c.syntax = 'valley apps:domains add DOMAIN [DOMAIN]'
|
138
145
|
c.description = 'adds item to app domains'
|
146
|
+
c.option '--app STRING', String, 'App name'
|
139
147
|
c.action do |args, options|
|
140
148
|
|
141
149
|
DRb.start_service
|
142
150
|
|
143
|
-
name =
|
151
|
+
name = options.app
|
144
152
|
app = GV::Valley::App.find!(name)
|
145
153
|
domains = args - GV::Valley::App.all.map{|a| a["domains"]}.flatten
|
146
154
|
app["domains"] = (app["domains"] + domains).compact.uniq
|
@@ -153,13 +161,14 @@ command :'apps:domains add' do |c|
|
|
153
161
|
end
|
154
162
|
|
155
163
|
command :'apps:domains remove' do |c|
|
156
|
-
c.syntax = 'valley apps:domains remove
|
164
|
+
c.syntax = 'valley apps:domains remove DOMAIN [DOMAIN]'
|
157
165
|
c.description = 'removes item from app domains'
|
166
|
+
c.option '--app STRING', String, 'App name'
|
158
167
|
c.action do |args, options|
|
159
168
|
|
160
169
|
DRb.start_service
|
161
170
|
|
162
|
-
name =
|
171
|
+
name = options.app
|
163
172
|
app = GV::Valley::App.find!(name)
|
164
173
|
app["domains"] = app["domains"] - args
|
165
174
|
app.save
|
@@ -171,13 +180,14 @@ command :'apps:domains remove' do |c|
|
|
171
180
|
end
|
172
181
|
|
173
182
|
command :'apps:run' do |c|
|
174
|
-
c.syntax = 'valley apps:run
|
183
|
+
c.syntax = 'valley apps:run CMD'
|
175
184
|
c.description = 'runs cmd on app'
|
185
|
+
c.option '--app STRING', String, 'App name'
|
176
186
|
c.action do |args, options|
|
177
187
|
|
178
188
|
DRb.start_service
|
179
189
|
service = GV::Valley::Runner.random_service
|
180
|
-
name =
|
190
|
+
name = options.app
|
181
191
|
cmd = args.join(" ")
|
182
192
|
block = cmd =~ Sticks::Pipe::INTERACTIVE_COMMANDS ? Sticks::Pipe::Blocks.interactive : Sticks::Pipe::Blocks.stream
|
183
193
|
service.run name, cmd, &block
|
@@ -186,13 +196,14 @@ command :'apps:run' do |c|
|
|
186
196
|
end
|
187
197
|
|
188
198
|
command :'apps:logs' do |c|
|
189
|
-
c.syntax = 'valley apps:logs
|
199
|
+
c.syntax = 'valley apps:logs <PS>'
|
190
200
|
c.description = 'runs cmd on app'
|
201
|
+
c.option '--app STRING', String, 'App name'
|
191
202
|
c.option '-f','--follow', String, 'streams log'
|
192
203
|
c.action do |args, options|
|
193
204
|
|
194
205
|
DRb.start_service
|
195
|
-
name =
|
206
|
+
name = options.app
|
196
207
|
app = GV::Valley::App.find!(name)
|
197
208
|
ps = args.shift
|
198
209
|
psname = "#{name}.#{ps}"
|
@@ -209,38 +220,39 @@ command :'apps:logs' do |c|
|
|
209
220
|
end
|
210
221
|
end
|
211
222
|
|
212
|
-
command :'apps:logs' do |c|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
end
|
223
|
+
# command :'apps:logs' do |c|
|
224
|
+
# c.syntax = 'valley apps:logs APP_NAME <PS>'
|
225
|
+
# c.description = 'runs cmd on app'
|
226
|
+
# c.option '-f','--follow', String, 'streams log'
|
227
|
+
# c.action do |args, options|
|
228
|
+
#
|
229
|
+
# DRb.start_service
|
230
|
+
# name = args.shift
|
231
|
+
# app = GV::Valley::App.find!(name)
|
232
|
+
# ps = args.shift
|
233
|
+
# psname = "#{name}.#{ps}"
|
234
|
+
#
|
235
|
+
# # debug GV::Valley::Deployer.space.read_all([:ps,/#{psname}/,nil,nil])
|
236
|
+
#
|
237
|
+
# tuple = [:ps, /#{psname}/, nil, nil ]
|
238
|
+
# block = options.follow ? Sticks::Pipe::Blocks.stream : Sticks::Pipe::Blocks.capture
|
239
|
+
# (GV::Valley::Deployer.space.read_all(tuple) rescue []).each do |h|
|
240
|
+
# h[2].logs psname,options.follow, &block
|
241
|
+
# end
|
242
|
+
#
|
243
|
+
# DRb.stop_service
|
244
|
+
# end
|
245
|
+
# end
|
235
246
|
|
236
247
|
command :'apps:destroy' do |c|
|
237
|
-
c.syntax = 'valley apps:destroy
|
248
|
+
c.syntax = 'valley apps:destroy'
|
238
249
|
c.description = 'destroys app'
|
250
|
+
c.option '--app STRING', String, 'App name'
|
239
251
|
c.action do |args, options|
|
240
252
|
|
241
253
|
DRb.start_service
|
242
254
|
|
243
|
-
name =
|
255
|
+
name = options.app
|
244
256
|
app = GV::Valley::App.find!(name)
|
245
257
|
|
246
258
|
deployer = GV::Valley::Deployer.service
|
@@ -267,13 +279,14 @@ command :'balancer:reload' do |c|
|
|
267
279
|
end
|
268
280
|
|
269
281
|
command :'addons:create' do |c|
|
270
|
-
c.syntax = 'valley addons:create NAME
|
282
|
+
c.syntax = 'valley addons:create NAME'
|
271
283
|
c.description = 'creates addon service'
|
284
|
+
c.option '--app STRING', String, 'App name'
|
272
285
|
c.action do |args, options|
|
273
286
|
|
274
287
|
DRb.start_service
|
275
288
|
addon = args.shift
|
276
|
-
app_name =
|
289
|
+
app_name = options.app
|
277
290
|
|
278
291
|
require "gv/addons/#{addon}"
|
279
292
|
addon_service = "GV::Addons::#{addon.classify}".constantize.service
|
@@ -284,13 +297,14 @@ command :'addons:create' do |c|
|
|
284
297
|
end
|
285
298
|
|
286
299
|
command :'addons:run' do |c|
|
287
|
-
c.syntax = 'valley addons:run NAME
|
300
|
+
c.syntax = 'valley addons:run NAME CMD'
|
288
301
|
c.description = 'runs method on addon service'
|
302
|
+
c.option '--app STRING', String, 'App name'
|
289
303
|
c.action do |args, options|
|
290
304
|
|
291
305
|
DRb.start_service
|
292
306
|
addon = args.shift
|
293
|
-
app_name =
|
307
|
+
app_name = options.app
|
294
308
|
cmd = args.shift
|
295
309
|
|
296
310
|
require "gv/addons/#{addon}"
|
@@ -302,13 +316,14 @@ command :'addons:run' do |c|
|
|
302
316
|
end
|
303
317
|
|
304
318
|
command :'addons:destroy' do |c|
|
305
|
-
c.syntax = 'valley addons:destroy NAME
|
319
|
+
c.syntax = 'valley addons:destroy NAME'
|
306
320
|
c.description = 'destroys addon service'
|
321
|
+
c.option '--app STRING', String, 'App name'
|
307
322
|
c.action do |args, options|
|
308
323
|
|
309
324
|
DRb.start_service
|
310
325
|
addon = args.shift
|
311
|
-
app_name =
|
326
|
+
app_name = options.app
|
312
327
|
|
313
328
|
require "gv/addons/#{addon}"
|
314
329
|
addon_service = "GV::Addons::#{addon.classify}".constantize.service
|
data/gv-valley.gemspec
CHANGED
data/lib/gv/valley/app.rb
CHANGED
data/lib/gv/valley/balancer.rb
CHANGED
@@ -31,9 +31,12 @@ module GV
|
|
31
31
|
end
|
32
32
|
|
33
33
|
backend << "backend b_#{app["name"]}\n"
|
34
|
-
app["ps"]
|
35
|
-
|
36
|
-
|
34
|
+
app["ps"].select{|k,v| k =~ /web/}.each do |ps,pdata|
|
35
|
+
pdata['containers'].each do |container|
|
36
|
+
# app["ps"]["web"]["containers"].each do |container|
|
37
|
+
host = container['HostConfig']['PortBindings']["#{App::PORT}/tcp"].first
|
38
|
+
backend << "#{INDENT}server srv_#{container['ID'][0..6]} #{host['HostIp']}:#{host['HostPort']}\n"
|
39
|
+
end
|
37
40
|
end
|
38
41
|
|
39
42
|
end
|
@@ -103,7 +103,7 @@ module GV
|
|
103
103
|
runner.run
|
104
104
|
at_exit {
|
105
105
|
pid = File.read("/var/run/gv-file_server.pid").chomp.to_i
|
106
|
-
Process.kill("TERM",pid)
|
106
|
+
Process.kill("TERM",pid) rescue nil
|
107
107
|
File.delete("/var/run/gv-file_server.pid")
|
108
108
|
File.delete("/var/log/gv-file_server.log")
|
109
109
|
File.delete("/var/log/gv-file_server.log_stdout.log")
|
data/lib/gv/valley/version.rb
CHANGED
data/test/gv/test_app.rb
CHANGED
data/test/gv/test_etcd.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gv-valley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Onur Uyar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: gv-bedrock
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 0.0.2
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 0.0.2
|
111
111
|
description:
|
112
112
|
email:
|
113
113
|
- me@onuruyar.com
|