armada - the way to ship microservices

Post on 20-Feb-2017

271 Views

Category:

Technology

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

ARMADA The way to ship microservices.

Zbigniew Rzepka

ZRZEPKA@GANYMEDE.EU

AGENDA.

• Introduction.

• Overview.

• Features.

• Services.

WHAT’S THE PROBLEM?

A sad developer’s story.

THE BEGINNING.

• „Awesome Panel”.

• Written 5 years ago.

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

LET’S GET STARTED.

• Unknown technologies = unknown configurations.

• Uncommon technologies.

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

README.

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

ADDING THE FEATURE.

• There’s no jenkins task nor deployment script.

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

• It’s deprecated.

YOU’VE DONE IT!

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.

ARMADA

The solution to most of our problems.

SO, WHAT IS ARMADA?

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

• Deployment,

• Configuration.

• Enhances Docker with microservices oriented features.

ARMADA’S FEATURES.

• Service discovery.

• Clustering.

• Load balancing.

• Configuration deployment.

• Health checks.

• Disaster recovery.

• Dynamic DNS configuration.

• Instant setup on development environment.

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.

ARMADA’S SOLUTIONS

To most of our problems.

DEPEDENCIES.

FROM microservice_python

RUN pip3 install requestsRUN pip3 install django

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

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.

SERVICE LEVEL DEPENDENCIES.

• You need:• Service’s name.

• One config file.

SERVICE DISCOVERY.

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

HOW DOES IT WORK?

AUTOMATIC LOAD BALANCING.

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

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

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.

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.

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.

ARMADA SERVICES.

ARMADA IS MORE THAN JUST ENHANCED DOCKER.

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.

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.

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.

OTHER SERVICES:• Armada-Bind (proxy).

• Dockyard (repository).

• Static File Server.

• MySQL.

• Redis.

EASE OF DEVELOPMENT.

DEVELOPMENT ENVIRONMENT.

• One-line setup of development environment.

• Automaticaly mounted volumes.

• Perfect for interpreted code.

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',

)

FIND US ON GITHUB!

Got questions?

https://github.com/armadaplatform/armada

http://armada.sh

Thank you!

top related