Hey
Maybe I’ve missed something but I encountered a weird behavior: adding a reading replica to an existing app creates a brand new database (and proxying the Postgres app actually points to the “old” db)
Here is what I did: I have a Rails app that I’m running based on the regular flyctl launch
etc. It works fine and it has the DATABASE_URL
env. var set.
Now, following this guide, this is what I did:
- Added a volume
- Scaled out the Postgres app
- Run
fly attach --postgres-app
command
Here is when things got interesting: The command complained that a DATABASE_URL
was already in place and I couldn’t do that, so I set the database url to a new env. var called DB_URL
and updated my database.yml
to use DB_URL
.
To my surprise, upon deploying, I saw the migrations running all over and suddenly I had a brand new DB!
This is not expected I think and what is strange is that I can’t see the new DB anywhere. Proxying the Postgres app with flyctl proxy 5433 -a my_postgres_app
shows me the old.
Two questions: what happened and how can I avoid/revert it?