Advertisement

Project Phoenix - From PHP to the Play Framework in 3 months

Reactive Systems Consultant at manuel.bernhardt.io
Jun. 26, 2014
Advertisement

More Related Content

Advertisement
Advertisement

Project Phoenix - From PHP to the Play Framework in 3 months

  1. @elmanu#playframework From PHP to the Play Framework in 3 months Manuel Bernhardt @elmanu http://manuel.bernhardt.io
  2. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Summary & Future
  3. @elmanu#playframework Your speaker •Freelance software consultant based in Vienna ! •Web, web, web •Scala, Akka, Play Framework ! •Vienna Scala User Group ! •Open-Source
  4. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Summary & Future
  5. @elmanu#playframework Talenthouse •www.talenthouse.com ! •based in Los Angeles ! •connecting brands and artists ! •3+ million users
  6. @elmanu#playframework Background •Problems with the old site • Slow • Developed by an external company • Hard to evolve
  7. @elmanu#playframework Background •Solution: new site! • Scala • Play Framework • AngularJS • elasticsearch • …
  8. @elmanu#playframework Background •A few interesting aspects • Source code may not be available • Data spread out in many places • Only 3 months time
  9. @elmanu#playframework Background •A few interesting aspects • Source code may not be available • Data spread out in many places • Only 3 months time
  10. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Methodologies & Tools • Summary & Future
  11. @elmanu#playframework Building the new platform
  12. @elmanu#playframework Building the new platform
  13. @elmanu#playframework
  14. @elmanu#playframework • MVC framework ! • Compile as much as possible • “Reactive”
  15. @elmanu#playframework http://www.reactive-manifesto.org
  16. @elmanu#playframework Load balancer
  17. @elmanu#playframework Load balancer
  18. @elmanu#playframework Building the new platform Data access?
  19. @elmanu#playframework Building the new platform Anorm Data access? Squeryl
  20. @elmanu#playframework Building the new platform Anorm Data access? Squeryl
  21. @elmanu#playframework Building the new platform Anorm Data access? Squeryl SORM Tiramisu
  22. @elmanu#playframework Building the new platform • Started with Anorm • Too verbose ! • Switched to Slick • Plain SQL with neat string interpolation • DSL for composing queries
  23. @elmanu#playframework Building the new platform def fetchItemWithRelevanceSort(userId: Long, skip: Int, limit: Int)! (implicit s: Session): List[Item] = {! val q = for {! i <- items if !i.deleted! ! && i.visible_on_profile! ! && i.user_id === userId! } yield i! ! q.sortBy(item => (item.selected.desc, item.created_on.desc))! .drop(skip)! .take(limit)! .list! ! }
  24. val query = sql"""! with invites_for_market as (! select #$inviteSL, #$inviteMarketSL! from invite i! inner join invite_market im! on i.id = im.invite_id! and im.market_id = ${marketId.id}! where i.art_type = ${artType.toString}! and i.visibility_state = ${InviteVisibilityState.Public}! and i.deleted = false! order by i.submission_start desc, i.id desc! limit $limit! offset $skip! )! ! select ifm.*, #$localInviteSL! from invites_for_market ifm! inner join local_invite li! on ifm.id = li.invite_id! and li.completed = true! order by ifm.submission_start desc, ifm.id asc! """! val queryResults = query.as[(Invite, InviteMarket, LocalInvite)].list!
  25. @elmanu#playframework Building the new platform Front-end & UI
  26. @elmanu#playframework Building the new platform Front-end & UI
  27. @elmanu#playframework Building the new platform Front-end & UI
  28. @elmanu#playframework Building the new platform • Recently open-sourced by Facebook ! • Virtual DOM, fast ! • Very easy to integrate in a page (less invasive than Angular) ReactJS
  29. @elmanu#playframework Building the new platform Front-end & UI
  30. @elmanu#playframework Building the new platform • Build pipeline using gulp.js & bower ! • Assets pipeline • LESS compilation • JS minification • Upload assets to Cloudfront • Integrates translations from Crowdin • Washes the dishes
  31. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Summary & Future
  32. @elmanu#playframework Data migration: source system(s)
  33. @elmanu#playframework Data migration: source system(s)
  34. @elmanu#playframework Data migration: source system(s)
  35. @elmanu#playframework Data migration: source system(s)
  36. @elmanu#playframework Data migration: source system(s)
  37. @elmanu#playframework Data migration: source system(s)
  38. @elmanu#playframework Data migration: source system(s)
  39. @elmanu#playframework Data migration: source system(s)
  40. @elmanu#playframework Data migration: migration schedule
  41. @elmanu#playframework Data migration • Akka to the rescue! ! • Concurrent user migration ! • Concurrent item migration • Using Play’s WS library for async calls to Youtube and friends
  42. @elmanu#playframework Data migration User migrator Worker Worker Worker Worker Worker
  43. @elmanu#playframework Data migration Item migrator
  44. @elmanu#playframework Data migration Item migrator User item migrator User item migrator User item migrator
  45. @elmanu#playframework Data migration Item migrator Item migration worker User item migrator User item migrator User item migrator Item migration worker Item migration worker Item migration worker Item migration worker Item migration worker
  46. @elmanu#playframework Data migration Item migrator Item migration worker User item migrator User item migrator User item migrator Item migration worker Item migration worker Item migration worker Item migration worker Item migration worker File fetcher File fetcher
  47. @elmanu#playframework Data migration Item migrator Item migration worker User item migrator User item migrator User item migrator Item migration worker Item migration worker Item migration worker Item migration worker Item migration worker File fetcher File fetcher File uploader File uploader
  48. @elmanu#playframework Data migration Item migrator Item migration worker User item migrator User item migrator User item migrator Item migration worker Item migration worker Item migration worker Item migration worker Item migration worker File fetcher File fetcher File uploader Soundcloud worker File uploader
  49. @elmanu#playframework Data migration
  50. @elmanu#playframework Agenda • Background • Building the new platform • Data migration • Operations • Summary & Future
  51. @elmanu#playframework Operations Operations
  52. @elmanu#playframework Operations
  53. @YourTwitterHandle#DVXFR14{session hashtag} @elmanu#playframework Sum m ary & Future
  54. @elmanu#playframework Summary & Future • Play Framework does not get in the way • Easy to deploy and operate • Many, many integrations ! • Many plans for the future • Live activity feed • Similarity search ! • Talenthouse is hiring!
  55. @YourTwitterHandle#DVXFR14{session hashtag} @elmanu#playframework Q & A
Advertisement