fly.io-rails 0.1.16-x86_64-darwin → 0.1.17-x86_64-darwin

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: c78525528d112fac3d98a906c5b15406c0311c24e57ea90103b1ac8d895fa30d
4
- data.tar.gz: eb9f8e245a321daffa03046d13997e1be01d9c0a9b3c4610b92a13e3e437f92c
3
+ metadata.gz: 65933ec07a633f65ca8b763cf6a4d96e9e630387a0a1ddd35968db6995827f5e
4
+ data.tar.gz: 1b7d68310e402c7979b62dbd4fcaaf99c5b763edbe13771199cce417df3228c5
5
5
  SHA512:
6
- metadata.gz: b4b02c14d764bdbfbca4eb5efb8efa3a4547013530a32a6b9e72876b956f69a43616fb39e30bf6dc2ca4452a01251f701617a5e8a6afd0469978e1e63acb7180
7
- data.tar.gz: 91baefc86a455809ed2f4457b76e2e7cde2b754f77babfadc21c15975deadf6d514022912df9a3f12d2074ed567ee43095607349ebe0ed676cee5b92ada208b7
6
+ metadata.gz: f44d9139aff9c03cc56db439f4d59b6db25caae7460b56bc0f4d2aaacd733272a187a16e93c086a555b091ad486854e8fe1753f48ea8895d05c79297debb87dd
7
+ data.tar.gz: 91c8e32a07333a35f1211d7a9fc7e27c2326b9a0b8268d446bd50b8aa94237809ad1372b49fd0454100a05daa0a53e9c55a48dbc6255f1394785f9a7027fd022
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Fly_io
2
- VERSION = '0.1.16'
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.16
4
+ version: 0.1.17
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - Sam Ruby