Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Laravel at Gousto

Laravel at Gousto

Gousto Tech

April 12, 2017
Tweet

More Decks by Gousto Tech

Other Decks in Programming

Transcript

  1. About Gousto Recipe-kit company Founded 2012 Choose from 22 recipes

    on web/apps Order for delivery 7 days a week Measured ingredients delivered – no waste Rapidly growing business Diverse tech requirements Everything needed yesterday
  2. Web Site (PHP Laravel) Business Logic (PHP Laravel) Users CMS

    Users Data Scientists Reporting Read Replica Production Database MySQL MySQL Tightly Coupled APIs
  3. Strategy Cross-functional teams (squads) Own verticals of functionality No single

    team owns a service COGs ensure uniformity and best practices across services Pull out functionality into new service when developing new feature Account management Delivery management Marketplace Logged-in customers Sign-up Cookbook Menu Non logged-in customers Internal tooling Order processing Data engineering Capabilities
  4. The benefits Performance + stability Quicker + frequent deployments Independence

    for teams Iterative development 0 5 10 15 20 25 30 Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 Week 8 Week 9 Week 10 Week 11 Week 12 Week 13 Week 14 Week 15 Week 16 Week 17 Week 18 Week 19 Week 20 Week 21 Week 22 Week 23 Week 24 Week 25 Week 26 Week 27 Week 28 Week 29 Week 30 Week 31 Week 32 Week 33 Weekly Production Deployments core fe platform gateway products auth gifts admin maintenance
  5. The challenges Greater devops overhead ◦ More services => more

    alerts! Log aggregation ◦ AWS Cloudwatch still fairly basic Request tracing ◦ Where did this request originate? Orchestration Latency Larger AWS footprint
  6. How Lumen helped Familiarity Lightweight Easy to bootstrap Simple to

    extend with packages Native support for AWS features Great community and ecosystem Fantastic documentation!
  7. Current stack React-based FE clients ◦ Server + client-side Nginx

    API gateway Lumen 5.2 microservices ◦ 15 in production ◦ 600k+ requests/day ◦ ~50ms avg. response time Memcache MySQL
  8. Current stack Hosted in AWS Standardised “platform” ◦ Infrastructure as

    code – no configuration required ◦ Additional resources through additions Messaging platform ◦ Pub-sub model using SNS + SQS ◦ Automatic wiring to topics/queues based on service.yml src ansible cloudFormation service.yml roles overrides additions playbook.yml Service Repository
  9. Architecture auth service service b service c message bus service

    a microservice-comms messaging oauth cache chef vendor/gousto experiments src lumen business logic
  10. Bootstrapping Uses composer create-project CLI interface to provide basic configuration

    Convention over configuration Provides shared libraries Just add routes…
  11. Request flow Users service b route repository interface eloquent repository

    microservice repository eloquent model micro- service model presenter auth middleware controller service a
  12. Microservice package Uses repository pattern and Eloquent model interface Declare

    a resource as a service Base repository and model ◦ Can be overridden per service Provides Collection and Paginator wrappers Uses API standards to construct request and provide parsed response
  13. API standards REST API conventions ◦ Same internally and externally

    Standard for: ◦ REST URI structure ◦ JSON response schema ◦ HTTP methods and status codes ◦ Filtering + relations ◦ Sorting + pagination
  14. Customer Service Payment Service Delivery Service . . . I’ve

    changed address Got it, thanks. <address change> 1 3 2 4 SQS Client owned subscriptions SNS
  15. Broadcasting Uses Laravel events and broadcasting contracts Triggered using event(…)

    Generates payload from messaging standard Events have option to override
  16. Consuming Extends Laravel SQS queue functionality Queue workers automatically provisioned

    in base service Parse message body using messaging standard Route message to relevant event handler if present