Vagga

@proofit404

Long time ago

  • git clone
  • vagrant up
  • ?
  • profit

Foreman

                        
web: django-admin.py runserver
worker: celery -A foo worker
                        
                    

Not so long ago

  • git clone
  • docker build
  • ?
  • profit

Today

  • git clone
  • ?
  • profit

Vagga

  • development environment
  • no daemons

Containers

                        
containers:
  flask:
    setup:
    - !Ubuntu trusty
    - !UbuntuUniverse
    - !Install [python3-flask]
                        
                    

Commands

                        
commands:
  py3: !Command
    container: flask
    run: python3
                        
                    

Run

                        
$ vagga py3
[ .. snipped container build log .. ]
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
>>> import flask
>>> app = flask.Flask()
                        
                    

Let's use Django

Freeze

                        
containers:
  app-freezer:
    setup:
    - !Alpine 'v3.3'
    - !Py3Install
      - pip
      - 'Django >=1.9,<1.10'
    - !Sh pip freeze > requirements.txt
                        
                    

Environment

                        
containers:
  django:
    setup:
    - !Alpine 'v3.3'
    - !Py3Requirements requirements.txt
                        
                    

Commands

                        
commands:
  runserver: !Command
    description: Django development server
    container: django
    run: python3 manage.py runserver
                        
                    

Run

                        
$ vagga _build app-freezer
$ vagga runserver
                        
                    

Let's use Postgres

Setup database

                        
containers:
  postgres:
    setup:
    - !Ubuntu trusty
    - !Install [postgresql]
                        
                    

Add build dependencies

                        
containers:
  app-freezer:
    setup:
    - !BuildDeps
      - postgresql-dev
    - !Py3Install
      - 'dj-database-url >=0.4,<0.5'
      - 'psycopg2 >=2.6,<2.7'
    - !Sh pip freeze > requirements.txt
                        
                    

Rebuild freezer

                        
$ vagga _build app-freezer
                        
                    

Add dev dependencies

                        
containers:
  django:
    setup:
    - !Alpine 'v3.3'
    - !Install
      - libpq
    - !Py3Requirements requirements.txt

                    

Add management command

                        
commands:
  manage.py: !Command
    container: django
    environ:
      DATABASE_URL: postgresql://...
    run:
    - python3
    - manage.py
                        
                    

Use database

                        
$ vagga manage.py startapp common
$ vagga manage.py makemigrations common
$ vagga manage.py migrate
                        
                    

Today

  • git clone
  • vagga runserver
  • profit

Tomorrow

  • official images
  • python wheels

Thanks!

proofit404@gmail.com