Hello, I am having trouble deploying my Ruby on Rails application (version 6.1.3). I have taken a look at similar issues. I have regenerated my credentials.yml.enc file and master.key file.
I have re-entered my credentials with EDITOR=“code --wait” bin/rails credentials:edit (the changes were saved). After I was done recreating my secret files, I deleted my app on my dashboard. And I ran fly launch and fly deploy.
For my config/production.rb file I have the master key requirement set to false (the original config had this commented out). config.require_master_key = false
The deploy commands below return the same error, they were taken from similar threads and going over setting the master key value manually with the fly secrets command and setting it while deploying with the build argument.
- fly secrets set RAILS_MASTER_KEY=$(cat config/credentials/production.key)
- flyctl deploy --build-arg SECRET_KET_BASE=placeholder
The most notable piece of output from the console was this error:
/rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/application.rb:603:in validate_secret_key_base': Missing
secret_key_basefor 'production' environment, set this string with
bin/rails credentials:edit` (ArgumentError)
I have a secret key base set in my credentials. When I run the command: EDITOR=“code --wait” bin/rails credentials:edit.
The full console output:
=> Verifying app config
Validating /home/juan/Documents/clip-scroll/fly.toml
Platform: machines
✓ Configuration is valid
→ Verified app config
==> Building image
Remote builder fly-builder-delicate-glade-6967 ready
==> Creating build context
→ Creating build context done
==> Building image with Docker
→ docker host: 20.10.12 linux x86_64
[+] Building 1135.2s (0/1)
[+] Building 151.5s (22/22) FINISHED
=> [internal] load remote build context 0.0s
=> copy /context / 19.6s
=> resolve image config for docker.io/docker/dockerfile:1 0.5s
=> CACHED docker-image://docker.io/docker/dockerfile:1@sha256:39b85bbfa7536a5feceb7372a0817649ecb2724562a38360f4d6a7782a409b14 0.0s
=> [internal] load metadata for Docker 0.2s
=> [base 1/3] FROM Docker 0.0s
=> CACHED [base 2/3] WORKDIR /rails 0.0s
=> CACHED [base 3/3] RUN gem update --system --no-document && gem install -N bundler -v 2.4.6 0.0s
=> CACHED [build 1/10] RUN apt-get update -qq && apt-get install --no-install-recommends -y build-essential curl libpq-dev libvips node-gyp pkg-config python-is-python3 unzip 0.0s
=> CACHED [build 2/10] RUN curl -fsSL https://fnm.vercel.app/install | bash && /root/.local/share/fnm/fnm install 16.0.0 0.0s
=> CACHED [build 3/10] RUN npm install -g yarn@1.22.19 0.0s
=> CACHED [build 4/10] COPY Gemfile Gemfile.lock ./ 0.0s
=> CACHED [build 5/10] RUN bundle 2.4.6 install && bundle exec bootsnap precompile --gemfile 0.0s
=> CACHED [build 6/10] COPY package.json yarn.lock . 0.0s
=> CACHED [build 7/10] RUN yarn install 0.0s
=> [build 8/10] COPY . . 11.4s
=> [build 9/10] RUN bundle exec bootsnap precompile app/ lib/ 0.9s
=> [build 10/10] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile 22.9s
=> CACHED [stage-2 1/3] RUN apt-get update -qq && apt-get install --no-install-recommends -y imagemagick libvips postgresql-client && rm -rf /var/lib/apt/lists /var/cache/apt/archives 0.0s
=> CACHED [stage-2 2/3] RUN useradd rails 0.0s
=> [stage-2 3/3] COPY --from=build --chown=rails:rails /rails /rails 15.4s
=> exporting to image 31.0s
=> => exporting layers 31.0s
=> => writing image sha256:d6312e933ca2c71a4c92a9cb1dc9ed8f1711150982f3c75239a7b77b105af2e1 0.0s
=> => naming to registry.fly.io/clip-scroll:deployment-01H51JTRX8E7TY5WDMRRZVVYHT 0.0s
→ Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/clip-scroll]
33542ce339a3: Pushed
78e9add73338: Layer already exists
0d48e135a88e: Layer already exists
b3338817505c: Layer already exists
f4bb71bc81c0: Layer already exists
f0fc506f7982: Layer already exists
46cf0e48c979: Layer already exists
c3e35b2afb23: Layer already exists
b7fcac299347: Layer already exists
ec4a38999118: Layer already exists
deployment-01H51JTRX8E7TY5WDMRRZVVYHT: digest: sha256:b215d638905814c25bb5d6f97ad5b5a83d593a4cead176dfcce098344036c12d size: 2418
→ Pushing image done
image: registry.fly.io/clip-scroll:deployment-01H51JTRX8E7TY5WDMRRZVVYHT
image size: 7.0 GB
Watch your app at Sign In · Fly
Updating existing machines in ‘clip-scroll’ with rolling strategy
Machine 328762da610385 [app] has state: started
[1/1] Checking that 328762da610385 [app] is up and running
Smoke checks for 328762da610385 failed: the app appears to be crashing
Check its logs: here’s the last lines below, or run ‘fly logs -i 328762da610385’:
from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/application.rb:391:in initialize!' from /rails/config/environment.rb:5:in
’
from config.ru:3:in require_relative' from config.ru:3:in
block in ’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/builder.rb:116:in eval' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/builder.rb:116:in
new_from_string’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/builder.rb:105:in load_file' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/builder.rb:66:in
parse_file’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:349:in build_app_and_options_from_config' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:249:in
app’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:422:in wrapped_app' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:312:in
block in start’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:379:in handle_profiling' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:311:in
start’
from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/commands/server/server_command.rb:39:in start' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/commands/server/server_command.rb:144:in
block in perform’
from internal:kernel:90:in tap' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/commands/server/server_command.rb:135:in
perform’
from /rails/vendor/bundle/ruby/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in run' from /rails/vendor/bundle/ruby/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in
invoke_command’
from /rails/vendor/bundle/ruby/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in dispatch' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/command/base.rb:69:in
perform’
from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/command.rb:48:in invoke' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/commands.rb:18:in
’
from internal:/usr/local/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb:37:in require' from <internal:/usr/local/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in
require’
from /rails/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require' from /rails/bin/rails:5:in
’
INFO Main child exited normally with code: 1
INFO Starting clean up.
WARN hallpass exited, pid: 232, status: signal: 15 (SIGTERM)
2023/07/11 04:49:28 listening on [fdaa:1:3a4a:a7b:7d18:76bb:7c79:2]:22 (DNS: [fdaa::3]:53)
[ 3.136791] reboot: Restarting system
machine did not have a restart policy, defaulting to restart
INFO Starting init (commit: 762cb27)…
INFO starting statics vsock server
INFO Preparing to run: /rails/bin/docker-entrypoint ./bin/rails server
as rails
INFO [fly api proxy] listening at /.fly/api
2023/07/11 04:49:30 listening on [fdaa:1:3a4a:a7b:7d18:76bb:7c79:2]:22 (DNS: [fdaa::3]:53)
=> Booting Puma
=> Rails 6.1.7.2 application starting in production
=> Run bin/rails server --help
for more startup options
Exiting
/rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/application.rb:603:in validate_secret_key_base': Missing
secret_key_basefor 'production' environment, set this string with
bin/rails credentials:edit(ArgumentError) from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/application.rb:437:in
secret_key_base’
from /rails/vendor/bundle/ruby/3.1.0/gems/devise-4.9.0/lib/devise/secret_key_finder.rb:24:in key_exists?' from /rails/vendor/bundle/ruby/3.1.0/gems/devise-4.9.0/lib/devise/secret_key_finder.rb:16:in
find’
from /rails/vendor/bundle/ruby/3.1.0/gems/devise-4.9.0/lib/devise/rails.rb:37:in block in <class:Engine>' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:32:in
instance_exec’
from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:32:in run' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:61:in
block in run_initializers’
from /usr/local/lib/ruby/3.1.0/tsort.rb:228:in block in tsort_each' from /usr/local/lib/ruby/3.1.0/tsort.rb:350:in
block (2 levels) in each_strongly_connected_component’
from /usr/local/lib/ruby/3.1.0/tsort.rb:431:in each_strongly_connected_component_from' from /usr/local/lib/ruby/3.1.0/tsort.rb:349:in
block in each_strongly_connected_component’
from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in each' from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in
call’
from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in each_strongly_connected_component' from /usr/local/lib/ruby/3.1.0/tsort.rb:226:in
tsort_each’
from /usr/local/lib/ruby/3.1.0/tsort.rb:205:in tsort_each' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:60:in
run_initializers’
from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/application.rb:391:in initialize!' from /rails/config/environment.rb:5:in
’
from config.ru:3:in require_relative' from config.ru:3:in
block in ’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/builder.rb:116:in eval' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/builder.rb:116:in
new_from_string’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/builder.rb:105:in load_file' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/builder.rb:66:in
parse_file’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:349:in build_app_and_options_from_config' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:249:in
app’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:422:in wrapped_app' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:312:in
block in start’
from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:379:in handle_profiling' from /rails/vendor/bundle/ruby/3.1.0/gems/rack-2.2.6.2/lib/rack/server.rb:311:in
start’
from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/commands/server/server_command.rb:39:in start' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/commands/server/server_command.rb:144:in
block in perform’
from internal:kernel:90:in tap' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/commands/server/server_command.rb:135:in
perform’
from /rails/vendor/bundle/ruby/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in run' from /rails/vendor/bundle/ruby/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in
invoke_command’
from /rails/vendor/bundle/ruby/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in dispatch' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/command/base.rb:69:in
perform’
from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/command.rb:48:in invoke' from /rails/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.2/lib/rails/commands.rb:18:in
’
from internal:/usr/local/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb:37:in require' from <internal:/usr/local/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in
require’
from /rails/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require' from /rails/bin/rails:5:in
’
INFO Main child exited normally with code: 1
INFO Starting clean up.
WARN hallpass exited, pid: 232, status: signal: 15 (SIGTERM)
2023/07/11 04:49:32 listening on [fdaa:1:3a4a:a7b:7d18:76bb:7c79:2]:22 (DNS: [fdaa::3]:53)
[ 3.137628] reboot: Restarting system
machine did not have a restart policy, defaulting to restart
INFO Starting init (commit: 762cb27)…
INFO starting statics vsock server
INFO Preparing to run: /rails/bin/docker-entrypoint ./bin/rails server
as rails
INFO [fly api proxy] listening at /.fly/api
2023/07/11 04:49:33 listening on [fdaa:1:3a4a:a7b:7d18:76bb:7c79:2]:22 (DNS: [fdaa::3]:53)
Error: smoke checks for 328762da610385 failed: the app appears to be crashing