Re:The architecture behind a one-person tech startup
by kparaju on Thursday April 08, 2021 @12:58PM
(#26741142)
You could probably do something like (for django):
python manage.py migrate
on pod startup. If there are no changes, it'll do nothing. If there are changes, it'll do the migration.
Re:The architecture behind a one-person tech startup
by ogjunkyard on Thursday April 08, 2021 @02:36PM
(#26742172)
Yeah, it's basically this. I'm running this as an initContainer for my K8s-based deployments. Took me a bit to get everything going, but my stack is pretty much similar to OP's article, although not quite as advanced in the automated-deployment of containers and monitoring. I'm not at a position where usage needs heavy monitoring because I'm still in the pre-launch phase of things and I'm using this side project to learn stuff I've yet to get experience with at multiple companies.
Re:The architecture behind a one-person tech startup
by rkwz on Thursday April 08, 2021 @10:19AM
(#26738991)
You can use any normal DB migration tool. For k8s, I put the app's readiness probe to false, run the migrations and then toggle the probe back to true.
Here are some migration libraries:
Re:The architecture behind a one-person tech startup
by slt2021 on Thursday April 08, 2021 @02:21PM
(#26742025)
I wonder what happens during blue green or canary deployment?
if your migration changes database schema in a way that affect previous version negatively?
is it even possible to do blue/green deploy if your schema changes radically?
Re:The architecture behind a one-person tech startup
by rkwz on Thursday April 08, 2021 @08:13PM
(#26745356)
It's definitely possible but we need to spend sometime to make sure the changes are backwards compatible and gradually rollout the destructive change.
Here's a really good guide on how to do this - https://docs.gitlab.com/ee/development/avoiding_downtime_in_...
Re:The architecture behind a one-person tech startup
by slt2021 on Friday April 09, 2021 @11:43AM
(#26752005)
thank you very much! this is a treasure find for me
Re:The architecture behind a one-person tech startup
by Mavvie on Friday April 09, 2021 @12:29AM
(#26746735)
It's fine if you make the changes backwards compatible a version. And in general, any change can be done in a backwards compatible way (although it can be a PITA)
Re:The architecture behind a one-person tech startup
by wakatime on Thursday April 08, 2021 @01:19PM
(#26741385)
He's using Django, so most likely Django Migrations which is built into that framework. If you're using Flask, you're probably using Alembic with SQLAlchemy. Those are the two main ways to handle schema migrations in Python.
How do you handle database migrations when using an otherwise automated CI/CD flow with gradual deployment?