Slide 1

Slide 1 text

MICRO SERVIÇOS Pontos positivos e negativos GURUPR 2º TECH DAY

Slide 2

Slide 2 text

ELBER RIBEIRO Lead Software Engineer - @dynaum

Slide 3

Slide 3 text

QUEBRAR SUA APLICAÇÃO EM MÓDULOS INDEPENDENTES

Slide 4

Slide 4 text

GERA UMA MELHOR MANUTENÇÃO E ESCALABILIDADE

Slide 5

Slide 5 text

AUMENTA A COMPLEXIDADE DO SISTEMA

Slide 6

Slide 6 text

PARAFUZO.COM

Slide 7

Slide 7 text

PARAFUZO.COM ZEUS POSEIDON PLUTON Site Padrino Api Sinatra Admin Rails MongoDB

Slide 8

Slide 8 text

PARAFUZO CORE Gem interna que contém toda a regra de negócio compartilhada entre api e admin

Slide 9

Slide 9 text

PAGAMENTO E BUSCA DE PRESTADOR CONCORREM COM OS MESMOS WORKERS

Slide 10

Slide 10 text

PAGAMENTO E BUSCA DE PRESTADOR CONCORREM COM O MESMO BANCO

Slide 11

Slide 11 text

PARAFUZO.COM API Site Feedback Prestador Comunicação entre os serviços via HTTP e JSON

Slide 12

Slide 12 text

PARAFUZO.COM Negociação de conteúdo via content-type Aplicativo Android Data Warehouse Indexador de busca application/json+app application/json+dw application/json+search

Slide 13

Slide 13 text

PARAFUZO.COM class UserDecoratorApp < UserDecoratorBase extend Forwardable def_delegators :@model, :addresses, :needs_password?, :password, :state def links { "orders" => {href: url(:orders)}, "jobs" => {href: url(:jobs)}, } end def as_json(options={}) super({ addresses: addresses, state: state, has_password?: password.present?, needs_password?: needs_password?, credit_cards: credit_cards, _links: links }) end end

Slide 14

Slide 14 text

PARAFUZO.COM class UserDecoratorDw < UserDecoratorBase include DecoratorHelper def_delegators :@model, :addresses, :credit_cards, :orders, :social_accounts def as_json(options = {}) super({ has_credit_card: has_credit_card, first_purchase_date: format_date(purchased_orders.first.try(:closed_at)), last_purchase_date: format_date(purchased_orders.last.try(:closed_at)), address: address_details(user_main_address), facebook_id: facebook_uid, created_at: format_date(created_at), updated_at: format_date(updated_at), total_revenue: total_revenue, total_charged_revenue: total_charged_revenue, utm_source: utms['source'], utm_campaign: utms['campaign'], utm_medium: utms['medium'], utm_content: utms['content'], kind: kind }) end end

Slide 15

Slide 15 text

DEPENDENCIA CIRCULAR

Slide 16

Slide 16 text

BARRAMENTO AWS SNS + SQS User Order Job Tasker Poseidon - API Artemis - Location Chiron

Slide 17

Slide 17 text

BARRAMENTO Tópico: taskers-prod Mensagem: { event: ‘updated’, uri: ‘api.parafuzo.com/resource/id’ }

Slide 18

Slide 18 text

BARRAMENTO class Order include Mongoid::Document include Parafuzo::Core::Notify notify_with key: :number, includes: :state field :number , type: String field :state , type: String end

Slide 19

Slide 19 text

BARRAMENTO module Chiron class JobsStrategy attr_reader :message, :builder def initialize(message) @message = message @builder = Builder.new PoseidonConsumer, ApolloPusher end def process resource = builder.resource message['uri'] return unless resource create(resource) if message['event'] == 'created' update(resource) if message['event'] == 'updated' end end end

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

DESENVOLVIMENTO COM AZK, CI COM GITLAB E DEPLOY COM KUBERNETES

Slide 22

Slide 22 text

DEPLOY git ci -am “new feature” git tag v7.1.0-prod git push --tags

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

OBRIGADO