45

Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content
Page 2: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Migrating Legacy.comMigrating a top 50 most visited site in

the U.S. onto Drupal - Legacy.com

Case Study

Page 3: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Migrating Legacy.comJordan Ryan

Product Owner

Ankur GuptaLead Developer

Bassam IsmailFront-end

Lakshmi NarasimhanRESTful Services

Hussain AbbasMigration

Page 4: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Who is Legacy?

Page 5: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Why Drupal

Page 6: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Why Decoupled

Legacy looks to innovate on the Front-End

Page 7: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Why Decoupled

Content was a small part of a much larger ecosystem

Page 8: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Why Decoupled

Using React/Node lent itself to componentized widgets that

needed services

Page 9: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Why Decoupled

Legacy wanted to own the data and platform

Page 10: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

What we did

● Discovery● Architecture● Site building and development● Migration● API development● Performance optimization● FE/BE Staff Augmentation

DELIVERY TIMELINE < 6 months

Page 11: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Key Challenges

Managing teams with different velocities

Page 12: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Key Challenges

Managing presentation in a decoupled system

Page 13: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Key ChallengesManaging SEO Value in

Decoupled system - how to deliver SEO value to a headless

application

Page 14: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Key Challenges

Versioning API’s

Page 15: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Key Challenges

Varying page elements depending on affiliates

Page 16: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Key Challenges

Cache Invalidation

Page 17: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Key Challenges

React doesn’t like HTML. Componentized HTML for

react elements.

Page 18: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Discovery● Value Driven Development● API designs first● Drupal as a platform solution● Extracting 15 years of complex

business logic● Infrastructure

○ Akamai○ AWS○ Latisys, .NETO

ur M

etho

ds

Page 19: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Development

METHODOLOGY: SCRUM

Our

Met

hods

Page 20: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Development

Overcommunicate

Our

Met

hods

Page 21: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

DevelopmentFew Drupal best practices

● Consistent environments● Established git workflow

○ Release notes● Drush build script● Feature driven development● Checklists● Environment module

80+ CONTRIBS 40+ CUSTOM

Our

Met

hods

Page 22: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Development

Page 23: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

RESTfulWhy choose RESTful?

● Developer friendly.● Allows customizing every aspect of

API, like auth, headers, versioning, caching.

Page 24: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

RESTfulSpecifications and testing

● An API is only as good as its documentation.

● RAML - standard format to share and maintain API specs.

● It is possible to write Drupal Web test cases over RAML!

Page 25: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

RAML

Page 26: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

RESTfulAuthentication

● RESTful allows any kind of authentication scheme

● We wrote our own for performance reasons.

Page 27: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

RESTfulVersioning

● serves same purpose as interfaces, i.e. honor a contract.

● RESTful allows versioning on a per resource basis

● Each payload change bumps up minor version number.

Page 28: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

RESTfulChallenges

● Problem statement: given a URL alias, fetch the corresponding resource

● Hard bits: handle redirects, 404s, get metatags

Page 30: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

RESTful PanelsO

ur M

etho

ds ● Presentation Framework● Use Panels to administer content

and layout on a decoupled Drupal website.

● Supports Panelizer.

Page 31: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

RE

STfu

l Pan

els

Page 32: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

restful_panels

RE

STfu

l Pan

els

RestfulPanelsDataProviderDisplay

RestfulPanelsPanelizer RestfulPanelsDisplay(ready to use endpoint)

ctools

StructuredRenderer

Standard Panels Renderer

restful_panels

Page 33: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

restful_panels

RE

STfu

l Pan

els

LegacyPaneLandingPage

Processes input data and passes node id to RestfulPanelsPanelizer.

RestfulPanelsPanelizer

ctools

legacy_pane

restful_panels

legacy_pane(ctools content type)

Renders JSON if in context of RESTful

Panels.

Page 34: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

RESTful PanelsO

ur M

etho

ds ● Contributed and available for use: https://www.drupal.org/project/restful_panels

● Future plans○ Usage with context○ Metatags○ Panels Variants

Page 35: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

MigrationO

ur M

etho

ds ● Migration from MSSQL Server● Transforming content structure● Map everything based on complex

business logic ● Migration groups● Some numbers:

○ ~2500 articles○ ~5,000 media items○ ~200 galleries○ ~4,000 gallery items○ ~1,100 affiliates

Page 36: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Front-end

Page 37: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Front-endWhy

● Performance● Developer Productivity

Page 38: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Front-endWhy: Performance

● Performance*○ Page load time○ Native (like) experience on the web

Page 39: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Front-endWhy: Developer Productivity

● Composition○ Easy to compose○ Event delegation and inline styles○ No global scope in pre CSS-Modules era using

Stylus

● Testing○ ui = f(state, […actions])○ Easy to simulate events○ Testing against virtual and real DOM

Page 40: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Front-endSolutions

● Server-side rendering○ SEO for SPA○ Improved Initial page load time○ Easy to Cache

Page 41: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Front-endSolutions

● Drupal○ Data source○ Layout configuration source

Page 42: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Front-endSolutions

● React○ Parsing raw HTML on Drupal Layer○ Schema.org compliance○ Help avoid content injection

Page 43: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

Final Thoughts● CI/CD best practices● Personalized Decoupled Drupal

requires specialized infrastructure / middleware

● Architecture across 2 systems● Considerations with points of

failure● Progressively develop Decoupled

solutions

Page 44: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

QUESTIONS?

Page 45: Migrating Legacy - DrupalCon · RESTful Services Hussain Abbas Migration. Who is Legacy? Why Drupal. Why Decoupled Legacy looks to innovate on the Front-End. Why Decoupled Content

asia2016.drupal.org/schedule

https://events.drupal.org/node/7536