Switching SaaS Hosting From dedicated virtual machines to container-based clusters

36
MONDAY MEETING IN CHARGE: From dedicated virtual machines to container- based clusters 28.09.2016 - Dr. Sven Ehlert

Transcript of Switching SaaS Hosting From dedicated virtual machines to container-based clusters

Page 1: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:

From dedicated virtual machines to container-based clusters28.09.2016 - Dr. Sven Ehlert

Page 2: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:What is Styla

Fundamental MARKET NEEDS

Provided in a SHOPPABLE MAGAZINE SAAS

Page 3: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:What is Styla

Feeds Automatically Laid Out by STYLA. All Products Are Instantly SHOPPABLE.

Page 4: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:

Status Quo

1/5

Page 5: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:

RDS

Our (Previous) Technology Stack

Story API andstatic assets

EC2Servers Database

Browser

Story Screenshots

ElasticCache

Image resizer service

SEO tags service

Product integration service

No properProd / Stage / Dev separation

Page 6: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Our Challenges

Growing-Up Pains

Team size increased.Communication challenges and ownership changes.

Cross-functional teams.Microservices on the organizational level.

Page 7: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Our Challenges

Infrastructure Management

Phoenix server deployment via ansible.Interruptions due to network errors and version changes during provision.Very hard to replicate to developer workspace.Business requirement to support 2nd region.All network infrastructure still handled manually (VPC, Subnets, Security Groups).

Page 8: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:

Getting Ready

2/5

Page 9: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Options?

Immutable Services

Bake server images (AMIs) or use containers?

Containers are more lightweight!

Page 10: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Options?

Container Deployment Battle

Containers = Docker.

But the fight for deployments is not yet over.

Docker Swarm vs Kubernetes vs AWS Elastic Container Service

Page 11: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:False Expectations

AWS ECS Is Not a Service - It's a Building Block

You need to know your way around all AWS. We didn't at the beginning.

If you're looking into "Container-as-a-Service" on AWS, Check out convox.

Page 12: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Implementation

If You Are Lost, Get a Guide

AWS partner agency support for one week.

Full transformation took us about 3 MM.

Page 13: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Early Mistakes

IT DOES NOT WORK!!

Simple Demo service runs slow in ECS, but fast on localhost.For no obvious reasons.

Deeply diving into docker – filesystems, distributions, but to no avail. Use the force – use strace!

Also: permissions ...

Page 14: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:

Success!

3/5

Page 15: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:ECS - the not so nice parts

Get Married to AWS. And Accept Your Partner's Whims.

Configuration via JSON. Say goodbye to meaningful comments for your infrastructure.

Only basic docker-compose support. Use some taskdefinition.json instead.

Page 16: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:ECS - the not so nice parts

Getting a Cluster up and Running Should Be Easy

There's a nice first run wizard in the console. But only for your firstcluster!

Then, it's you and CloudFormation, basically.

Page 17: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:ECS - the not so nice parts

Managing Services Should Be Easy

Ecs-cli is the "cluster-as-a-service" tool for that. But it is not.

Minimal cluster configuration support. No load balancer service support. Updates seem to have stalled.

Look into convox instead.

Page 18: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:ECS - the not so nice parts

Tooling Support Is Lacking

Trust no one except aws CLI latest version.

Not even CloudFormation.

Don't even think of trusting ansible.

Page 19: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:ECS - the not so nice parts

It Is Moving Fast...

… because it has to.

Be prepared to refactor!

Page 20: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:ECS the awesome parts!

Get Married to AWS. And Benefit from Your Partner's Superpowers!

High availability - Scalability -no-downtime deploy - central logging -monitoring

Page 21: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:ECS the awesome parts!

Unified Deploy Pipeline

No matter how many services you have and what frameworks you use!

→ Github: Source Code + Dockerfile + docker-compose.yml→ Jenkins: Build images and pushes to Registry (ECR)→ Jenkins + ansible: converts docker-compose.yml to

taskdefinition.json, adds servicedefinition.json,triggers ECS

→ AWS ECS: redeploy service

Page 22: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:ECS the awesome parts!

Handle Deploy Errors with Ease

Because you can easily rollback to a previous release.

(Once your tooling agrees on that …)

Page 23: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:ECS the awesome parts!

It Is Moving Fast...

Application Load Balancers!

Image registry in Frankfurt!

Memory limits improvements!

Page 24: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:

… to Remember

4/5

Page 25: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Learnings

Docker Is Simple to Get Into. But...

… it brings its own technology to master: Caching - file system - networking, especially DNSDocker still evolves. And it does not like cron jobs.

Page 26: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Learnings

Say Hello to Demons from the Past

While transforming servers to services expects some surprises.Hard-coded paths. Tight coupling. Undocumented code.

Page 27: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Learnings

Be Prepared to Sail in Uncharted Waters

Docker unit testing handling.Tags and namespaces for prod/stage/dev environments.

Page 28: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Learnings

Ramp Up Your Educational Skills

Lots of new concepts and tools for your team to master.

Lots of debugging concepts to master.

Page 29: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:

Profit!

5/5

Page 30: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Profit!

Clear responsibilities

Each team now manages its own services.

Page 31: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Profit!

Unified Deploy Pipeline

Less confusion about how to deploy.Clear separation between develop and operation.

Page 32: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Profit!

Stable Deployments - Happy Team

No more network errors during deployment.No more version dependencies.No more role dependencies.

Deployments fail for different reasons now ...

Page 33: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Profit??

Open Questions

Will it scale?What about memory usage in production environments?Will it reduce server costs?

Page 34: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:Conclusion

ECS is worth it. But you have to invest in it. And you need someone who thoroughly understands all of it.

Team will love it - after some time.

Introduce it ideally when your team grows.

Technology has matured. Use it!

Page 35: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:About Me

Head of Technical Quality Assurance @styla

devOps engineer at night

IT counselor during weekends

Past

PhD in Computer Science Networking

Built my own start-up hoersport.de

[email protected] @sven_ehlert

Page 36: Switching SaaS Hosting From dedicated virtual machines to container-based clusters

MONDAY MEETINGIN CHARGE:

THANK YOU FOR YOUR TIME AND ATTENTION