Hello, I’m trying to move one of my older Ruby on Rails projects from Heroku to Fly.io but I’m coming across the same error every time I try to deploy:
The log reveals the issue: Unable to locate package python-is-python3
Do you need the python-is-python3 package? If not, try remove it from your apt-get install command. If you do need it, maybe try performing the symlink manually.
Further background in case anybody is interested. ruby-slim docker hub images are based on Debian. The node build process uses Python. The name of the package installing python changed from the Buster release of Debian to the Bullseye release. I analyzed the Dockerhub images for Ruby 2.7.0+ to see where the cutover happened. I didn’t include 2.6 in my analysis.
If you upgrade to 2.6.8, you can use ruby:2.6.8-bullseye as the base. Or you can keep with 2.6.6 and change python-is-python3 to simply python.
The updated dockerfile generator will do the latter.
Thank you for your quick reply! I did the following steps:
Ran this code:
bundle update
bin/rails generate dockerfile
Changed python-is-python3 to simply python in the dockerfile.
These definitely made a positive difference when I tried to deploy again, but now running into a new issue. Here are the logs:
$ fly logs -a campq
Waiting for logs...
2023-02-15T12:50:35.900 app[582096d7] nrt [info] Preparing to run: `/rails/bin/docker-entrypoint ./bin/rails server` as root
2023-02-15T12:50:35.917 app[582096d7] nrt [info] 2023/02/15 12:50:35 listening on [fdaa:1:4a78:a7b:b4f1:5820:96d7:2]:22 (DNS: [fdaa::3]:53)
2023-02-15T12:50:37.387 app[582096d7] nrt [info] rails aborted!
2023-02-15T12:50:37.387 app[582096d7] nrt [info] ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `rails credentials:edit`
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/application.rb:588:in `validate_secret_key_base'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/application.rb:423:in `secret_key_base'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/devise-4.8.0/lib/devise/secret_key_finder.rb:24:in `key_exists?'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/devise-4.8.0/lib/devise/secret_key_finder.rb:16:in `find'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/devise-4.8.0/lib/devise/rails.rb:37:in `block in <class:Engine>'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/initializable.rb:32:in `instance_exec'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/initializable.rb:32:in `run'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/initializable.rb:61:in `block in run_initializers'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/initializable.rb:60:in `run_initializers'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/application.rb:363:in `initialize!'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/config/environment.rb:5:in `<main>'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.4/lib/active_support/dependencies.rb:324:in `block in require'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.4/lib/active_support/dependencies.rb:291:in `load_dependency'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.4/lib/active_support/dependencies.rb:324:in `require'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/application.rb:339:in `require_environment!'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/application.rb:523:in `block in run_tasks_blocks'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/commands/rake/rake_command.rb:20:in `perform'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/command.rb:48:in `invoke'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/commands.rb:18:in `<main>'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] ./bin/rails:9:in `<main>'
2023-02-15T12:50:37.387 app[582096d7] nrt [info] Tasks: TOP => db:prepare => db:load_config => environment
2023-02-15T12:50:37.387 app[582096d7] nrt [info] (See full trace by running task with --trace)
2023-02-15T12:50:37.854 app[582096d7] nrt [info] => Booting Puma
2023-02-15T12:50:37.854 app[582096d7] nrt [info] => Rails 6.0.4 application starting in production
2023-02-15T12:50:37.854 app[582096d7] nrt [info] => Run `rails server --help` for more startup options
2023-02-15T12:50:37.895 app[582096d7] nrt [info] Exiting
2023-02-15T12:50:37.895 app[582096d7] nrt [info] /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/application.rb:588:in `validate_secret_key_base': Missing `secret_key_base` for 'production' environment, set this string with `rails credentials:edit` (ArgumentError)
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/application.rb:423:in `secret_key_base'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/devise-4.8.0/lib/devise/secret_key_finder.rb:24:in `key_exists?'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/devise-4.8.0/lib/devise/secret_key_finder.rb:16:in `find'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/devise-4.8.0/lib/devise/rails.rb:37:in `block in <class:Engine>'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/initializable.rb:32:in `instance_exec'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/initializable.rb:32:in `run'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/initializable.rb:61:in `block in run_initializers'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /usr/local/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /usr/local/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /usr/local/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /usr/local/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `call'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /usr/local/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /usr/local/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/initializable.rb:60:in `run_initializers'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/application.rb:363:in `initialize!'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/config/environment.rb:5:in `<main>'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' require_with_bootsnap_lfi'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.4/lib/active_support/dependencies.rb:324:in `block in require'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.4/lib/active_support/dependencies.rb:291:in `load_dependency'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.4/lib/active_support/dependencies.rb:324:in `require'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from config.ru:3:in `block in <main>'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_a
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_a d_options_from_config'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:312:in `block in sta
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:312:in `block in sta t'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:379:in `handle_profiling'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/server.rb:311:in `start'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/commands/server/server_command.rb:39:in `start'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/commands/server/server_command.rb:147:in `block in perform'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/commands/server/server_command.rb:138:in `tap'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/commands/server/server_command.rb:138:in `perform'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/command/base.rb:69:in `perform'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/command.rb:46:in `invoke'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/railties-6.0.4/lib/rails/commands.rb:18:in `<main>'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
2023-02-15T12:50:37.896 app[582096d7] nrt [info] from /rails/bin/rails:9:in `<main>'
2023-02-15T12:50:37.911 app[582096d7] nrt [info] Starting clean up.
I see that the 4th log in the list says ArgumentError: Missing secret_key_basefor 'production' environment, set this string withrails credentials:edit``. So is this new problem stemming from me not setting up secret keys and env variables yet?
Thank you for your reply. Apologies, this might be a silly question but I couldn’t find the answer after some searching - where do I find the “SECRET_KEY_BASE”? Or do I set a random value myself?
For Rails 5.2 applications onward, SECRET_KEY_BASE is encrypted and stored in config/credentials.yml.enc. What you want to do is to copy over the RAILS_MASTER_KEY from heroku:
For many applications, the secret key is the only secret stored in config/credentials.yml.enc. If so, you can generate a new one by deleting that file and then running:
bin/rails credentials:edit
Check your source code for Rails.application.credentials to see if you are using any other credentials.
Unfortunately, heroku config -s | grep -v -e "RAILS_MASTER_KEY" | fly secrets import returned the same error as previously:
➜ CampQ git:(master) heroku config -s | grep -v -e "RAILS_MASTER_KEY" | fly secrets import
Update available 0.0.456 -> 0.0.457.
Run "fly version update" to upgrade.
› Error: Missing required flag:
› -a, --app APP app to run command against
› See more help with --help
Error requires at least one SECRET=VALUE pair
As I just mentioned in another response, could this be because Heroku was not set up by myself, but by another person?
I suppose that most likely heroku config -s should be run in your application folder or you can replace it with heroku config -a <application_name> -s.