But the following error occurred when executing GithubActions cron.
rake aborted!
ActiveRecord::NoDatabaseError: We could not find your database: bookrin. Available database configurations can be found in config/database.yml. (ActiveRecord::NoDatabaseError)
To resolve this error:
- Did you not create the database, or did you delete it? To create the database, run:
bin/rails db:create
- Has the database name changed? Verify that config/database.yml contains the correct database name.
/home/runner/work/BookRIn/BookRIn/app/models/reading_circles_client.rb:37:in `block in update_clubs'
/home/runner/work/BookRIn/BookRIn/app/models/reading_circles_client.rb:36:in `each'
/home/runner/work/BookRIn/BookRIn/app/models/reading_circles_client.rb:36:in `update_clubs'
/home/runner/work/BookRIn/BookRIn/app/models/reading_circles_client.rb:19:in `save'
/home/runner/work/BookRIn/BookRIn/lib/tasks/fetch.rake:8:in `block (2 levels) in <top (required)>'
Caused by:
PG::ConnectionBad: could not translate host name "bookrin-db.flycast" to address: Name or service not known (PG::ConnectionBad)
/home/runner/work/BookRIn/BookRIn/app/models/reading_circles_client.rb:37:in `block in update_clubs'
/home/runner/work/BookRIn/BookRIn/app/models/reading_circles_client.rb:36:in `each'
/home/runner/work/BookRIn/BookRIn/app/models/reading_circles_client.rb:36:in `update_clubs'
/home/runner/work/BookRIn/BookRIn/app/models/reading_circles_client.rb:19:in `save'
/home/runner/work/BookRIn/BookRIn/lib/tasks/fetch.rake:8:in `block (2 levels) in <top (required)>'
Tasks: TOP => fetch:reading_clubs
(See full trace by running task with --trace)
Error: Process completed with exit code 1.
I can’t seem to connect to the DB in the form myapp-db.flycast, is there a wrong way to get the DB_URL?
flycast addresses work only in the Fly.io network (or from machines added to Wireguard). An external Github Actions worker won’t be able to connect to your Fly-hosted database via a .flycast address.
Ways to solve this:
Add a public IP address to your Postgres cluster. (Don’t do this! huge security risk)
Generate a Wireguard configuration file and get the Github Actions worker to connect to Wireguard. (Also security risk, you’re allowing an external and possibly untrusted machine into your Fly private network).
Somehow get the process you’re trying to execute, to run inside a Fly machine instead of the Github Actions worker. (this is probably the best option but it might imply some extra work to run the process on a Fly machine and then get the data out / where you need it).