armada - the way to ship microservices

35
ARMADA The way to ship microservices. Zbigniew Rzepka [email protected]

Upload: gamedesire-company

Post on 20-Feb-2017

271 views

Category:

Technology


6 download

TRANSCRIPT

Page 1: Armada - the way to ship microservices

ARMADA The way to ship microservices.

Zbigniew Rzepka

[email protected]

Page 2: Armada - the way to ship microservices

AGENDA.

• Introduction.

• Overview.

• Features.

• Services.

Page 3: Armada - the way to ship microservices

WHAT’S THE PROBLEM?

A sad developer’s story.

Page 4: Armada - the way to ship microservices

THE BEGINNING.

• „Awesome Panel”.

• Written 5 years ago.

• Just add one feature, it’s really important.

Page 5: Armada - the way to ship microservices

LET’S GET STARTED.

• Unknown technologies = unknown configurations.

• Uncommon technologies.

• Just because it works in production, doesn’t mean it works in dev.

Page 6: Armada - the way to ship microservices

README.

BTW: Guy who wrote it quit two years ago, you’re on your own.

Page 7: Armada - the way to ship microservices

ADDING THE FEATURE.

• There’s no jenkins task nor deployment script.

• Actually there is a script, hidden somewhere on some server.

• It’s deprecated.

Page 8: Armada - the way to ship microservices

YOU’VE DONE IT!

Page 9: Armada - the way to ship microservices

SO WHAT WAS THE PROBLEM EXACTLY?

• Application configuration in development/production environment.

• Knowledge about applications disappears over time.

• Sometimes it’s not even clear where a service is running.

Page 10: Armada - the way to ship microservices

ARMADA

The solution to most of our problems.

Page 11: Armada - the way to ship microservices

SO, WHAT IS ARMADA?

• A complete platform for microservices which handles:• Development,

• Deployment,

• Configuration.

• Enhances Docker with microservices oriented features.

Page 12: Armada - the way to ship microservices

ARMADA’S FEATURES.

• Service discovery.

• Clustering.

• Load balancing.

• Configuration deployment.

• Health checks.

• Disaster recovery.

• Dynamic DNS configuration.

• Instant setup on development environment.

Page 13: Armada - the way to ship microservices

TECHNOLOGY BEHIND ARMADA.

• Consul – Distributed services catalog.• Stores information about running services.

• HAProxy – Load balancer.• Maps services` addresses inside the container.

• Supervisord – Process control system.• Executes services and scripts.

• Vagrant.

Page 14: Armada - the way to ship microservices

ARMADA’S SOLUTIONS

To most of our problems.

Page 15: Armada - the way to ship microservices

DEPEDENCIES.

FROM microservice_python

RUN pip3 install requestsRUN pip3 install django

ADD . /opt/my-serviceADD supervisor/* /etc/supervisord/conf/

Page 16: Armada - the way to ship microservices

SERVICE LEVEL DEPENDENCIES.

• Applications running on static ports, e.g.:• Backend: 10.0.0.1:30000

• Frontend: 10.0.0.1:30001

• Which leads to: • Conflicts.

• Longer Readmes.

• On the large scale: Pain in the very lower back.

Page 17: Armada - the way to ship microservices

SERVICE LEVEL DEPENDENCIES.

• You need:• Service’s name.

• One config file.

Page 18: Armada - the way to ship microservices

SERVICE DISCOVERY.

[program:require_my_backend]directory=/opt/microservice/local_magellancommand=require_service.py my-backend 2000

Page 19: Armada - the way to ship microservices

HOW DOES IT WORK?

Page 20: Armada - the way to ship microservices

AUTOMATIC LOAD BALANCING.

• Discovered services are automatically load balanced using `round-robin` method.

• Services with `critical` state are omited by load balancer.

Page 21: Armada - the way to ship microservices

SERVICES’ STATES.

Armada services use health checks to set states:• Passing

• service works.

• Warning• service works but there’s something wrong.

• Critical• service doesn’t work.

Page 22: Armada - the way to ship microservices

CUSTOM HEALTH CHECKS.

• By default every service only checks whether port 80 is open.• Yes – passing.

• No – critical.

• Custom health checks can be added to `health-checks` directoryanywhere inside the project.

• Default health check can be over overidden.

Page 23: Armada - the way to ship microservices

MULTIPLE ENVIRONMENTS.

• Changed with one argument on container launch, e.g.:• armada run my-backend --env dev

• armada run my-backend --env production

• Requires you to simply have a configuration directory with env-corresponding name inside your project.

Page 24: Armada - the way to ship microservices

ARMADA SERVICES.

Page 25: Armada - the way to ship microservices

ARMADA IS MORE THAN JUST ENHANCED DOCKER.

Page 26: Armada - the way to ship microservices

HAPROXY + MAGELLAN.

• Magellan: mini-DNS.• Updates HAProxy configuration.

• Maps running services to domain names, e.g.: • my-frontend (env: dev) -> my-frontend.dev.ganymede.eu

• Again, services are automatically load balanced.

Page 27: Armada - the way to ship microservices

COURIER.

• Sometimes it’s necessary to keep configuration in a separaterepository.

• Courier fetches config code from git repository and distributes it to selected Armadas.

• Such config is available via `hermes` config provider script.

Page 28: Armada - the way to ship microservices

COURIER.

1. Create Courier configuration.A. Specify destination Armadas.

B. Specify git repos with branch to check out.

2. Run Courier service in any armada cluster.

3. Now, everytime a repo is pushed to, your config will be distributedamong specified Armadas.

Page 29: Armada - the way to ship microservices

OTHER SERVICES:• Armada-Bind (proxy).

• Dockyard (repository).

• Static File Server.

• MySQL.

• Redis.

Page 30: Armada - the way to ship microservices

EASE OF DEVELOPMENT.

Page 31: Armada - the way to ship microservices

DEVELOPMENT ENVIRONMENT.

• One-line setup of development environment.

• Automaticaly mounted volumes.

• Perfect for interpreted code.

Page 32: Armada - the way to ship microservices

VAGRANT CONFIGURATION.require 'open-uri' armada_vagrantfile_path = File.join(Dir.tmpdir, 'ArmadaVagrantfile.rb') IO.write(armada_vagrantfile_path, open('http://vagrant.armada.sh/ArmadaVagrantfile.rb').read)

load armada_vagrantfile_patharmada_vagrantfile (:microservice_name => 'my-frontend',:origin_dockyard_address => 'dockyard.my-company.org',:configs_dir => 'config',

)

Page 33: Armada - the way to ship microservices
Page 34: Armada - the way to ship microservices

FIND US ON GITHUB!

Got questions?

Page 35: Armada - the way to ship microservices

https://github.com/armadaplatform/armada

http://armada.sh

Thank you!