fly.io-rails 0.1.18 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fly.io-rails/actions.rb +16 -8
- data/lib/fly.io-rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cc23fa369a363a787843d3550716ee786faabbbc0f04d44d6d648fc8199242b
|
4
|
+
data.tar.gz: c0def1765381df4dd6940049913c0cff4b27fda258efab192848b9a5ad229f59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c482ea6f86f0b9184a97def4f78f2ea694192261aae93f0105eda54a859578e1d696a47c4ad6fb9d6fbbaf956c58a3a8431492654639f4aab5f8f7db263629bc
|
7
|
+
data.tar.gz: 9c2b5c82abbc06cea0f12e505184d6389de4a40f675d2cd8dca65d5957c3c70b5239de7b9cca4459f885818d5becc973aa9621c4945434407181aaecf9261ba6
|
data/lib/fly.io-rails/actions.rb
CHANGED
@@ -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
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
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
|
433
|
+
STDERR.puts "ERROR: #{start['error']}"
|
426
434
|
exit 1
|
427
435
|
end
|
428
436
|
|
data/lib/fly.io-rails/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fly-ruby
|