Hi all, I am a newbie to fly.io and am following the helloruby walkthrough . The application runs locally with rackup, but flyctl launch
fails with Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1
. When I look at the logs in the dashboard, I see two lines with errors:
bundler: failed to load command: rackup (/layers/heroku_ruby/gems/vendor/bundle/ruby/3.0.0/bin/rackup)
/workspace/config.ru:3:in `block in <main>': undefined local variable or method `flyctl' for #<Rack::Builder:0x0000563ed8e9af30 @freeze_app=false, @warmup=nil, @run=nil, @map=nil, @use=[]> (NameError)
Would anyone have any suggestions for getting the ruby example app working? Thanks!
rubys
September 5, 2022, 8:08pm
2
As odd as it sounds, try again?
I just ran through the steps, and they worked for me:
Here’s the session log:
% fly launch
Creating app in /Users/rubys/git/helloruby-builtin
Scanning source code
Detected a Ruby app
Using the following build configuration:
Builder: heroku/buildpacks:20
? App Name (leave blank to use an auto-generated name):
? Select organization: Sam Ruby (personal)
? Select region: iad (Ashburn, Virginia (US))
Created app patient-frost-5582 in organization personal
Wrote config file fly.toml
? Would you like to set up a Postgresql database now? No
? Would you like to deploy now? Yes
Deploying patient-frost-5582
==> Validating app configuration
--> Validating app configuration done
Services
TCP 80/443 ⇢ 8080
Remote builder fly-builder-restless-morning-1233 ready
==> Building image with Buildpacks
--> docker host: 20.10.12 linux x86_64
20: Pulling from heroku/buildpacks
3b65ec22a9e9: Pulling fs layer
b6202363bd77: Pulling fs layer
ea118d2439ab: Pulling fs layer
4c5ccb961353: Pulling fs layer
981e8124f290: Pull complete
a2beb1fd89b8: Pull complete
c745f8974b4d: Pull complete
357fefdf9bc9: Pull complete
98438d9c08b1: Pull complete
bcbb9964778f: Pull complete
dac7ba637c69: Pull complete
78b6569b2bc7: Pull complete
5527c4faf53d: Pull complete
df7511f8e7bc: Pull complete
718e08308c99: Pull complete
b23c7d4cd55d: Pull complete
b00fdb7c446f: Pull complete
d2f46928a9b4: Pull complete
5e2cdf22fefd: Pull complete
3d99fcc555d3: Pull complete
b0a4219d827e: Pull complete
e05880487c3c: Pull complete
210536913458: Pull complete
03e936dd9ea4: Pull complete
670e7ad9be8f: Pull complete
03931a50bb98: Pull complete
df09ac2c70e2: Pull complete
7598c9bf7078: Pull complete
9fbcdd50b35a: Pull complete
d380858d7954: Pull complete
4f4fb700ef54: Downloading 32B/32B
20: Pulling from heroku/buildpacks
3b65ec22a9e9: Pull complete
b6202363bd77: Pull complete
ea118d2439ab: Pull complete
4c5ccb961353: Pull complete
981e8124f290: Pull complete
a2beb1fd89b8: Pull complete
c745f8974b4d: Pull complete
357fefdf9bc9: Pull complete
98438d9c08b1: Pull complete
bcbb9964778f: Pull complete
dac7ba637c69: Pull complete
78b6569b2bc7: Pull complete
5527c4faf53d: Pull complete
df7511f8e7bc: Pull complete
718e08308c99: Pull complete
b23c7d4cd55d: Pull complete
b00fdb7c446f: Pull complete
d2f46928a9b4: Pull complete
5e2cdf22fefd: Pull complete
3d99fcc555d3: Pull complete
b0a4219d827e: Pull complete
e05880487c3c: Pull complete
210536913458: Pull complete
03e936dd9ea4: Pull complete
670e7ad9be8f: Pull complete
03931a50bb98: Pull complete
df09ac2c70e2: Pull complete
7598c9bf7078: Pull complete
9fbcdd50b35a: Pull complete
d380858d7954: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:fb730ac6526f877631434152d2618d685c6a00c603a2a3e00e3d4409437852c8
Status: Downloaded newer image for heroku/buildpacks:20
20-cnb: Pulling from heroku/heroku
3b65ec22a9e9: Already exists
b6202363bd77: Already exists
ea118d2439ab: Already exists
6af6c8a2a599: Pull complete
1594851f7bae: Pull complete
Digest: sha256:b323808b41c13adafdeb0b546fe7fddeafe5695f573c1a3bd1e3aa5c3586b462
Status: Downloaded newer image for heroku/heroku:20-cnb
===> DETECTING
1 of 2 buildpacks participating
heroku/ruby 0.1.3
===> ANALYZING
Previous image with name "registry.fly.io/patient-frost-5582:cache" not found
===> RESTORING
===> BUILDING
-----> Installing bundler 2.2.21
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rack
-----> Using Ruby version: ruby-3.0.0
-----> Loading Bundler Cache
-----> Installing dependencies using bundler 2.2.21
Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=/layers/heroku_ruby/gems/vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
Fetching gem metadata from https://rubygems.org/
Fetching gem metadata from https://rubygems.org/....
Using bundler 2.2.21
Fetching ruby2_keywords 0.0.5
Fetching nio4r 2.5.8
Fetching rack 2.2.3
Fetching tilt 2.0.10
Installing ruby2_keywords 0.0.5
Installing rack 2.2.3
Installing tilt 2.0.10
Installing nio4r 2.5.8 with native extensions
Fetching mustermann 1.1.1
Installing mustermann 1.1.1
Fetching rack-protection 2.1.0
Installing rack-protection 2.1.0
Fetching sinatra 2.1.0
Installing sinatra 2.1.0
Fetching puma 5.5.0
Installing puma 5.5.0 with native extensions
Bundle complete! 2 Gemfile dependencies, 9 gems now installed.
Gems in the groups 'development' and 'test' were not installed.
Bundled gems are installed into `/layers/heroku_ruby/gems/vendor/bundle`
Bundle completed (7.62s)
Cleaning up the bundler cache.
-----> Detecting rake tasks
===> EXPORTING
Adding layer 'heroku/ruby:env'
Adding layer 'heroku/ruby:gems'
Adding layer 'heroku/ruby:ruby'
Adding 1/1 app layer(s)
Adding layer 'launcher'
Adding layer 'config'
Adding layer 'process-types'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Setting default process type 'web'
Saving registry.fly.io/patient-frost-5582:cache...
*** Images (c9be2fe8064c):
registry.fly.io/patient-frost-5582:cache
registry.fly.io/patient-frost-5582:deployment-01GC7KHN978NC2YZJKCA6NH1VA
Adding cache layer 'heroku/ruby:gems'
--> Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/patient-frost-5582]
87dc756f0bc5: Pushed
a248e8c4fc0a: Pushed
9497805c7bd5: Pushed
49ded947dc51: Pushed
97f4dbe54449: Pushed
249bed98ccdf: Pushed
a1e3b8b5e582: Pushed
96df83a8f9c7: Pushed
b9ca82ca75b8: Pushed
de57c585fb49: Pushed
b7b1c4143f6f: Pushed
c3f11d77a5de: Pushed
deployment-01GC7KHN978NC2YZJKCA6NH1VA: digest: sha256:ed06ed3ff8bcd292fe4a6cdd3ac3c2c7a0f45cd3d00594805c9e88048a5b514c size: 2827
--> Pushing image done
Image: registry.fly.io/patient-frost-5582:deployment-01GC7KHN978NC2YZJKCA6NH1VA
Image size: 630 MB
==> Creating release
Release v2 created
You can detach the terminal anytime without stopping the deployment
Monitoring Deployment
1 desired, 1 placed, 1 healthy, 0 unhealthy [health checks: 1 total, 1 passing]
--> v0 deployed successfully
rubys@rubym1p helloruby-builtin % fly open
opening http://patient-frost-5582.fly.dev ...
Thanks! I tried again, but unfortunately had the same result. However, I did notice that you did not add a Postgresql database (whereas I did originally), so I also tried re-rerunning everything from scratch without setting up a database, and that did work. So, it seems that adding a database was where I went wrong.