fly.io-rails 0.1.18-aarch64-linux → 0.1.19-aarch64-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: 57e5ae6928d84dfd6e9fbce5617ecdccb86c96f08b66efb388ced7acd6d4300e
4
- data.tar.gz: a960753eba8fc03563e34656331411d060ce2270b697ce90582d77e95d0dec17
3
+ metadata.gz: '09a7c3cb47fa7a3dacfdef6ecd9d8ff964b58a1fe0a0ab72751442657d84e3ae'
4
+ data.tar.gz: 40235704945d00d19fac4878626d93b4dc6c821103bb6f92aa5b596430d4c251
5
5
  SHA512:
6
- metadata.gz: 89fbef2f0e6f4849b179d46875ea4396bb5502ffdbaadcfd5bd4bf7d18d4b4cff5bb3f0858c59ef49f539a8352d9bacf3ba62d962136a9b534d9933004596fb2
7
- data.tar.gz: 1d7533be67de6e5cc72ec96cacaf5cc13a4bb4ae6f64c7da3974cf4e77473729e80f76a1738cf5da1eed27353ba8158cb285523e114d9b145ba2d922b9631b35
6
+ metadata.gz: 585c9169d3ab547c72832049d4632c9e38b727853ef4b1db69827471473f918e0d6a06f4fc1bff7c9ddde148d79c0dd9091095b3197aaaf7fc3d84179f1661ec
7
+ data.tar.gz: 8a3fcda9bbf40c5200dafd807abb61724085c49d6268aafece6bfd62c787fcd121b9a3afe535839ed6626ef0f0bdd3091cd20f8164e713eaa034acbd793ac9d3
@@ -365,13 +365,15 @@ module Fly
365
365
 
366
366
  # stop previous instances - list will fail on first run
367
367
  stdout, stderr, status = Open3.capture3('fly machines list --json')
368
+ existing_machines = []
368
369
  unless stdout.empty?
369
- JSON.parse(stdout).each do |list|
370
- next if list['id'] == machine or list['state'] == 'destroyed'
371
- cmd = "fly machines remove --force #{list['id']}"
372
- say_status :run, cmd
373
- system cmd
374
- end
370
+ JSON.parse(stdout).each do |list|
371
+ existing_machines << list['name']
372
+ next if list['id'] == machine or list['state'] == 'destroyed'
373
+ cmd = "fly machines remove --force #{list['id']}"
374
+ say_status :run, cmd
375
+ system cmd
376
+ end
375
377
  end
376
378
 
377
379
  # configure sqlite3 (can be overridden by fly.toml)
@@ -410,7 +412,10 @@ module Fly
410
412
  options = {region: @region, config: config}
411
413
  say_status :fly, "start #{app}"
412
414
  if not toml['processes'] or toml['processes'].empty?
413
- options[:name] = "#{app}-machine",
415
+ options[:name] = "#{app}-machine"
416
+ taken = existing_machines.find {|name| name.start_with? options[:name]}
417
+ options[:name] = taken == options[:name] ? "#{taken}-2" : taken.next if taken
418
+
414
419
  start = Fly::Machines.create_and_start_machine(app, options)
415
420
  machines['app'] = start[:id]
416
421
  else
@@ -418,11 +423,14 @@ module Fly
418
423
  config[:env]['NATS_SERVER'] = 'localhost'
419
424
  toml['processes'].each do |name, entrypoint|
420
425
  options[:name] = "#{app}-machine-#{name}"
426
+ taken = existing_machines.find {|name| name.start_with? options[:name]}
427
+ options[:name] = taken == options[:name] ? "#{taken}-2" : taken.next if taken
428
+
421
429
  config[:env]['SERVER_COMMAND'] = entrypoint
422
430
  start = Fly::Machines.create_and_start_machine(app, options)
423
431
 
424
432
  if start['error']
425
- STDERR.puts "ERROR: #{start.error}"
433
+ STDERR.puts "ERROR: #{start['error']}"
426
434
  exit 1
427
435
  end
428
436
 
@@ -1,3 +1,3 @@
1
1
  module Fly_io
2
- VERSION = '0.1.18'
2
+ VERSION = '0.1.19'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fly.io-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-24 00:00:00.000000000 Z
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fly-ruby