fly.io-rails 0.1.16-arm64-darwin → 0.1.17-arm64-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: 2162b9025e71b499daf82354e54a32b51cfaae392582854335e6dc046ed80bad
4
- data.tar.gz: 14bd4d55a770a961755a159b33ffc732d23d8bdf6c663430d5ac594c90dc9a71
3
+ metadata.gz: 462e418cd9cd1f0232f94c3f861358fc9a4498f7df287dd65af89a2688ffaeb8
4
+ data.tar.gz: 210ed9f107a7a7e29093391920aaa02d6cb9077c774ea0f1a7dfc747329d8f17
5
5
  SHA512:
6
- metadata.gz: c8a84dd1cc423c8f9846eb0340d20421fb5338776f70ae0fb567d92bcc997f45dfc54729cae0447b9fe1b1259bbb77b56f78b52eada153000374b9fbf5cee649
7
- data.tar.gz: d9d76448d89b5f75956c5b1856c9f3c0d263db872b1cee87f8b356b34c46f09e0ebea72e0fe4e32d81e21e71b028f07052315c05d9c053a8dc2d7811a232f019
6
+ metadata.gz: 10e957aa0ac8bb64c39cfbe71693c52e597c001a2a73751fe5bcd38bafb9543d2a7ed4a6f86ac4075d9ef4e97e22a156bdc2427e3b838d51e053b445c01ac65a
7
+ data.tar.gz: d1b30c5d80923681386b95e896d1b23aa4a7fd52236e8d21db8ff6b6ee8d3a1c2bce7a3db1b7ac159793faebc4edc63d8a1ecd16461ce9390554f75ecf80e0c3
@@ -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: arm64-darwin
6
6
  authors:
7
7
  - Sam Ruby