fly.io-rails 0.1.16 → 0.1.17

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: f96dcb36171d5224f7773b14c56bc9340df0a0dc4adb31cac61bdeecf2d1f9f0
4
- data.tar.gz: 4a0cdf24d5760dfe5a88eadffede2b5aa0a74aa781d27ee0a1efecb3225b0a60
3
+ metadata.gz: 6cd9eeec82563db7cad109945cd690f9da1b0d064a9505b196df8e3735120484
4
+ data.tar.gz: ed54c0bc5884f9793913ac7430e865a84c85175aca383d02c8999acb0c0ba5b2
5
5
  SHA512:
6
- metadata.gz: '069d3d1c55f65d24f22cc515710946fe03659bf8d53362dc5726609cbbed0e47109110176cb5dc60767232da475c712776942fa52b2ab0a2378bf8ae422af845'
7
- data.tar.gz: 85982160164a4e63cd5fc23ab869c3bc8d7ab43fc78fb5cd2950dd848a63b6aef4f07a83c7603b9e72da36e1fbbff3682b85fb5569ee67c3c6c9e3b7ea4cc461
6
+ metadata.gz: da01a522eab3c5c28febc36e304919de75108947052bd12fdbc697bc5684b0b2fe29eb3c0332332da7959b8c3ade087190f4e090ca4cb659d263bb5c1532e3f8
7
+ data.tar.gz: d74d360f004f7dd42ed54b025d245fba96c37faddaf48eeb0edb4fd27bb8b23f2a2af3ea896a5d01a6f518043e992c766b353248de966c86b5eec434432fa3d6
@@ -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: ruby
6
6
  authors:
7
7
  - Sam Ruby