obsidiansystems / rhyolite

BSD 3-Clause "New" or "Revised" License
26 stars 17 forks source link

Question: How should one deploy a new database to production when using beam-automigrate? #209

Open augyg opened 1 year ago

augyg commented 1 year ago

A couple weeks ago I deployed a server where in local development beam automigrate complained about an unsafe edit. I was able to solve this locally by using gargoyle-postgresql /path/to/db but to my knowledge I cannot use gargoyle-postgresql through SSH to interact with the server's database so I ended up using scp to get the database on my local machine, applying edits and then scp-ing the server's db back to the server.

After some trial and error I learned that what worked best was to put the db back to the path specified by withDb and then immediately do the deployment so that nginx+backend-start aren't racing to write to this path, which had caused issues before in previous tries.

Of course this would not work if I had much higher traffic to the site and would need an immediate switchover (eg. new user signs up into db at path that would be replaced by me manually with the edited database).

So is there a better way to do this?

alexfmpe commented 1 year ago

Related, I think: https://github.com/obsidiansystems/beam-automigrate/issues/20