omaha (google update) server

27
omaha-server omaha-server High Fidelity, High Velocity High Fidelity, High Velocity Deployments in the Cloud Deployments in the Cloud

Upload: dmitry-lyfar

Post on 14-Apr-2017

458 views

Category:

Software


4 download

TRANSCRIPT

Page 1: Omaha (Google Update) server

omaha-serveromaha-serverHigh Fidelity, High VelocityHigh Fidelity, High VelocityDeployments in the CloudDeployments in the Cloud

Page 2: Omaha (Google Update) server

PythonDjangoPostgreSQLRedis

Technology StackTechnology Stack

Page 3: Omaha (Google Update) server

WorkflowWorkflowgit commit & git push

Page 4: Omaha (Google Update) server

Run tests oftenPreferably on every commitIn a clean environmentPull requests testingStatus Images

Hosted Continuous IntegrationHosted Continuous Integration

Page 5: Omaha (Google Update) server

Minimal ConfigMinimal Configlanguage: python

python: - "2.7"

virtualenv: system_site_packages: true

env: global: - HOST_NAME: 'travis-ci' - SECRET_KEY: 'SECRET_KEY'

services: - redis-server

before_install: - sudo apt-get install -qq python-lxml python-psycopg2

install: "pip install -r requirements-test.txt --use-mirrors"

script: paver test

after_success: - coveralls --verbose

Page 6: Omaha (Google Update) server
Page 7: Omaha (Google Update) server

What is DockerWhat is DockerAt very basic level, think lightweight VMDocker is an open platform for developing, shipping, and runningapplications.Run any application securely isolated in a container.Open Source engine to commoditize LXCWritten in Go, runs as a daemon, comes with a CLIFull REST APIAllows to build images in standard, reproducible wayAllows to share images

More infoMore info

Page 8: Omaha (Google Update) server

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 imageand, if it doesn't exist locally on the host, then Docker downloads it from dockerregistry. 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 acontainer.

Allocates a filesystem and mounts a read-write layer: The container is createdin the file system and a read-write layer is added to the image.

Allocates a network / bridge interface: Creates a network interface that allowsthe 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.

Page 9: Omaha (Google Update) server

Managing a ContainerManaging a Container$ docker psCONTAINER ID IMAGE COMMAND CREATEDa254c3d91bab omahaserver_web:latest "paver docker_run pa Up 5 minutes

STATUS PORTS NAMESUp 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 --noinputOperations to perform: Synchronize unmigrated apps: django_filters, djangobower, cacheops, django_select2, suit, django_extensions, django_tables2, suit_redactor, rest_framework, storages, versionfield, absolute Apply all migrations: crash, omaha, sessions, admin, auth, sparkle, contenttypesSynchronizing 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 apply them.---> pavement.loaddata./manage.py loaddata fixtures/initial_data.jsonInstalled 5 object(s) from 1 fixture(s)---> pavement.create_admin./createadmin.py

Page 10: Omaha (Google Update) server

Docker ImagesDocker ImagesDocker 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 updateexisting images, or you can download Docker images that otherpeople have already created.Each image consists of a series of layers. Docker makes use ofunion file systems to combine these layers into a single image.When you change a Docker image – for example, update anapplication to a new version – a new layer gets built.

Page 11: Omaha (Google Update) server

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 ordownload images.The public Docker registry is called . It provides ahuge collection of existing images for your use.

Docker Hub

Page 12: Omaha (Google Update) server

Docker ContainersDocker Containers

Docker containers are the run component of Docker.A Docker container holds everything that is needed for anapplication to run.Each container is created from a Docker image.The Docker image is read-only. When Docker runs a containerfrom an image, it adds a read-write layer on top of the image inwhich your application can then run.Docker containers can be run, started, stopped, moved, anddeleted.

Page 13: Omaha (Google Update) server

FROM ubuntu:14.04.1

RUN apt-get updateRUN apt-get upgrade -yRUN apt-get install -y python-pip python-lxml python-psycopg2 uwsgi supervisorRUN apt-get install -y uwsgi-plugin-pythonRUN apt-get install -y nginx

# install s3fs

RUN apt-get install -y build-essential libfuse-dev libfuse-dev libfuse-dev mime-supportRUN apt-get clean

RUN wget https://github.com/s3fs-fuse/s3fs-fuse/archive/v1.78.tar.gz -O /usr/src/v1.78.tar.gzRUN tar xvz -C /usr/src -f /usr/src/v1.78.tar.gzRUN cd /usr/src/s3fs-fuse-1.78 && ./autogen.sh RUN ./configure --prefix=/usr && make && make installRUN mkdir /srv/omaha_s3

ADD . /srv/omaha

# setup all the configfilesRUN rm /etc/nginx/sites-enabled/defaultRUN rm /etc/nginx/nginx.confRUN 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/omahaRUN pip install paver --use-mirrorsRUN pip install -r requirements.txt --use-mirrors

EXPOSE 80ENTRYPOINT ["paver", "docker_run"]

Page 14: Omaha (Google Update) server

db: image: postgresredis: image: redisweb: 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 environmentsusing DockerQuick and easy to startManages a collection of containers

Page 15: Omaha (Google Update) server

Up PostgreSQL + Redis + omaha-serverUp PostgreSQL + Redis + omaha-server

Page 16: Omaha (Google Update) server

PythonDjangoPostgreSQLRedis

Page 17: Omaha (Google Update) server

AWS Elastic BeanstalkAWS Elastic Beanstalk

“ [...] quickly deploy and manageapplications in the AWS cloud withoutworrying about the infrastructure thatruns those applications. [...] reduces

management complexity withoutrestricting 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 capacityprovisioning, load balancing, scaling, and

application health monitoring.

Page 18: Omaha (Google Update) server

Omaha-serverOmaha-server

Page 19: Omaha (Google Update) server

Deployment without DockerDeployment without Docker

Page 20: Omaha (Google Update) server

Deployment with DockerDeployment with Docker

Page 21: Omaha (Google Update) server

One Command to DeployOne Command to Deployebs-deployebs-deploy

$ ebs-deploy deploy -e omaha-server-dev

ebs-deploy is a command line tool forebs-deploy is a command line tool formanaging application deployments onmanaging application deployments on

Amazon's Beanstalk.Amazon's Beanstalk.

Zero downtime deploymentSimple config fileUpdate an environment(s)

Page 22: Omaha (Google Update) server

aws: access_key: 'AWS Access Key' secret_key: 'AWS Secret Key' region: 'us-east-1' bucket: 'the bucket that beanstalk apps will be stored in' bucket_path: 'omaha-server'app: versions_to_keep: 10 app_name: 'omaha-server' description: 'Omaha Server' all_environments: solution_stack_name: '64bit Amazon Linux 2014.09 v1.0.9 running Docker 1.2.0' tier_name: 'WebServer' tier_type: 'Standard' tier_version: '1.0' option_settings: 'aws:autoscaling:launchconfiguration': InstanceType: 't2.small' SecurityGroups: 'omaha_server_dev' EC2KeyName: 'Key Name' 'aws:autoscaling:asg': MinSize: 1 MaxSize: 10 'aws:autoscaling:trigger': BreachDuration: 300 MeasureName: 'CPUUtilization' Unit: 'Percent' LowerThreshold: 20 UpperThreshold: 70 UpperBreachScaleIncrement: 1 'aws:elasticbeanstalk:application': Application Healthcheck URL: '/admin/login/' includes: - 'Dockerrun.aws.json'

Page 23: Omaha (Google Update) server

AWS & BeanstalkAWS & BeanstalkAuto scalingAuto balance Multi regions Integrado com RDSMonitoring Full API Managable

Page 24: Omaha (Google Update) server

Auto ScalingAuto ScalingAuto 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.

Page 25: Omaha (Google Update) server

AWS CloudWatch /MonitoringAWS CloudWatch /Monitoring

Page 26: Omaha (Google Update) server

The EndThe End1. 2. 3.

4.

5. 6.

What is Docker?FigElastic Load Balancing Deep Dive and BestPracticesAWS Webcast - High Availability with Route 53DNS FailoverAWS Elastic Beanstalk and DockerPaver: easy build and deployment automationfor Python projects

Page 27: Omaha (Google Update) server

provides AWS Development &DevOps services

Crystalnix

Drop us a note to get a quote from ourexperts

[email protected]