fly.io-rails 0.1.15-x64-mingw32 → 0.1.17-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e485bf42c46a2875d4cd9e86abe7bdb11be4b95d90a30c2394c08d658b397ec
4
- data.tar.gz: 279fe3cf5f500abdcac1a31acb83c0678b0304ed6264572564d932d08514067e
3
+ metadata.gz: db56dc0375073cb48b4255df0b41f4e77967d0e6ca30040756e1f12d121eef31
4
+ data.tar.gz: 656579b8ad9eb78bf19e46953ac8edbd389ca46f358dad011460cf488a65b681
5
5
  SHA512:
6
- metadata.gz: cf09a9145a046d93451e3059139a36bd3b1ac52a4f34f52e40eb032eb3f113ffead913a8521141d01d76b282660249b9cfa81d284eec8fe55b65676474840e29
7
- data.tar.gz: 5e7a4e58fa7c0e800e90ffdf21e1ae9c93537ee8d0dadaaef9c80f111e20126da8d932df56b454d6ea8317d9b436d354ef8254047bd2a8648bfab9c6a6860bbd
6
+ metadata.gz: b2bce63de2d640a1371ca80c524ae31fcb5d376a22b7d2961e42ad12c4897afc0ef71b96492c6c97e29b555527a5d3acb987c7ed10534c3a11e476ce42fc417e
7
+ data.tar.gz: 8d989eb0092f908a2666efcd2d668e33dda2f9a53d4a36f169d46234acd801208adc5a1652c61a7ac8d5564497af6a56677ba1bb11db25661df2aaf8988eace5
@@ -197,17 +197,19 @@ module Fly
197
197
  end
198
198
 
199
199
  def create_volume(app, region, size)
200
- volume = "#{app.gsub('-', '_')}_volume"
201
- volumes = JSON.parse(`flyctl volumes list --json`).
202
- map {|volume| [volume['Name'], volume['Region']]}
200
+ name = "#{app.gsub('-', '_')}_volume"
201
+ volumes = JSON.parse(`flyctl volumes list --json`)
203
202
 
204
- unless volumes.include? [volume, region]
205
- cmd = "flyctl volumes create #{volume} --app #{app} --region #{region} --size #{size}"
203
+ volume = volumes.find {|volume| volume['Name'] == name and volume['Region'] == region}
204
+ unless volume
205
+ cmd = "flyctl volumes create #{name} --app #{app} --region #{region} --size #{size}"
206
206
  say_status :run, cmd
207
207
  system cmd
208
+ volumes = JSON.parse(`flyctl volumes list --json`)
209
+ volume = volumes.find {|volume| volume['Name'] == name and volume['Region'] == region}
208
210
  end
209
211
 
210
- volume
212
+ volume && volume['id']
211
213
  end
212
214
 
213
215
  def create_postgres(app, org, region, vm_size, volume_size, cluster_size)
@@ -396,7 +398,14 @@ module Fly
396
398
  config[:services] = toml['services'] if toml['services']
397
399
  if toml['mounts']
398
400
  mounts = toml['mounts']
399
- config[:mounts] = [ { volume: mounts['source'], path: mounts['destination'] } ]
401
+ volume = JSON.parse(`flyctl volumes list --json`).
402
+ find {|volume| volume['Name'] == mounts['source'] and volume['Region'] == @region}
403
+ if volume
404
+ config[:mounts] = [ { volume: volume['id'], path: mounts['destination'] } ]
405
+ else
406
+ STDERR.puts "volume #{mounts['source']} not found in region #{@region}"
407
+ exit 1
408
+ end
400
409
  end
401
410
 
402
411
  # start app
@@ -411,6 +420,12 @@ module Fly
411
420
  toml['processes'].each do |name, entrypoint|
412
421
  config[:env]['SERVER_COMMAND'] = entrypoint
413
422
  start = Fly::Machines.create_and_start_machine(app, config: config)
423
+
424
+ if start['error']
425
+ STDERR.puts start.inspect
426
+ exit 1
427
+ end
428
+
414
429
  machines[name] = start[:id]
415
430
 
416
431
  config.delete :mounts
@@ -174,6 +174,7 @@ module Fly
174
174
  host ||= "http://#{fly_api_hostname}"
175
175
  uri = URI.join(host, path)
176
176
  http = Net::HTTP.new(uri.host, uri.port)
177
+ http.set_debug_output $stderr if ENV['TRACE']
177
178
  http.use_ssl = true if uri.instance_of? URI::HTTPS
178
179
 
179
180
  request = make_request.call(uri.request_uri)
@@ -1,3 +1,3 @@
1
1
  module Fly_io
2
- VERSION = '0.1.15'
2
+ VERSION = '0.1.17'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fly.io-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.17
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Sam Ruby