Wednesday, February 10, 2016

Re: How to update a live / deployed Django project?

I have been through several variations on what you are doing.  The solution which has worked best for me is to use SaltStack to control the update. 

If you are interested in learning SaltStack, I just recently wrote a step-by-step tutorial on it, targeted for django developers. It walks you through writing a configuration to deploy a django site (with postgres, gunicorn, and nginx) on a local virtual machine and then VPS as well as one way of writing automated tests for the configuration.

If you have feedback on the tutorial or suggestions on how to improve the learner experience, please let me know.

cheers,
Andrew

On Wed, Feb 10, 2016 at 2:10 PM, Vernon D. Cole <vernondcole@gmail.com> wrote:
I have been through several variations on what you are doing.  The solution which has worked best for me is to use SaltStack to control the update.  It will pull your updates using git, apply as needed, and restart your servers. If you are building a new server (for testing or prototype usually) it will install everything. The last time I needed to test a new version of django it took about two hours to build a whole new prototype server on a virtual machine on my laptop.  Version updates on a running server take an eyeblink.

I put an example up on github/salt_demo. It needs some work since two years ago, but should give you the idea. It will run standalone, but I really recommend setting up a Salt master, even if you only have a few machines.  It can can really save you -- for example, I have had times when an ssh daemon quit working, and I was able to regain control using Salt.  The demo uses PostgreSQL -- I will send you my mariadb state if you wish.
--
Vernon Cole


On Wednesday, February 10, 2016 at 1:50:22 AM UTC-7, Tobias Dacoir wrote:
We've build a small web application using Django 1.8 over the past couple of months and we are going live with version 1.0 soon (one last closed beta test is coming up).
So far we have deployed it on an Ubuntu VM (in Azure) using Apache / Nginx and a local MySQL Server.

I've already found some good tutorials on how to properly set it up (http://rogueleaderr.com/post/65157477648/the-idiomatic-guide-to-deploying-django-in#disqus_thread ) however what I am mising now is how to handle updates to our code.

For our development server we have a git hook that automatically deploys new commits to the server. However that often requires manual interaction - running manage.py makemigrations etc. Sometimes Django also does not pick up our changed models and we have to manually fiddle with the Database in order to get it back running. We even had times where we lost all our data since it was easier to just start with a new database.

Obviously this can't happen once we are live and obviously we want downtime to be as small as possible. So is there any guide on how to update code of a live, deployed Django application?

--
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/3aeba092-2834-455e-a5e8-0c15be79d245%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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/CA%2By5TLbjkiwEcWPmz4AdQF-GpUduLHyx3SmY%2BTNvZyX--WaAyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment