23
Micro services infrastructure With Ansible and AWS Bamdad Dashtban @bamdad

Micro services infrastructure with AWS and Ansible

Embed Size (px)

Citation preview

Micro services infrastructureWith Ansible and AWS

Bamdad Dashtban @bamdad

ScienceDirect.com Story

Legacy code

● C++ monolithic legacy code.● Not fast enough response time.● Maintenance was hard and expensive.● Development of new features was hard.● Wasn’t Multi region.● Not so exciting stack.

New stack

● Faster delivery of features using CD.● Improve performance.● Make it exciting stack to work with.● Scalable for higher load.

Strangler Pattern

User

Router

Apps

Micro services

● Scalable● Micro services in front of the current stack.● Caching.● Adding new features.● Shape teams based on the MicroServices.

Cloud

● AWS○ Phoenix Pattern (immutable servers)○ DNS for semantic versioning○ VPC networking ( public and private )○ ELB○ Autoscaling

Ansible

● Provisioning

● Deployment

Amazon EC2 Instance AMI

● Automatic Trigger● RPM build● Yum update on 1 instance

Deployment Iteration 0

Deployment Iteration 1

● RPM build● Manual Trigger● Bake AMI with RPM● New ASG with ELB

AMI

Deployment Iteration 2

● Automatic Trigger

● RPM pull with user-data

● New ASG with ELBAMI

user-data executable script

Deployment Iteration 3

● Automatic Trigger● RPM pull with user-data● reuse of the ELBs

AMI

user-data executable script

Continuous Delivery

● Jenkins to GoCD.● Pipelines instead of Tasks.● Concept of Environments.● Environment Specific Agents.● Resource Specific Agents.

Problems

● Complexity● Service Discovery.● ELB resizing.● CDN routing.● Deployment Time.● Ansible Changes.● Cost.

Complexity

App

Request Request

Method Call

HTTP Request

Service Discovery

V n-2

V n-1

V n

V n -1

V n

?App 1 App 2

Service Discovery

● We are not currently using service discovery tools.● Predictable DNS endpoints.● Amazon Route53 Aliases instead of CNAMEs.● Looking at other solutions like Consul, etcd, Mesos DNS

ELB resizing

ELB

App

ELB

App

ELB

CDN Routing

● Routing based on files on a network file system. (Slow)

● Slow on making configuration changes to CDN.

Deployment Time

● Bake AMI (15-25 mins)● Deploy (1-2 mins)● Smoke Test (2-4 mins for DNS)● Service Test (1 min)● Switch (1 min)● Get rid of old instances. (1 min)

(repeat [“Dev” “QA” “Perf” “Stage” “Prod”])

Ansible

● Started with ansible 1.7● pulled some changes from 1.8● Patched some modules● Ansible splitted Modules to a separate repo.● Our pull requests have not got accepted.

Question?

Thanks

● ThoughtWorks and Elsevier are both both hiring.● Feel free to come and talk to us.

@bamdad