No downtime rolling upgrades with migration

25 views
Skip to first unread message

Sandip Bhattacharya

unread,
Mar 26, 2023, 4:17:58 PM3/26/23
to Django users
New to django, so wanted to ask some questions that I didn’t find good resources for:

1. If you deploy django apps using docker, do you run migrations before launching gunicorn/uwsgi etc within the docker image?

2. If you do, how does rolling migrations work? Won’t the non-upgraded replicas start erroring if the new schema is not backward compatible?

3. How do you do non-backward compatible schema upgrades? Do you do it out of band from deployments? Do you shift traffic to a different cluster, and then zero traffic upgrade the whole cluster at once?

Thanks,
Sandip

Damanjeet Singh

unread,
Mar 26, 2023, 4:34:04 PM3/26/23
to django...@googlegroups.com
Hello,

Please read my reply below.

Best of luck.

Regards

On Sun, 26 Mar 2023, 21:17 Sandip Bhattacharya, <san...@showmethesource.org> wrote:
New to django, so wanted to ask some questions that I didn’t find good resources for:

1. If you deploy django apps using docker, do you run migrations before launching gunicorn/uwsgi etc within the docker image?
Daman:This is all upto you. Better to do when creating container. As you can also upgrade from git. 

2. If you do, how does rolling migrations work? Won’t the non-upgraded replicas start erroring if the new schema is not backward compatible?
Daman:Create blue green deployment.

3. How do you do non-backward compatible schema upgrades? Do you do it out of band from deployments? Do you shift traffic to a different cluster, and then zero traffic upgrade the whole cluster at once?

Daman: Blue Green deployment can help. You can distribute traffic to old and new. When all stable then move everything. You can use kubernetes with helm.


Thanks,
  Sandip

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/A9719D24-F6DA-45A6-A30A-EA8EA34754A1%40showmethesource.org.

Sandip Bhattacharya

unread,
Mar 26, 2023, 5:33:56 PM3/26/23
to Django users


On Mar 26, 2023, at 4:32 PM, Damanjeet Singh <mailt...@gmail.com> wrote:
3. How do you do non-backward compatible schema upgrades? Do you do it out of band from deployments? Do you shift traffic to a different cluster, and then zero traffic upgrade the whole cluster at once?

Daman: Blue Green deployment can help. You can distribute traffic to old and new. When all stable then move everything. You can use kubernetes with helm.


Do you do blue-green deployments with two different databases? 

- Sandip


Damanjeet Singh

unread,
Mar 26, 2023, 6:48:32 PM3/26/23
to django...@googlegroups.com
Depending on the requirements. Either two different databases or point to one database.

Or
Link one database to master (read and write)

Another database instance to read only.

And you can change Another database to main.

Cheers 


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Sandip Bhattacharya

unread,
Mar 26, 2023, 9:02:01 PM3/26/23
to Django users

On Mar 26, 2023, at 6:47 PM, Damanjeet Singh <mailt...@gmail.com> wrote:

Depending on the requirements. Either two different databases or point to one database.

Or
Link one database to master (read and write)

Another database instance to read only.

And you can change Another database to main.


Thanks for your patience in answering my doubts. But I still have some follow up questions.

If it is the same database, and the migration changes the schema, won’t the older application code instances have the same problem with backward incompatible schema changes?

And if it is two databases, how does it work? If you set the older database to read-only, then traffic on the write path of the older application will break. If you somehow connect the two in sync, won’t the DDL changes on the primary replicate to the other replica as well, again causing the older application to break?

- Sandip
Reply all
Reply to author
Forward
0 new messages