Slides from a talk given at Python Ireland July 2015: http://www.meetup.com/pythonireland/events/221222978/
This talk will give a brief introduction to a potential stack for building and deploying a Django app onto a Mesos cluster. It's ideal for anyone who has a little bit of experience trying to manage more than a couple of machines.
This talk will cover Mesos, Aurora, Django, CircleCI and anything else Michael can squeeze into a 30 minute talk.
2. Who is this talk for?
• The curious
• Folks who look after more than a handful of
machines and services
• You have a "platform team" or "devops" (what
does that even mean?)
• Get woken at 3am to fix things
5. Precious snowflake boxes
• Lots of different machines (web-01, redis-03,
dont-delete-web-99, memcached4)
• No one remembers who or how the celery
box was setup but we can't build a new one
• My fabric scripts need unit tests
• I really want to try that new framework but that
means finding a box, I know that web server
doesn't have much traffic...
• Sod it, lets use Heroku!
18. Aurora
• Transactional deployments
• Process management
• Scaling
• Mix production and development
• "Cron" jobs
• Did I mention transactional deployments
20. I mean, really simple
def index(request):
version = 3
html = ("<html><body>"
"<h1>Hello</h1>"
"<p>What do you want to learn today?</p>"
"<p>Version {}</p></body></html>").format(version)
return HttpResponse(html)
def healthcheck(request):
return JsonResponse({"ok": True})
31. Side note: resources
Resources(cpu = 1, ram = 100*MB, disk=100*MB)
• Asks for a Mesos slave which can give a
logical core, 100MB of RAM and 100MB of
disk.
• Runs in container and restricts to these
resources
• e.g. kills your process if it starts spewing
data to disk
• CPU scheduler restricts run time
35. Scaling up
instances = 10
aurora update start
devcluster/www-data/devel/acaversity
acaversity.aurora
Question: What does it do with the old intances?
36. Cron Jobs
jobs = [
Job(
cluster = 'devcluster',
role = 'www-data',
environment = 'test',
name = 'cron_hello_world',
cron_schedule = '*/5 * * * *',
task = SimpleTask(
'cron_hello_world',
'echo "Hello world from cron"'),
),
]