[python-uk] Suggestions / best practices for deployment

Harry Percival harry.percival at gmail.com
Thu May 16 10:02:07 CEST 2013


Hi everyone, thanks for  some helpful thoughts!

@Tim, thanks for pointing out the distinction between provisioning and
deployment, I think that's helped to clarify things in my head a little...

@Alfredo, @Kris, and anyone else that's curious, you can already buy/read
the book, plug plug.  I'm 6 chapters in and the 7th is the one on
deployment which I'm writing now... www.obeythetestinggoat.com

@Andy, I am in London, thanks for the invite, will drop you a line.

Thanks everyone for the suggestions re: salt and zc.buildout, definitely
want to check those out, I think they may be overkill for this stage in the
book.  Cuisine actually looks pretty cool too, might be just the kind of
lightweight wrapper over fabric that we could use at work (currently ~4000
lines of code based on fabric currently in the deploys folder of the
codebase for PythonAnywhere!)

Overall, it's both reassuring and depressing to hear that that there's no
single accepted way to do it!

For my use case, I think it comes down to keeping things as simple as
possible.  I don't have to sort out all of the complexities of deployment,
or even most of them. This is an early chapter, and I can come back and
introduce more subtlety later.

For the sake of argument, I'll pick a hosting solution -- say AWS, or
whichever VPS.  And let's say also that you're using Apache. There's a lot
of it around.

We then start with "provisioning" -- that's getting a server up and running
with Apache installed.  Let's say that's something you don't automate, for
now.

Moving onto "deployment", that could cover:
- uploading / updating your source code on the server
- writing (or overwriting) the apache httpd.conf / sites-available entry
- making sure you're hooked up to the (right) database
- checking static files are working.

That sounds like a couple of fairly simple fabric scripts, and a simple set
of functional tests for checking  static files and database work (and that
you haven't killed any old data).  You can do a deploy to staging, run your
tests, and then have confidence that your deploy to live will be fine.

I'm not sure if I want to bring in virtualenvs at this stage.  If the
assumption is that things are on the same server, testing staging means you
can be sure live will work.  Of course, the day you need to upgrade a
package, you have to switch to using virtualenvs, but that's something I
could bring in later in the book.

OTOH, if I want to acknowledge the fact that most people would be better
off using Heroku or PythonAnywere or one of the other PaaSes, maybe I
should mention virtualenvs, because they're a bit of a sine qua non...


hmmm

hp

PS - loving the new gmail "switch to pop-over" feature for email replies to
this thread...



On 15 May 2013 14:10, E Hartley <ed.hartley at gmail.com> wrote:

> One point that's worth mentioning in this context:
> If you rely on building native libraries for custom Python packages of
> your own or those created by third parties consider avoiding the automatic
> systems that do security updates in the background.
> We had a sysadmin at point who insisted on this and had a series of
> package breakages as the library dependencies broke.
> HTH
> Ed
>
>  E Hartley
> ed.hartley at gmail.com
>
>
>
>
>
> On 15 May 2013, at 10:57, Harry Percival <harry.percival at gmail.com> wrote:
>
> Dear UK Python chums,
>
> some of you probably know I'm writing a book about TDD for O'Reilly.  I'm
> looking for some help with the (first) chapter on deployment.
>
> http://www.obeythetestinggoat.com/what-to-say-about-deployment.html
>
> What do you use for deployment?  Do you have any kind of automated
> scripts? How do you manage virtualenvs, the database, apache/uwsgi
> config... What do you think might work as a sort of "best practice lite"
> for a simple site for beginners?  (django, sqlite database, static files)
>
> --
> ------------------------------
> Harry J.W. Percival
> ------------------------------
> Twitter: @hjwp
> Mobile:  +44 (0) 78877 02511
> Skype:         harry.percival
> _______________________________________________
> python-uk mailing list
> python-uk at python.org
> http://mail.python.org/mailman/listinfo/python-uk
>
>
>
> _______________________________________________
> python-uk mailing list
> python-uk at python.org
> http://mail.python.org/mailman/listinfo/python-uk
>
>


-- 
------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile:  +44 (0) 78877 02511
Skype:         harry.percival
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-uk/attachments/20130516/f07b2c7c/attachment.html>


More information about the python-uk mailing list