Moby & The Beanstalk

C65d18a43152b199ee94aad2b79b70c4?s=47 Seb
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.

C65d18a43152b199ee94aad2b79b70c4?s=128

Seb

July 31, 2015
Tweet

Transcript

  1. 2.

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

    developer since 2011 » Docker enthusiast " » elbaschid on the interwebz
  2. 8.
  3. 23.

    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'), } }
  4. 26.

    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'
  5. 28.

    Ephermal Systems » No persistent storage » Use cloud storage

    solutions » Easy to set up with Django apps
  6. 29.

    For File Uploads » We use S3 for storage »

    Django app: django-storages » Uses boto under the hood
  7. 30.

    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'
  8. 31.

    For Static Files » With django-storages » As easy as

    adding a setting # settings.py STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
  9. 33.

    The Way We Do It » Bake static files into

    images » Mount to the EC2 host » Update files on container startup » Serve via nginx
  10. 35.

    Logging » Log files stored on EC2 » Aggregated on

    request (manually) » No syslog support Solution » Forward to central log server » Use gliderlabs/logspout
  11. 36.

    Monitoring » Limited info available » Separated by environment »

    No customization Solution » Use external service (e.g. DataDog) » Run DataDog/docker-dd-agent
  12. 37.

    DB Schema Changes » Unsolved Problem (for us) » Automatically

    migrating is problematic » Requires development strategy Recommended Read The Path To Smoother Migrations Nathan Duthoit
  13. 38.
  14. 42.

    Final Thoughts » Great improvement for us » Still issues

    with Beanstalk » Docker is extremely young