Wednesday, May 1, 2019

architecture for Blue/Green deployments

My organization is moving into the AWS cloud, and with some other projects using MongoDB, ElasticSearch and a web application framework that is not Django, we've had no problem.

I'm our "Systems/Applications Architect", and some years ago I helped choose Django over some other solutions.   I stand by that as correct for us, but our Cloud guys want to know how to do Blue/Green deployments, and the more I look at it the less happy I am.

Here's the problem:
  • Django's ORM has long shielded developers from simple SQL problems like "SELECT * FROM fubar ..." and "INSERT INTO fubar VALUES (...)" sorts of problems.
  • However, if an existing "Blue" deployment knows about a column, it will try to retrieve it:
    • fubar = Fubar.objects.get(name='Samwise') 
  • If a new "Green" deployment is coming up, and we want to wait until Selenium testing has passed, we have the problem of migrations
I really don't see any simple way around a new database cluster/instance when we bring up a new cluster, with something like this:
  • Mark the live database as "in maintenance mode".    The application now will not write to the database, but we can also make that user's access read/only to preserve this.
  • Take a snapshot
  • Restore the snapshot to build the new database instance/cluster.
  • Make the new database as "live", e.g. clear "maintenance mode".   If t he webapp user is read-only, they are restored to full read/write permissions.
  • Run migrations in production
  • Bring up new auto-scaling group
Of course, some things that Django does really help:
  • The database migration is first tested by the test process, which runs migrations
  • The unit tests have succeeded before we try to do this migration.

Does anyone have experience/cloud operations design with doing Bluegreen deployments with Django?

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ae5310c6-b69f-43af-a838-5dce7bd6a712%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment