Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Moby & The Beanstalk

July 31, 2015

Moby & The Beanstalk

The popularity of Docker these days is incredible and a lot of people are already using it for their production systems. Although it makes a lot of things much simpler, it's not a silver bullet and comes with some caveats of it's own. This talk will describe the journey of my team at Mobify from a self-hosted VM to a AWS-backed web app deployed using Docker.


July 31, 2015

More Decks by Seb

Other Decks in Technology


  1. About Me » Back-End Engineer @ Mobify ! » Django

    developer since 2011 » Docker enthusiast " » elbaschid on the interwebz
  2. Basic 12-Factor config # settings.py import os SECRET_KEY = os.getenv('SECRET_KEY')

    DATABASES = { 'default': { 'NAME': os.getenv('DB_NAME'), 'HOST': os.getenv('DB_HOST'), 'USER': os.getenv('DB_USER'), 'PASSWORD': os.getenv('DB_PASSWORD'), } }
  3. Example Settings from configurations import values from configurations import Configuration

    class Production(Configuration): SECRET_KEY = values.SecretValue() DATABASES = values.DatabaseURLValue() # shell export DJANGO_SECRET_KEY='the django pony is awesome' export DJANGO_DATABASE_URL='postgres://myuser@localhost/mydb'
  4. Ephermal Systems » No persistent storage » Use cloud storage

    solutions » Easy to set up with Django apps
  5. For File Uploads » We use S3 for storage »

    Django app: django-storages » Uses boto under the hood
  6. Easy To Configure # settings.py INSTALLED_APPS += ['storages'] DEFAULT_FILE_STORAGE =

    'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = 'xxxxxxxx' AWS_SECRET_ACCESS_KEY = 'xxxxxxxx' AWS_STORAGE_BUCKET_NAME = 'mybucket'
  7. For Static Files » With django-storages » As easy as

    adding a setting # settings.py STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
  8. The Way We Do It » Bake static files into

    images » Mount to the EC2 host » Update files on container startup » Serve via nginx
  9. Logging » Log files stored on EC2 » Aggregated on

    request (manually) » No syslog support Solution » Forward to central log server » Use gliderlabs/logspout
  10. Monitoring » Limited info available » Separated by environment »

    No customization Solution » Use external service (e.g. DataDog) » Run DataDog/docker-dd-agent
  11. DB Schema Changes » Unsolved Problem (for us) » Automatically

    migrating is problematic » Requires development strategy Recommended Read The Path To Smoother Migrations Nathan Duthoit
  12. Final Thoughts » Great improvement for us » Still issues

    with Beanstalk » Docker is extremely young