4. Run tests often
Preferably on every commit
In a clean environment
Pull requests testing
Status Images
Hosted Continuous IntegrationHosted Continuous Integration
7. What is DockerWhat is Docker
At very basic level, think lightweight VM
Docker is an open platform for developing, shipping, and running
applications.
Run any application securely isolated in a container.
Open Source engine to commoditize LXC
Written in Go, runs as a daemon, comes with a CLI
Full REST API
Allows to build images in standard, reproducible way
Allows to share images
More infoMore info
8. Running a ContainerRunning a Container
$ docker run -d --name omaha -p 9090:9090 crystalnix/omaha-server
Pulls the api image: Docker checks for the presence of the omaha-server image
and, if it doesn't exist locally on the host, then Docker downloads it from docker
registry. If the image already exists, then Docker uses it for the new container.
Creates a new container: Once Docker has the image, it uses it to create a
container.
Allocates a filesystem and mounts a read-write layer: The container is created
in the file system and a read-write layer is added to the image.
Allocates a network / bridge interface: Creates a network interface that allows
the Docker container to talk to the local host.
Sets up an IP address: Finds and attaches an available IP address from a pool.
Executes a process that you specify: Runs omaha-server application
Captures and provides application output: Connects and logs standard input,
outputs and errors for you to see how your application is running.
9. Managing a ContainerManaging a Container
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED
a254c3d91bab omahaserver_web:latest "paver docker_run pa Up 5 minutes
STATUS PORTS NAMES
Up 5 minutes 0.0.0.0:9090->80/tcp omaha
$ docker stop omaha
$ docker start omaha
$ docker restart omaha
$ docker logs omaha
---> pavement.docker_run
---> pavement.migrate
./manage.py migrate --noinput
Operations to perform:
Synchronize unmigrated apps: django_filters, djangobower, cacheops, django_select2, suit, django_
Apply all migrations: crash, omaha, sessions, admin, auth, sparkle, contenttypes
Synchronizing apps without migrations:
Creating tables...
Installing custom SQL...
Installing indexes...
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to app
---> pavement.loaddata
./manage.py loaddata fixtures/initial_data.json
Installed 5 object(s) from 1 fixture(s)
---> pavement.create_admin
./createadmin.py
10. Docker ImagesDocker Images
Docker images are the build component of Docker.
A Docker image is a read-only template.
Images are used to create Docker containers.
Docker provides a simple way to build new images or update
existing images, or you can download Docker images that other
people have already created.
Each image consists of a series of layers. Docker makes use of
union file systems to combine these layers into a single image.
When you change a Docker image – for example, update an
application to a new version – a new layer gets built.
11. Docker RegistriesDocker Registries
Docker registries are the distribution component of Docker.
Docker registries hold images.
These are public or private stores from which you upload or
download images.
The public Docker registry is called . It provides a
huge collection of existing images for your use.
Docker Hub
12. Docker ContainersDocker Containers
Docker containers are the run component of Docker.
A Docker container holds everything that is needed for an
application to run.
Each container is created from a Docker image.
The Docker image is read-only. When Docker runs a container
from an image, it adds a read-write layer on top of the image in
which your application can then run.
Docker containers can be run, started, stopped, moved, and
deleted.
13. FROM ubuntu:14.04.1
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y python-pip python-lxml python-psycopg2 uwsgi supervisor
RUN apt-get install -y uwsgi-plugin-python
RUN apt-get install -y nginx
# install s3fs
RUN apt-get install -y build-essential libfuse-dev libfuse-dev libfuse-dev mime-support
RUN apt-get clean
RUN wget https://github.com/s3fs-fuse/s3fs-fuse/archive/v1.78.tar.gz -O /usr/src/v1.78.tar.gz
RUN tar xvz -C /usr/src -f /usr/src/v1.78.tar.gz
RUN cd /usr/src/s3fs-fuse-1.78 && ./autogen.sh
RUN ./configure --prefix=/usr && make && make install
RUN mkdir /srv/omaha_s3
ADD . /srv/omaha
# setup all the configfiles
RUN rm /etc/nginx/sites-enabled/default
RUN rm /etc/nginx/nginx.conf
RUN ln -s /srv/omaha/conf/nginx.conf /etc/nginx/
RUN ln -s /srv/omaha/conf/nginx-app.conf /etc/nginx/sites-enabled/
RUN ln -s /srv/omaha/conf/supervisord.conf /etc/supervisor/conf.d/
WORKDIR /srv/omaha
RUN pip install paver --use-mirrors
RUN pip install -r requirements.txt --use-mirrors
EXPOSE 80
ENTRYPOINT ["paver", "docker_run"]
14. db:
image: postgres
redis:
image: redis
web:
image: crystalnix/omaha-server
command: paver docker_run
working_dir: /srv/omaha
privileged: true
links:
- db
- redis
ports:
- "9090:80"
environment:
DB_HOST: db
DB_PORT: 5432
DB_USER: postgres
DB_NAME: postgres
DB_PASSWORD: ''
HOST_NAME: '*'
SECRET_KEY: 'SECRET_KEY'
DJANGO_SETTINGS_MODULE: 'omaha_server.settings'
REDIS_HOST: redis
REDIS_PORT: 6379
Fast, isolated development environments
using Docker
Quick and easy to start
Manages a collection of containers
17. AWS Elastic BeanstalkAWS Elastic Beanstalk
“ [...] quickly deploy and manage
applications in the AWS cloud without
worrying about the infrastructure that
runs those applications. [...] reduces
management complexity without
restricting choice or control.
What Is AWS Elastic Beanstalk and Why Do I Need It?
Deploying AWS Elastic Beanstalk Applications from Docker Containers
“ You simply upload your application,
and AWS Elastic Beanstalk automatically
handles the details of capacity
provisioning, load balancing, scaling, and
application health monitoring.
21. One Command to DeployOne Command to Deploy
ebs-deployebs-deploy
$ ebs-deploy deploy -e omaha-server-dev
ebs-deploy is a command line tool forebs-deploy is a command line tool for
managing application deployments onmanaging application deployments on
Amazon's Beanstalk.Amazon's Beanstalk.
Zero downtime deployment
Simple config file
Update an environment(s)
23. AWS & BeanstalkAWS & Beanstalk
Auto scaling
Auto balance
Multi regions
Integrado com RDS
Monitoring
Full API Managable
24. Auto ScalingAuto Scaling
Auto Scaling is a web service that enables you to automatically
launch or terminate Amazon Elastic Compute Cloud (Amazon EC2)
instances based on user-defined policies, health status checks, and
schedules.
26. The EndThe End
1.
2.
3.
4.
5.
6.
What is Docker?
Fig
Elastic Load Balancing Deep Dive and Best
Practices
AWS Webcast - High Availability with Route 53
DNS Failover
AWS Elastic Beanstalk and Docker
Paver: easy build and deployment automation
for Python projects
27. provides AWS Development &
DevOps services
Crystalnix
Drop us a note to get a quote from our
experts
contacts@crystalnix.com