I ended up just upgrading to Rails 6.
Since this is just a toy app, I’m fine with that.
It doesn’t need active record/active storage/etc so I stripped all of that out as well.
Seems to get further in the deploy process now. It’s failing with the fly
rake tasks because I don’t have any assets for it to compile or a server for it to run and have it listen for incoming requests. This used to be an app that would hit an API for me and post a message to slack once a day. I had the Heroku scheduler run a rake task which kicked off the entire thing scheduled at noon every day.
Do you know if something like that is possible with Fly? Got any docs that you can link I can read through?
Deploy Error Log
➜ daily-iroh git:(master) ✗ fly deploy
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-throbbing-field-2662 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon 27.39kB
[+] Building 59.9s (25/25) FINISHED
=> [internal] load remote build context 0.0s
=> copy /context / 0.1s
=> resolve image config for docker.io/docker/dockerfile:experimental 0.5s
=> docker-image://docker.io/docker/dockerfile:experimental@sha256:600e5c62eedff338b3f7a0850beb7c05866e0ef27b2d2e8c02aa468e78496ff5 0.3s
=> => resolve docker.io/docker/dockerfile:experimental@sha256:600e5c62eedff338b3f7a0850beb7c05866e0ef27b2d2e8c02aa468e78496ff5 0.0s
=> => extracting sha256:d7f0373ffb1d5ac3477b10ab7f91cba7c5df586c72e7e4a12649024efdc0d531 0.2s
=> => sha256:3c244c0c6fc9d6aa3ddb73af4264b3a23597523ac553294218c13735a2c6cf79 528B / 528B 0.0s
=> => sha256:b587adb6abfd8d6c87b1f649c2e924d53f148ae1c7f0ceaaded70b27b44dccb5 1.21kB / 1.21kB 0.0s
=> => sha256:d7f0373ffb1d5ac3477b10ab7f91cba7c5df586c72e7e4a12649024efdc0d531 9.64MB / 9.64MB 0.1s
=> => sha256:600e5c62eedff338b3f7a0850beb7c05866e0ef27b2d2e8c02aa468e78496ff5 1.69kB / 1.69kB 0.0s
=> [internal] load metadata for quay.io/evl.ms/fullstaq-ruby:3.1.1-jemalloc-slim 0.3s
=> [base 1/6] FROM quay.io/evl.ms/fullstaq-ruby:3.1.1-jemalloc-slim@sha256:20d3c380783dd570b6258230425d6fa9f3d7b5891a18f738e3a1bf432ba71c9d 3.3s
=> => resolve quay.io/evl.ms/fullstaq-ruby:3.1.1-jemalloc-slim@sha256:20d3c380783dd570b6258230425d6fa9f3d7b5891a18f738e3a1bf432ba71c9d 0.0s
=> => sha256:20d3c380783dd570b6258230425d6fa9f3d7b5891a18f738e3a1bf432ba71c9d 741B / 741B 0.0s
=> => sha256:9a738ffacc352376d7c14d15a588ca2ea7b8a85b0b775634dff0a8cfa71569c2 3.72kB / 3.72kB 0.0s
=> => sha256:c229119241af7b23b121052a1cae4c03e0a477a72ea6a7f463ad7623ff8f274b 31.38MB / 31.38MB 1.0s
=> => sha256:ca28a8471987f7a474fa2868e936d86dd04616c905994a0b09360d8bd7fec369 18.18MB / 18.18MB 0.7s
=> => extracting sha256:c229119241af7b23b121052a1cae4c03e0a477a72ea6a7f463ad7623ff8f274b 1.4s
=> => extracting sha256:ca28a8471987f7a474fa2868e936d86dd04616c905994a0b09360d8bd7fec369 0.7s
=> [base 2/6] RUN mkdir /app 0.5s
=> [base 3/6] WORKDIR /app 0.0s
=> [base 4/6] RUN mkdir -p tmp/pids 0.3s
=> [base 5/6] RUN curl https://get.volta.sh | bash 2.6s
=> [base 6/6] RUN volta install node@18.1.0 && volta install yarn 3.1s
=> [build_deps 1/1] RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt --mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt apt-get update -qq && apt-get install --no-install- 17.2s
=> [stage-4 1/6] RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt --mount=type=cache,id=prod-apt-lib,sharing=locked,target=/var/lib/apt apt-get update -qq && apt-get install --no-install-re 7.9s
=> [gems 1/3] RUN gem install -N bundler -v 2.3.7 1.5s
=> [node_modules 1/3] COPY package*json ./ 0.0s
=> [node_modules 2/3] COPY yarn.* ./ 0.0s
=> [node_modules 3/3] RUN if [ -f "yarn.lock" ]; then yarn install; elif [ -f "package-lock.json" ]; then npm install; else mkdir node_modules; fi 0.5s
=> [gems 2/3] COPY Gemfile* ./ 0.0s
=> [gems 3/3] RUN bundle install && rm -rf vendor/bundle/ruby/*/cache 24.5s
=> [stage-4 2/6] COPY --from=gems /app /app 0.7s
=> [stage-4 3/6] COPY --from=node_modules /app/node_modules /app/node_modules 0.0s
=> [stage-4 4/6] COPY . . 0.0s
=> [stage-4 5/6] RUN chmod +x /app/bin/* && sed -i 's/ruby.exe/ruby/' /app/bin/* && sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/* 0.3s
=> [stage-4 6/6] RUN bin/rails fly:build 2.0s
=> exporting to image 1.5s
=> => exporting layers 1.5s
=> => writing image sha256:d7fc8ca52a46848b0c0c8cb5f171cd122d3cc1c123c43cd4eb4aa2eb492323a7 0.0s
=> => naming to registry.fly.io/daily-iroh:deployment-01GCAP07RDXZPYV4VVC1VG7CJN 0.0s
--> Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/daily-iroh]
0228bc5fd4b3: Pushed
0faa4a2ef521: Pushed
209744e52a13: Pushed
abc5df83e0cf: Pushed
4a49d0f80855: Pushed
8672d79fe4a7: Pushed
abd99a65c9c8: Pushed
c9bfcd325ab0: Pushed
32d2d429dbcb: Pushed
5f70bf18a086: Pushed
065afbc3cfb4: Pushed
2bff5884c8b6: Pushed
608f3a074261: Pushed
deployment-01GCAP07RDXZPYV4VVC1VG7CJN: digest: sha256:156badf67dc406c0bd21ff936eb4e956f247cd11bd5c4ee07ff8fd74e9ebe8de size: 3045
--> Pushing image done
image: registry.fly.io/daily-iroh:deployment-01GCAP07RDXZPYV4VVC1VG7CJN
image size: 547 MB
==> Creating release
--> release v2 created
--> You can detach the terminal anytime without stopping the deployment
==> Release command detected: bin/rails fly:release
--> This release will not be available until the release command succeeds.
Starting instance
Configuring virtual machine
Pulling container image
Unpacking image
Preparing kernel init
Configuring firecracker
Starting init (commit: 249766e)...
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=a2c5a5db-a877-45d5-90d3-b02e7b6d5555
2022/09/07 00:38:16 listening on [fdaa:0:95b4:a7b:2c00:51ae:d940:2]:22 (DNS: [fdaa::3]:53)
Rails version 6.1.6.1
Ruby version ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) +jemalloc [x86_64-linux]
Rack version 2.2.4
JavaScript Runtime Node.js (V8)
Environment production
Starting instance
Configuring virtual machine
Pulling container image
Unpacking image
Preparing kernel init
Configuring firecracker
Starting virtual machine
Starting init (commit: 249766e)...
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=a2c5a5db-a877-45d5-90d3-b02e7b6d5555
Preparing to run: `bin/rails fly:release` as root
2022/09/07 00:38:16 listening on [fdaa:0:95b4:a7b:2c00:51ae:d940:2]:22 (DNS: [fdaa::3]:53)
JavaScript Runtime Node.js (V8)
Middleware ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Callbacks, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper
Environment production
Starting clean up.
Starting clean up.
Starting instance
Configuring virtual machine
Pulling container image
Unpacking image
Preparing kernel init
Configuring firecracker
Starting virtual machine
Starting init (commit: 249766e)...
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=a2c5a5db-a877-45d5-90d3-b02e7b6d5555
Preparing to run: `bin/rails fly:release` as root
2022/09/07 00:38:16 listening on [fdaa:0:95b4:a7b:2c00:51ae:d940:2]:22 (DNS: [fdaa::3]:53)
About your application's environment
Rails version 6.1.6.1
Ruby version ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) +jemalloc [x86_64-linux]
RubyGems version 3.3.7
Rack version 2.2.4
JavaScript Runtime Node.js (V8)
Middleware ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Callbacks, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper
Application root /app
Environment production
Starting clean up.
==> Monitoring deployment
1 desired, 1 placed, 0 healthy, 1 unhealthy [restarts: 2] [health checks: 1 total]
Failed Instances
Failure #1
Instance
ID PROCESS VERSION REGION DESIRED STATUS HEALTH CHECKS RESTARTS CREATED
c7aca979 app 0 mia run pending 1 total 2 32s ago
Recent Events
TIMESTAMP TYPE MESSAGE
2022-09-07T00:38:36Z Received Task received by client
2022-09-07T00:38:36Z Task Setup Building Task Directory
2022-09-07T00:38:40Z Started Task started by client
2022-09-07T00:38:44Z Terminated Exit Code: 1
2022-09-07T00:38:44Z Restarting Task restarting in 1.215154776s
2022-09-07T00:38:53Z Started Task started by client
2022-09-07T00:38:57Z Terminated Exit Code: 1
2022-09-07T00:38:57Z Restarting Task restarting in 1.038241424s
2022-09-07T00:39:08Z [info]rails aborted!
2022-09-07T00:39:08Z [info]Command failed with status (1): [bin/rails server...]
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/file_utils.rb:67:in `block in create_shell_runner'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/file_utils.rb:57:in `sh'
2022-09-07T00:39:08Z [info]/app/lib/tasks/fly.rake:21:in `block (2 levels) in <main>'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.6.1/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.6.1/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.6.1/lib/rails/commands/rake/rake_command.rb:18:in `perform'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.6.1/lib/rails/command.rb:50:in `invoke'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.6.1/lib/rails/commands.rb:18:in `<main>'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
2022-09-07T00:39:08Z [info]/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
2022-09-07T00:39:08Z [info]Tasks: TOP => fly:server
2022-09-07T00:39:08Z [info](See full trace by running task with --trace)
2022-09-07T00:39:08Z [info]Starting clean up.
--> v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1
--> Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
Error abort
For context, I changed my lib/tasks/fly.rake
to the following because there’s nothing to do for build
and release
steps. I just wanted to get something working so I swapped in the about
task:
# commands used to deploy a Rails application
namespace :fly do
# BUILD step:
# - changes to the filesystem made here DO get deployed
# - NO access to secrets, volumes, databases
# - Failures here prevent deployment
task :build => 'about'
# RELEASE step:
# - changes to the filesystem made here are DISCARDED
# - full access to secrets, databases
# - failures here prevent deployment
task :release => 'about'
# SERVER step:
# - changes to the filesystem made here are deployed
# - full access to secrets, databases
# - failures here result in VM being stated, shutdown, and rolled back
# to last successful deploy (if any).
task :server do
sh 'bin/rails server'
end
end