Sign inSign up

washpost/fusion-engine

By washpost

•Updated about 5 hours ago

Image
2

1M+

washpost/fusion-engine repository overview

⁠Engine

The engine Lambda is the core rendering component of the Fusion architecture. This is invoked with a Rendering object containing renderable Components (in this case, React Components) and associated content, which are then fused together to generate HTML.

Fusion supports multiple cache modes by writing the resulting HTML to S3. This allows the Fusion origin to either serve the HTML first or as a backup.

⁠Dependencies

  • AWS DynamoDB is where organization-specific renderings are persisted
  • React is currently the default renderer for the engine, but other templating engines, such as handlebars, are supported
  • @arc-fusion/prop-types⁠ are custom prop types for Fusion
⁠Local Development Dependencies

In local development, Mongo is used instead of DynamoDB. It is run inside a Docker container alongside the engine.

⁠Monitoring Dependencies

In Production mode, detailed visibility is provided using :

  • AWS XRay to generate Service Maps and Traces
  • Datadog for custom metrics

⁠Deployment

The engine Lambda is single-tenant and deployed using Maestro⁠. Deployment via Maestro will package the front-end Components (known as the Feature Pack) and the core engine code, which enables Fusion to generate static HTML.

⁠Routes

⁠Public API

Fusion has public HTTP endpoints, which are described in the API Documentation⁠.

⁠Admin API

The following routes are specifically used by the PageBuilder Admin UI.

⁠Configs

Configs describe the Components available in the PageBuilder Admin. These routes are read-only and return JSON.

  • GET /configs/chains
  • GET /configs/features
  • GET /configs/layouts
  • GET /configs/output-types
  • GET /configs/content/schemas
  • GET /configs/content/sources
⁠Resolvers

Resolvers are published from the PageBuilder Admin with a payload that contains all resolvers. This uploads the JSON to S3, which triggers the resolver-generator to rebuild the resolver Lambda.

  • POST /resolvers
⁠Properties

Site Properties are site-specific values that may be accessed anywhere in the bundle. These are essentially a replacement for Runtime Properties in PageBuilder Classic.

  • GET /properties

⁠Webpack

webpack is included in the engine Lambda and invoked on a Rendering when it is published.

⁠Directory Structure

This is the deployed directory structure:

/opt/
  engine/
    bundle/
      build/                    <-- server-only compiled bundle code
        components/
          combinations/
          output-types/
          fusion.json
        content/
          schemas/
          sources/
          fusion.json
        properties.js
      dist/                     <-- compiled bundle code for server and client
        components/
          combinations/
        configs/
          components/
            chains/
            features/
            layouts/
            output-types/
          content/
            schemas/
            sources/
        engine/
          admin.js
          polyfill.js
          preview.js
          react.js
        stats.json              <-- webpack stats output (local dev only)
        calls.json              <-- request tracing output (local dev only)
      generated/                <-- dynamically generated src files used as webpack entrypoints
        components/
          combinations/
        properties.js
      linked_modules/           <-- dynamically mapped volumes to support `npm link`
      node_modules/             <-- bundle modules built in docker image for cache optimization
      src/                      <-- the actual bundle repo
    environment/                <-- environment variables to be read by the Lambda
    lib/                        <-- fusion engine src
    node_modules/               <-- fusion engine modules
    src/
      index.js                  <-- entry-point invoked by serverless and AWS Lambda
    webpack/                    <-- webpack config, executed on Compiler Lambda
    stages/
    static/                     <-- webpack static artifacts (local dev only)

Notes:

  1. use /opt to prepare for possible use of lambda layers
  2. do not put build/ or dist/ under bundle/ to prevent runtime prioritization of bundle modules over engine versions

Tag summary

Content type

Image

Digest

sha256:75a96865e…

Size

261.6 MB

Last updated

about 5 hours ago

docker pull washpost/fusion-engine:latest-canary