A cronjob generated on a Ubuntu 20 server by the whenever
gem is failing, as the log registers:
PG::ConnectionBad: FATAL: Peer authentication failed for user "*name_of_application*"
The database.yml file defines
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
The application handles all migrations, records creations, updates, etc. as expected, so the connection with PG is proper. However, it seems the whenever gem wants to connect as user name_of_application
Following the documentation and inline help, I ran
bundle exec whenever --user *name_of_linux_user*
to no avail.
The schedule.rb
is as follows:
env :PATH, ENV['PATH']
job_type :rbenv_rake, %Q{export PATH=/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:/usr/bin:$PATH; eval "$(rbenv init -)"; \
cd :path && :environment_variable=:environment :bundle_command rake :task --silent :output }
job_type :rbenv_runner, %Q{export PATH=/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:/usr/bin:$PATH; eval "$(rbenv init -)"; \
cd :path && :bundle_command :runner_command -e :environment ':task' :output }
every 1.day, :at => '00:22 am' do
rake "cleanup:promos", :output => "log/sweep_log.log"
end
Why is whenever
defaulting to the application's name and how should this be corrected?