My ruby version is 2.6.6, my mysql version is 8.0.23, my mysql2 version is 0.5.3, my bundler version is 2.2.21, my rails version is 5.0.7.2, and my Xcode version is 12.5.
I use macOS Big Sur(version 11.4) and the text editor "Atom".
My Heroku application doesn't work on the Heroku URL, because the following errors was displayed on the URL.
An unhandled lowlevel error occurred. The application logs may have details.
My config/secrets.yml file is something like belows.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
I set up three environment variables as follows:
$ heroku config:set DATABASE_USERNAME=****
$ heroku config:set DATABASE_PASSWORD=****
$ heroku config:set SECRET_KEY_BASE="$(bundle exec rake secret)"
I added the following to the Gemfile.
gem 'heroku_secrets', github: 'alexpeattie/heroku_secrets'
I ran the following command.
$ bundle install --without production
Your /Users/****/.bundle/config config includes `BUNDLE_--LOCAK`, which contains the dash character (`-`).
This is deprecated, because configuration through `ENV` should be possible, but `ENV`keys cannot include dashes.
Please edit /Users/****/.bundle/config and replace any dashes in configuration keys with a triple underscore (`___`).
[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local without 'production'`, and stop using this flag
・・・
Bundle complete! 19 Gemfile dependencies, 69 gems now installed.
Gems in the group 'production' were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
And then I ran the following command.
$ bundle exec rake heroku:secrets[APP_NAME] RAILS_ENV=production
Your /Users/****/.bundle/config config includes `BUNDLE_--LOCAK`, which contains the dash character (`-`).
This is deprecated, because configuration through `ENV` should be possible, but `ENV`keys cannot include dashes.
Please edit /Users/****/.bundle/config and replace any dashes in configuration keys with a triple underscore (`___`).
[DEPRECATED] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` (called at /Users/****/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/bundler/gems/heroku_secrets-****/lib/heroku_secrets/tasks
.rb:28)
rake aborted!
Don't know how to build task '[APP_NAME]' (See the list of available tasks with `rake --tasks`)
/Users/****/.rbenv/versions/2.6.6/bin/bundle:23:in `load'
/Users/****/.rbenv/versions/2.6.6/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
I deployed code to Heroku as belows.
$ git push heroku main
・・・
remote: ###### WARNING:
remote:
remote: You have not declared a Ruby version in your Gemfile.
remote:
remote: To declare a Ruby version add this line to your Gemfile:
remote:
remote: ```
remote: ruby "2.6.6"
remote: ```
remote:
remote: For more information see:
remote: https://devcenter.heroku.com/articles/ruby-versions
remote:
remote: ###### WARNING:
remote:
remote: There is a more recent Ruby version available for you to us
remote:
remote:
remote: 2.6.8
remote:
remote: The latest version will include security and bug fixes. We
always recommend
remote: running the latest version of your minor release.
remote:
remote: Please upgrade your Ruby version.
remote:
remote: For all available Ruby versions see:
remote: https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:
remote: ###### WARNING:
remote:
remote: No Procfile detected, using the default web server.
remote: We recommend explicitly declaring how to boot your server process via a Procfile.
remote: https://devcenter.heroku.com/articles/ruby-default-web-server
remote:
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> console, rake, web
remote:
remote: -----> Compressing...
remote: Done: 44.2M
remote: -----> Launching...
remote: Released v10
remote: https://[APP_NAME].herokuapp.com/ deployed
to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/[APP_NAME].git
5963057..b503389 main -> main
I ran the following command.
$ git push heroku main
Everything up-to-date
I ran the following command.
$ heroku config
===[APP_NAME] Config Vars
DATABASE_PASSWORD: ****
DATABASE_URL: postgres://****
DATABASE_USERNAME: ****
LANG: en_US.UTF-8
RACK_ENV: production
RAILS_ENV: production
RAILS_LOG_TO_STDOUT: enabled
RAILS_SERVE_STATIC_FILES: enabled
SECRET_KEY_BASE: ****
_SECRET_SECRET_KEY_BASE:
_SECRET_SECRET_TOKEN:
I ran the following command.
$ heroku config:unset _SECRET_SECRET_KEY_BASE _SECRET_SECRET_TOKEN
Unsetting _SECRET_SECRET_KEY_BASE, _SECRET_SECRET_TOKEN and restarting ⬢ [APP_NAME]... done, v11
I ran the following command.
$ heroku config
=== [APP_NAME] Config Vars
DATABASE_PASSWORD: ****
DATABASE_URL: postgres://****
DATABASE_USERNAME: ****
LANG: en_US.UTF-8
RACK_ENV: production
RAILS_ENV: production
RAILS_LOG_TO_STDOUT: enabled
RAILS_SERVE_STATIC_FILES: enabled
SECRET_KEY_BASE: ****
I ran the following command.
$ heroku open
But my Heroku application doesn't work on the Heroku URL, because the following errors was displayed on the URL.
An unhandled lowlevel error occurred. The application logs may have details.
The following error occured if I ran the command $ heroku logs.
#<RuntimeError: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`>
But I don't know how server I login to, what the file '$ vi /etc/profile' is, even if I want to resolve the error '#<RuntimeError: Missing secret_key_base...' according to the 1st answer of the Q&A(Demi Magus's answer) of the below URL.
How to solve error "Missing `secret_key_base` for 'production' environment" (Rails 4.1)
Would you like to tell me the reason why my Heroku application doesn't work on Heroku URL?