fly.io-rails 0.1.16-arm64-darwin → 0.1.18-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exe/arm64-darwin/flyctl +0 -0
- data/lib/fly.io-rails/actions.rb +31 -16
- data/lib/fly.io-rails/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7389af7bf88265119e2d06aa049355559bc4028f0d3dece0d0e8953343e4f862
         | 
| 4 | 
            +
              data.tar.gz: c152a91850b5b485a20587c6dc00c07bd5dbfd0598bc732a55195e1e9660b01b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4f0cd311b53e3eeac2b85249759f66d6a978187df0597a83458bc4d99522d9657ffc06a150ff6ab8580ffb246ce57ddd6851c13722b1585dd26e8b8fb6479101
         | 
| 7 | 
            +
              data.tar.gz: 75c9ca90be85fa0a003fc4ba47924f0414a0ee5f794c3412fc072bd78c7f714ce0e3d7220866df6fbad935484bace0e43e00b5d236f41a9945bbda9d84be70bc
         | 
    
        data/exe/arm64-darwin/flyctl
    CHANGED
    
    | Binary file | 
    
        data/lib/fly.io-rails/actions.rb
    CHANGED
    
    | @@ -197,17 +197,19 @@ module Fly | |
| 197 197 | 
             
                end
         | 
| 198 198 |  | 
| 199 199 | 
             
                def create_volume(app, region, size)
         | 
| 200 | 
            -
                   | 
| 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 | 
            -
                   | 
| 205 | 
            -
             | 
| 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)
         | 
| @@ -235,8 +237,8 @@ module Fly | |
| 235 237 | 
             
                  output[%r{redis://\S+}]
         | 
| 236 238 | 
             
                end
         | 
| 237 239 |  | 
| 238 | 
            -
                def release(app,  | 
| 239 | 
            -
                  start = Fly::Machines.create_and_start_machine(app,  | 
| 240 | 
            +
                def release(app, options)
         | 
| 241 | 
            +
                  start = Fly::Machines.create_and_start_machine(app, options)
         | 
| 240 242 | 
             
                  machine = start[:id]
         | 
| 241 243 |  | 
| 242 244 | 
             
                  if not machine
         | 
| @@ -320,9 +322,6 @@ module Fly | |
| 320 322 |  | 
| 321 323 | 
             
                  # default config
         | 
| 322 324 | 
             
                  config = {
         | 
| 323 | 
            -
                    region: @region,
         | 
| 324 | 
            -
                    app: app,
         | 
| 325 | 
            -
                    name: "#{app}-machine",
         | 
| 326 325 | 
             
                    image: image,
         | 
| 327 326 | 
             
                    guest: {
         | 
| 328 327 | 
             
                      cpus: @config.machine.cpus,
         | 
| @@ -351,7 +350,7 @@ module Fly | |
| 351 350 |  | 
| 352 351 | 
             
                    # perform release
         | 
| 353 352 | 
             
                    say_status :fly, release_config[:env]['SERVER_COMMAND']
         | 
| 354 | 
            -
                    event, exit_code, machine = release(app, release_config)
         | 
| 353 | 
            +
                    event, exit_code, machine = release(app, region: @region, config: release_config)
         | 
| 355 354 |  | 
| 356 355 | 
             
                    if exit_code != 0
         | 
| 357 356 | 
             
                      STDERR.puts 'Error performing release'
         | 
| @@ -396,21 +395,37 @@ module Fly | |
| 396 395 | 
             
                  config[:services] = toml['services'] if toml['services']
         | 
| 397 396 | 
             
                  if toml['mounts']
         | 
| 398 397 | 
             
                    mounts = toml['mounts']
         | 
| 399 | 
            -
                     | 
| 398 | 
            +
                    volume = JSON.parse(`flyctl volumes list --json`).
         | 
| 399 | 
            +
                      find {|volume| volume['Name'] == mounts['source'] and volume['Region'] == @region}
         | 
| 400 | 
            +
                    if volume
         | 
| 401 | 
            +
                      config[:mounts] = [ { volume: volume['id'], path: mounts['destination'] } ]
         | 
| 402 | 
            +
                    else
         | 
| 403 | 
            +
                      STDERR.puts "volume #{mounts['source']} not found in region #{@region}"
         | 
| 404 | 
            +
                      exit 1
         | 
| 405 | 
            +
                    end
         | 
| 400 406 | 
             
                  end
         | 
| 401 407 |  | 
| 402 408 | 
             
                  # start app
         | 
| 403 409 | 
             
                  machines = {}
         | 
| 410 | 
            +
                  options = {region: @region, config: config}
         | 
| 404 411 | 
             
                  say_status :fly, "start #{app}"
         | 
| 405 412 | 
             
                  if not toml['processes'] or toml['processes'].empty?
         | 
| 406 | 
            -
                     | 
| 413 | 
            +
                    options[:name] = "#{app}-machine",
         | 
| 414 | 
            +
                    start = Fly::Machines.create_and_start_machine(app, options)
         | 
| 407 415 | 
             
                    machines['app'] = start[:id] 
         | 
| 408 416 | 
             
                  else
         | 
| 409 417 | 
             
                    config[:env] ||= {}
         | 
| 410 418 | 
             
                    config[:env]['NATS_SERVER'] = 'localhost'
         | 
| 411 419 | 
             
                    toml['processes'].each do |name, entrypoint|
         | 
| 420 | 
            +
                      options[:name] = "#{app}-machine-#{name}"
         | 
| 412 421 | 
             
                      config[:env]['SERVER_COMMAND'] = entrypoint
         | 
| 413 | 
            -
                      start = Fly::Machines.create_and_start_machine(app,  | 
| 422 | 
            +
                      start = Fly::Machines.create_and_start_machine(app, options)
         | 
| 423 | 
            +
             | 
| 424 | 
            +
                      if start['error']
         | 
| 425 | 
            +
                        STDERR.puts "ERROR: #{start.error}"
         | 
| 426 | 
            +
                        exit 1
         | 
| 427 | 
            +
                      end
         | 
| 428 | 
            +
             | 
| 414 429 | 
             
                      machines[name] = start[:id] 
         | 
| 415 430 |  | 
| 416 431 | 
             
                      config.delete :mounts
         | 
| @@ -484,7 +499,7 @@ module Fly | |
| 484 499 | 
             
                  # perform release, if necessary
         | 
| 485 500 | 
             
                  if (IO.read('lib/tasks/fly.rake') rescue '') =~ /^\s*task[ \t]*+:?release"?[ \t]*\S/
         | 
| 486 501 | 
             
                    say_status :fly, config[:env]['SERVER_COMMAND']
         | 
| 487 | 
            -
                    event, exit_code, machine = release(app, config)
         | 
| 502 | 
            +
                    event, exit_code, machine = release(app, region: @region, config: config)
         | 
| 488 503 | 
             
                  else
         | 
| 489 504 | 
             
                    exit_code = 0
         | 
| 490 505 | 
             
                  end
         | 
    
        data/lib/fly.io-rails/version.rb
    CHANGED