From Legacy
To a Microservices Architecture
Python, ZCA, Pyramid, Angular 4 & Deis
About me
Érico Andrei
CTO at Briefy

https://briefy.co
From Mooca, based in Berlin
Twitter @ericof

erico@briefy.co
Micro-serviços em Python usando Pyramid, Cornice e muito amor
Briefy
Micro-serviços em Python usando Pyramid, Cornice e muito amor
The Team
Micro-serviços em Python usando Pyramid, Cornice e muito amor
Overview
A solution based on three pillars
API CENTRIC
To serve distinct use cases using the
same codebase, Briefy built its
solution around REST APIs.

Web, Mobile and customer integration
were the planned consumers.
MICROSERVICES
Single responsibility and distinct life
cycles for parts of the solution
pointed Briefy to use a micro
services architecture.
EVENTS BASED
Most of the communication between
the services could be done
asynchronously, so an event-based
— with messaging — solution was
implemented.
Code quality and reuse as principles
TESTING
Codebase testing with

Continuous Integration and

Continuous deployment
CODE QUALITY
Style guide and

documentation for

the entire codebase
DEVOPS
Use existing toolset to
minimise devops work.
CODE REUSE
Shared packages/libraries

Build upon existing OSS
codebase
Tech stack
INFRA
Storage: GDrive & S3

Messages: SQS

Cluster: 

Kubernetes 1.7.8

DEIS 2.18
API
Python 3.6.3

Zope Component Architecture

Pyramid 1.9 / Cornice

SQLAlchemy 1.2

Postgresql 9.6
DEV TOOLS
Repo: GitHub

CI: TravisCI

Logging: Logstash

Reporting: Sentry /
NewRelic / Slack
WEB FRONTEND
Angular 4

Typescript

Generic views

Generic Listings

Generic CTAs
Infrastructure
AWS
THREE ENVIRONMENTS
Live: eu-central-1

Staging: us-east-1

Development: eu-west-1
SERVICES
Message routed using SQS

S3 for static data & assets

Kubernets Cluster on EC2

Dies Workflow
Kubernetes
KUBERNETES OVER EC2
One master, n minions
DEIS ON TOP OF KUBERNETES
Workflow solution similar to Heroku PaaS
EC2 WITH AUTO SCALING
T2 and M4 instances.
Deis Workflow
DOCKER
Automatic build and save images
SIMPLE
git push deis master
TWELVE-FACTOR
And also support legacy if necessary
Code
Shared codebase
BRIEFY.COMMON
Events / Queue

Base Models / Mixins

Logging

Workflow
BRIEFY.WS
REST API blueprints

Validation

Error handling
BRIEFY.GDRIVE
Common GDrive actions

Create, Copy, Metadata,
List, Download
BRIEFY.S3
Common S3 actions

Create, Copy, Metadata,
List, Download
briefy.common
QUEUE WORKER
Queue worker to consume
SQS messages and
dispatch
WORKFLOW
Workflow engine to create
solid and secure business
processes
EVENTS
Event firing to internal
component architecture
and to SQS
MODELS
Base mixins and sqlalchemy
models with versioning, local
roles support and polymorphic
types
CACHE
Cache object serialization
on redis with dogpile.cache
briefy.ws
FILTER
Sort and filter listings
automatically based on
model fields
RESOURCES
Base classes to exposure
models as API endpoints:
REST, workflow transitions,
versioning
EVENTS
Object lifecycle events
firing
SCHEMA
Automatic colander schema
generation for validation
and deserialization
SECURITY
Resource factory to
dynamically compute ACLs
based on model workflow and
local roles
Productivity tools
CHECKSTYLE
Linting rules and code style
guide
COOKIECUTTERS
Templates to create new
packages and services
DOCKER IMAGES
Python 3.6.3

Plone 5.0.8

Nginx / Varnish
Services
Core services
MS.LAURE
Automatic quality
assurance and renaming of
assets
LEICA
Workflow and scheduling
solution.

API-based
CHOREOGRAPHER
Events handling and
routing.
ROLLEIFLEX
Authorisation and user
management service.
ALEXANDRIA
Digital Assets management
solution

API-based
Support services
CMS
Content management
backend for Briefy website.

Using Plone CMS.
THUMBOR
Image server handling
automatic cropping, resizing
and image transforms
BRIEFY.SLACK
Service handling Slack
notifications.
BRIEFY.MAIL
Service handling Mail
notifications using Mandrill
as the provider
HOTELS CRM
CRM solution to deal with
Hotels acquisition for the
City Packages initiative.
LEADS
Service handling leads and
quotes coming from
briefy.co website.
SITEMAP
Service that generates a
sitemap.xml for CMS and static
content.

SEO helper
API GATEWAY
Gateway and router
handling public accesses
to Briefy API
Leica: from briefing to assets
The core of Briefy
WORKFLOW & PERMISSIONS
Every model have its own workflow
HUNDREDS OF EVENTS
Workflow transition, task execution, object creation
and update.
DATA MODELS
Customer, Project, Order, Assignment, Creative and
User profiles
Being the scheduling and workflow solution for visual content
creation, Leica is the core of Briefy operations.

Elements of Leica
BRIEFY.FRONTEND
Web application developed with
Angular4, connects to Leica API.

This app has 3 distinct users:
Customer, Creative and Briefy team
member, with distinct permissions.
User Interface
BRIEFY.LEICA
Domain models, permissions,
business logic and API endpoints.

Codebase is well documented and
90% code coverage.
API
LEICA TASKS
Scheduled tasks execute workflow
transitions, generate reports and
post KPIs.

Share the same codebase as
briefy.leica
Tasks
Domain Models
CUSTOMER
Company requesting visual
content creation.
PROJECT
A grouping of orders from the
same customer.

Usually attached to one
contract (or agreement)
ORDER
A content creation request.
When it is not confirmed, it is
called Lead.

Customer oriented.
ASSIGNMENT
A content creation
execution schedule.

Creative oriented.
JOB POOL
Groups available Orders to
be offered to a group of
pre-selected Creatives.
CREATIVE
A visual content creator -
Photographer,
videographer — profile.
CUSTOMER USER
Profile of a user attached to
a Customer.
BRIEFY USER
Profile of a Briefy team
member user.
Managing visual content creation at scale
cost is complex
Confidential
Managing
Visual
Content
Creation Is
Complex
From Events
To Actions
Every action, one event (1)
ARIANA
Assign a creative to an Order
ORDER.WORKFLOW.ASSIGN
2017-07-27 15:46:10.03267
120

Times
Every action, one event (2)
OPHELIE
Validates a Creative
PROFESSIONAL.WORKFLOW.VALIDATE
2017-07-31 15:55:11.436015
213

Times
Events trigger new actions
ASSIGN. IS SCHEDULED
Assignment is scheduled on
Leica, generating an event
EVENT IS ROUTED
Actions are registered to this
event, i.e.: Send email to Creative
EMAIL SENT TO CREATIVE
Using Mandrill, a message is sent
to the Creative
An event on Leica will be sent to Choreographer, there it will be routed to other micro services

to execute new actions.

This flow is asynchronous and all messages are sent using SQS queues.
BRIEFY.LEICA BRIEFY.CHOREOGRAPHER BRIEFY.MAIL
Thank you!
erico@briefy.co

@ericof

https://briefy.co



Érico Andrei

More Related Content

PDF
From Legacy to a Microservices Architecture
PDF
Webcast: API-Centric Architecture for Building Context-Aware Apps
PDF
What’s behind a high quality web API? Ensure your APIs are more than just a ...
PPT
DEVCON-Alfresco i os mobile application details and design
PPTX
A Connector, A Container and an API Walk into a Bar… Microservices Edition
PPTX
Onion Architecture
PPTX
Designing APIs and Microservices Using Domain-Driven Design
PPTX
apidays LIVE LONDON - Discovering API Version differences with ease by Jaap B...
From Legacy to a Microservices Architecture
Webcast: API-Centric Architecture for Building Context-Aware Apps
What’s behind a high quality web API? Ensure your APIs are more than just a ...
DEVCON-Alfresco i os mobile application details and design
A Connector, A Container and an API Walk into a Bar… Microservices Edition
Onion Architecture
Designing APIs and Microservices Using Domain-Driven Design
apidays LIVE LONDON - Discovering API Version differences with ease by Jaap B...

What's hot (20)

PDF
Build pipelines with TeamCity and Kotlin DSL
PPTX
Anypoint connector Roadmap
PPTX
API Presentation
PPTX
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
PPTX
Running the-next-generation-of-cloud-native-applications-using-open-applicati...
PDF
Api clarity webinar
PDF
Create and Manage APIs with API Connect, Swagger and Bluemix
PPT
HAM 1032 Combining the Power of IBM API Management and IBM Integration Bus
PDF
Developer Experience (DX) as a Fitness Function for Platform Teams
PPTX
What is an Application programming interface(API)?
PDF
Rest api best practices – comprehensive handbook
PPTX
Cloud Elements Documents Hub
PPTX
Public API
PDF
Deploy a web API in 15'
PDF
apidays LIVE LONDON - Architecting Scalable Software Platforms for IoT Applic...
PPTX
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
PPTX
Continuous Integration and Delivery at Shapeways (Matt Boyle)
PPTX
IO State In Distributed API Architecture
PDF
Spring Framework Tutorial | VirtualNuggets
PDF
Api Gateway
Build pipelines with TeamCity and Kotlin DSL
Anypoint connector Roadmap
API Presentation
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
Running the-next-generation-of-cloud-native-applications-using-open-applicati...
Api clarity webinar
Create and Manage APIs with API Connect, Swagger and Bluemix
HAM 1032 Combining the Power of IBM API Management and IBM Integration Bus
Developer Experience (DX) as a Fitness Function for Platform Teams
What is an Application programming interface(API)?
Rest api best practices – comprehensive handbook
Cloud Elements Documents Hub
Public API
Deploy a web API in 15'
apidays LIVE LONDON - Architecting Scalable Software Platforms for IoT Applic...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
Continuous Integration and Delivery at Shapeways (Matt Boyle)
IO State In Distributed API Architecture
Spring Framework Tutorial | VirtualNuggets
Api Gateway
Ad

Similar to Micro-serviços em Python usando Pyramid, Cornice e muito amor (20)

PPTX
App Development Evolution: What has changed?
PPTX
The App Evolution
PPTX
App Development Evolution: What has changed?
PDF
Content Strategy and Developer Engagement for DevPortals
PDF
Which Application Modernization Pattern Is Right For You?
PPTX
Developing Apps with Azure AD
PPTX
Integrating SaaS application using Microsoft’s Azure App Service Platform
PDF
Best AWS with DevOps course in Hyderabad
PDF
M meijer api management - tech-days 2015
PDF
APIdays Paris - How to Build Your Web API
PPTX
2015-12-02 - WebCamp - Microsoft Azure Logic Apps
PPTX
codeigniter
PPTX
Vijay Oscon
PPTX
Elevating AI Workflows: Integrating Azure API Management and Azure Functions ...
PDF
APIdays Barcelona 2019 - How a Cloud native Architecture helps to drive Busin...
PDF
Building enterprise depth APIs with the IBM hybrid integration portfolio
PPTX
Microservices&ap imanagement
PDF
apidays LIVE London 2021 - Getting started with Event-Driven APIs by Hugo Gue...
PPTX
CNCF Introduction - Feb 2018
PDF
apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...
App Development Evolution: What has changed?
The App Evolution
App Development Evolution: What has changed?
Content Strategy and Developer Engagement for DevPortals
Which Application Modernization Pattern Is Right For You?
Developing Apps with Azure AD
Integrating SaaS application using Microsoft’s Azure App Service Platform
Best AWS with DevOps course in Hyderabad
M meijer api management - tech-days 2015
APIdays Paris - How to Build Your Web API
2015-12-02 - WebCamp - Microsoft Azure Logic Apps
codeigniter
Vijay Oscon
Elevating AI Workflows: Integrating Azure API Management and Azure Functions ...
APIdays Barcelona 2019 - How a Cloud native Architecture helps to drive Busin...
Building enterprise depth APIs with the IBM hybrid integration portfolio
Microservices&ap imanagement
apidays LIVE London 2021 - Getting started with Event-Driven APIs by Hugo Gue...
CNCF Introduction - Feb 2018
apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...
Ad

More from Érico Andrei (11)

PDF
The Plone Foundation needs you!
PDF
Building a Tax Knowledge base with Plone
PDF
From Contentful to Plone + Gatsby
PDF
SEO challenges of a
Single Page Application using Plone
PDF
The headless CMS
PDF
Plone Foundation
PDF
Associação Python Brasil: O que deu errado?
PDF
Criando um Site.gov.br em menos de 1h usando Plone
KEY
Plone Conference 2013: Keep Calm and Plone in Brazil
PDF
Homenagem à Dorneles Treméa
PDF
State of PythonBrasil[7]
The Plone Foundation needs you!
Building a Tax Knowledge base with Plone
From Contentful to Plone + Gatsby
SEO challenges of a
Single Page Application using Plone
The headless CMS
Plone Foundation
Associação Python Brasil: O que deu errado?
Criando um Site.gov.br em menos de 1h usando Plone
Plone Conference 2013: Keep Calm and Plone in Brazil
Homenagem à Dorneles Treméa
State of PythonBrasil[7]

Recently uploaded (20)

PPTX
assetexplorer- product-overview - presentation
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
Autodesk AutoCAD Crack Free Download 2025
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
AI Guide for Business Growth - Arna Softech
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
CCleaner 6.39.11548 Crack 2025 License Key
PDF
Visual explanation of Dijkstra's Algorithm using Python
PPTX
"Secure File Sharing Solutions on AWS".pptx
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
Cost to Outsource Software Development in 2025
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
assetexplorer- product-overview - presentation
Salesforce Agentforce AI Implementation.pdf
DNT Brochure 2025 – ISV Solutions @ D365
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
iTop VPN Crack Latest Version Full Key 2025
Autodesk AutoCAD Crack Free Download 2025
How to Use SharePoint as an ISO-Compliant Document Management System
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
AI Guide for Business Growth - Arna Softech
Computer Software and OS of computer science of grade 11.pptx
CCleaner 6.39.11548 Crack 2025 License Key
Visual explanation of Dijkstra's Algorithm using Python
"Secure File Sharing Solutions on AWS".pptx
Patient Appointment Booking in Odoo with online payment
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
MCP Security Tutorial - Beginner to Advanced
Cost to Outsource Software Development in 2025
Wondershare Recoverit Full Crack New Version (Latest 2025)

Micro-serviços em Python usando Pyramid, Cornice e muito amor

  • 1. From Legacy To a Microservices Architecture Python, ZCA, Pyramid, Angular 4 & Deis
  • 2. About me Érico Andrei CTO at Briefy
 https://briefy.co From Mooca, based in Berlin Twitter @ericof
 erico@briefy.co
  • 9. A solution based on three pillars API CENTRIC To serve distinct use cases using the same codebase, Briefy built its solution around REST APIs.
 Web, Mobile and customer integration were the planned consumers. MICROSERVICES Single responsibility and distinct life cycles for parts of the solution pointed Briefy to use a micro services architecture. EVENTS BASED Most of the communication between the services could be done asynchronously, so an event-based — with messaging — solution was implemented.
  • 10. Code quality and reuse as principles TESTING Codebase testing with
 Continuous Integration and
 Continuous deployment CODE QUALITY Style guide and
 documentation for
 the entire codebase DEVOPS Use existing toolset to minimise devops work. CODE REUSE Shared packages/libraries
 Build upon existing OSS codebase
  • 11. Tech stack INFRA Storage: GDrive & S3
 Messages: SQS
 Cluster: 
 Kubernetes 1.7.8
 DEIS 2.18 API Python 3.6.3
 Zope Component Architecture
 Pyramid 1.9 / Cornice
 SQLAlchemy 1.2
 Postgresql 9.6 DEV TOOLS Repo: GitHub
 CI: TravisCI
 Logging: Logstash
 Reporting: Sentry / NewRelic / Slack WEB FRONTEND Angular 4
 Typescript
 Generic views
 Generic Listings
 Generic CTAs
  • 13. AWS THREE ENVIRONMENTS Live: eu-central-1
 Staging: us-east-1
 Development: eu-west-1 SERVICES Message routed using SQS
 S3 for static data & assets
 Kubernets Cluster on EC2
 Dies Workflow
  • 14. Kubernetes KUBERNETES OVER EC2 One master, n minions DEIS ON TOP OF KUBERNETES Workflow solution similar to Heroku PaaS EC2 WITH AUTO SCALING T2 and M4 instances.
  • 15. Deis Workflow DOCKER Automatic build and save images SIMPLE git push deis master TWELVE-FACTOR And also support legacy if necessary
  • 16. Code
  • 17. Shared codebase BRIEFY.COMMON Events / Queue
 Base Models / Mixins
 Logging
 Workflow BRIEFY.WS REST API blueprints
 Validation
 Error handling BRIEFY.GDRIVE Common GDrive actions
 Create, Copy, Metadata, List, Download BRIEFY.S3 Common S3 actions
 Create, Copy, Metadata, List, Download
  • 18. briefy.common QUEUE WORKER Queue worker to consume SQS messages and dispatch WORKFLOW Workflow engine to create solid and secure business processes EVENTS Event firing to internal component architecture and to SQS MODELS Base mixins and sqlalchemy models with versioning, local roles support and polymorphic types CACHE Cache object serialization on redis with dogpile.cache
  • 19. briefy.ws FILTER Sort and filter listings automatically based on model fields RESOURCES Base classes to exposure models as API endpoints: REST, workflow transitions, versioning EVENTS Object lifecycle events firing SCHEMA Automatic colander schema generation for validation and deserialization SECURITY Resource factory to dynamically compute ACLs based on model workflow and local roles
  • 20. Productivity tools CHECKSTYLE Linting rules and code style guide COOKIECUTTERS Templates to create new packages and services DOCKER IMAGES Python 3.6.3
 Plone 5.0.8
 Nginx / Varnish
  • 22. Core services MS.LAURE Automatic quality assurance and renaming of assets LEICA Workflow and scheduling solution.
 API-based CHOREOGRAPHER Events handling and routing. ROLLEIFLEX Authorisation and user management service. ALEXANDRIA Digital Assets management solution
 API-based
  • 23. Support services CMS Content management backend for Briefy website.
 Using Plone CMS. THUMBOR Image server handling automatic cropping, resizing and image transforms BRIEFY.SLACK Service handling Slack notifications. BRIEFY.MAIL Service handling Mail notifications using Mandrill as the provider HOTELS CRM CRM solution to deal with Hotels acquisition for the City Packages initiative. LEADS Service handling leads and quotes coming from briefy.co website. SITEMAP Service that generates a sitemap.xml for CMS and static content.
 SEO helper API GATEWAY Gateway and router handling public accesses to Briefy API
  • 25. The core of Briefy WORKFLOW & PERMISSIONS Every model have its own workflow HUNDREDS OF EVENTS Workflow transition, task execution, object creation and update. DATA MODELS Customer, Project, Order, Assignment, Creative and User profiles Being the scheduling and workflow solution for visual content creation, Leica is the core of Briefy operations.

  • 26. Elements of Leica BRIEFY.FRONTEND Web application developed with Angular4, connects to Leica API.
 This app has 3 distinct users: Customer, Creative and Briefy team member, with distinct permissions. User Interface BRIEFY.LEICA Domain models, permissions, business logic and API endpoints.
 Codebase is well documented and 90% code coverage. API LEICA TASKS Scheduled tasks execute workflow transitions, generate reports and post KPIs.
 Share the same codebase as briefy.leica Tasks
  • 27. Domain Models CUSTOMER Company requesting visual content creation. PROJECT A grouping of orders from the same customer.
 Usually attached to one contract (or agreement) ORDER A content creation request. When it is not confirmed, it is called Lead.
 Customer oriented. ASSIGNMENT A content creation execution schedule.
 Creative oriented. JOB POOL Groups available Orders to be offered to a group of pre-selected Creatives. CREATIVE A visual content creator - Photographer, videographer — profile. CUSTOMER USER Profile of a user attached to a Customer. BRIEFY USER Profile of a Briefy team member user.
  • 28. Managing visual content creation at scale cost is complex Confidential Managing Visual Content Creation Is Complex
  • 30. Every action, one event (1) ARIANA Assign a creative to an Order ORDER.WORKFLOW.ASSIGN 2017-07-27 15:46:10.03267 120
 Times
  • 31. Every action, one event (2) OPHELIE Validates a Creative PROFESSIONAL.WORKFLOW.VALIDATE 2017-07-31 15:55:11.436015 213
 Times
  • 32. Events trigger new actions ASSIGN. IS SCHEDULED Assignment is scheduled on Leica, generating an event EVENT IS ROUTED Actions are registered to this event, i.e.: Send email to Creative EMAIL SENT TO CREATIVE Using Mandrill, a message is sent to the Creative An event on Leica will be sent to Choreographer, there it will be routed to other micro services
 to execute new actions.
 This flow is asynchronous and all messages are sent using SQS queues. BRIEFY.LEICA BRIEFY.CHOREOGRAPHER BRIEFY.MAIL