fly.io-rails 0.1.15-x86-linux → 0.1.17-x86-linux

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: 9fd48bbd6d60636588b2be4029aa7e3fb8681439aea0138a8cc5996a3d85c4de
4
- data.tar.gz: 705039823dcc01af1473fd9cc2cbd5696a8d6372a1cddb6c53c0efc473d88020
3
+ metadata.gz: 690a6d50aca782e3c8d9a070abdc0c985424285251d624e0b9061e58499acac4
4
+ data.tar.gz: 205e6925ba94d799a1b9cff5ac3a4d3816a741279c7ad46b76e96b401a494709
5
5
  SHA512:
6
- metadata.gz: b5d6672031e5a57f54a107d980a43a34025416cc306cbccc96b28d64ea264b09b2295d21a5838be89f6d008d821d89e3e39044ce67187d17b19584acc24c8427
7
- data.tar.gz: 91c9a197ae0d71c605cbed54d5defa19c4373e9ded1a9834a3c9570b7ab080904a33ea91f94d68e474795ed2f22e52164522631159fea7461079460ff2de6510
6
+ metadata.gz: 47dfe7f59f3b2b4842233e20676d930f34af919cd53dbcada9cf5a0fcc133d803ed72640284ce85652481c95b3f2fa308e1d213e12b95ac5af6d2682cbc555a1
7
+ data.tar.gz: 5defc631cd018276994ac69ceaccc5cd37c6d0c099ae011e10e71f307d0c40925d597ea42c790ac4ff08afbf13937be29d0e4e15699199476bbce8926c6282f5
@@ -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: x86-linux
6
6
  authors:
7
7
  - Sam Ruby