This document discusses using CQRS, ReactJS, and Docker to build a new project quickly. It recommends separating the project into bounded contexts with each handling a specific domain. Communication between bounded contexts is done through message buses and events. The infrastructure is containerized with Docker to provide a consistent development environment. A development workflow is established using Docker, Gulp, and Webpack to bundle frontends. Deployments are automated through Docker Cloud and a green/blue deployment strategy ensures zero downtime.
11. DOMAIN
▸ data come from and go to external entities
▸ users can configure to send a subset of data
▸ users send data based on their plan
send data from a source to a target
GOAL
12. THE DOMAIN
▸ unpredictable data structures
▸ ad hoc workflow for each vendor
▸ variable number of steps
▸ handle rate limits from different vendors
▸ handle different error cases from different vendors
▸ handle business-oriented limits (based on plans...)
▸ some tasks need to be done asynchronously
28. WHAT'S THE ISSUE HERE
▸ understandable?
▸ code can't be reused
▸ high coupling
▸ untestable
▸ too many responsibilities
▸ hard to find bugs
▸ not changes-prone
37. COMMANDS
COMMAND BUS
Represent the change that should be done in the domain
They are named with a verb in the imperative tense and may include
the aggregate type, for example ScheduleATask.
39. EVENTS
BC 1 BC 2
EVENT BUS
An event represents something that took place in
the domain.
They are always named with a past-participle verb,
such as TaskScheduled
40. EVENTS
BC 1 BC 2
EVENT BUS
subscribes_to: 'user-created'
subscribes_to: 'task-stopped'
subscribes_to: 'task-suspended'
41. EVENTS
BC 1 BC 2
EVENT BUS
$messageBus->handle(
UserCreatedEvent::fromUser($user)
);
subscribes_to: 'user-created'
subscribes_to: 'task-stopped'
subscribes_to: 'task-suspended'
$messageBus->handle(
TaskSuspendedEvent::fromTask($task)
);
46. SCENARIO: TRIGGER THE TASKS SCHEDULE EVERY 10 MINUTES
TIMER SCHEDULER
POST /tasks/schedule
47. SCENARIO: TRIGGER THE TASKS SCHEDULE EVERY 10 MINUTES
TIMER SCHEDULER
POST /tasks/schedule
DATA STORAGE
$taskRepository->getAll()
48. SCENARIO: TRIGGER THE TASKS SCHEDULE EVERY 10 MINUTES
TIMER SCHEDULER
POST /tasks/schedule
DATA STORAGE
$taskRepository->getAll()
TASK QUEUE
enqueue($taskId)
49. SCENARIO: TRIGGER THE TASKS SCHEDULE EVERY 10 MINUTES
TIMER SCHEDULER
POST /tasks/schedule
DATA STORAGE
$taskRepository->getAll()
TASK QUEUE
enqueue($taskId)
W1 W2 W3 W..N...
50. LET ME SEE WHAT
YOU HAVE DONE
IT'S TIME TO SHOW DOWN
103. THE DEVELOPMENT ENVIRONMENT
▸ Easy to use so many technologies at no installation cost
▸ Prepare the scaffolding for a new developer is extremely
simple
▸ Superior performances over previous systems
127. HARD TRUTH
SCALE CONTAINERS IS WORTHLESS IF YOU DO NOT SCALE NODES
fpm:
image: 'adespresso/hubespresso-staging:fpm-latest'
deployment_strategy: every_node
sequential_deployment: true
tags:
- fpm
- hubespresso
- production
volumes:
- /var/www/project
volumes_from:
- shared-fpm.hubespresso-production
130. DEPLOYMENT
▸ deploy the infrastructure is not straightforward
▸ multiple container in multiple nodes
▸ every container has its own lifecycle
▸ we are not assuring zero-downtime on deployment