Giter Club home page Giter Club logo

lightberg's Introduction

Lightberg

Lightberg is a proof of concept using Google's lighthouse with AWS Lambda and Terraform to create an automated way to test and review many sites at once.

The basic set up for this should be;

  • Update vars.tf with your own bucket names
  • Run the terraform plan
  • Post the JSON to AWS API Gateway (see lambda_example_events/api_example.json)
  • Get back both the HTML and JSON reports for each URL
  • Get an overall report HTML page linking to each report
  • Profit!?

I say should be as the terraform plan is very much a work in progress, but the individual lambda functions work, the SNS topic and step functions should also be generated.

Architecture

The architecture is pretty straight forward.

  • JSON Posted to AWS API Gateway
  • AWS API Gateway to a lambda function that parses the JSON and kicks off a fanout function
  • Fanout function generates both HTML and JSON reports into different (if you like) S3 buckets
  • Step function creates an overview report so you can navigate the results. This is saved at the root of the HTML S3 Bucket (index.html) Architecture Diagram

Example JSON to post

A simple example of the JSON to post. By default you need a "project" (in this case "example.com" or "example.org") and an array of URLs and names for the URL within that project.

{[
  "example.com": {
    "urls":[
      {
        "url": "https://www.example.com/",
        "name": "Homepage"
      },
      {
        "url": "https://www.example.com/foobar",
        "name": "Foobar Example"
      }
    ]
  },
  "example.org": {
    "urls":[
      {
        "url": "https://www.example.org/",
        "name": "Homepage"
      },
      {
        "url": "https://www.example.org/foobar",
        "name": "Foobar Example"
      }
    ]
  }
]}

Remember this is a proof of concept!

I can not stress this enough, this is a proof of concept. AWS has many hard and soft limits on many of the systems used (e.g total number of concurrent Lambda process that can run in parallel, size of the decompressed lambda function, etc). I've not set any limits to stop you from hitting them. Please, please, make sure your API Gateway has a some form of security on it. Don't try an put all the URLs from 100 of your favourite site's sitemap.xml file into this. Finally, if you suddenly find you're in debt to AWS for lots of cash and blame this system for that, I can only suggest setting up alarm billing as something you need to do right now.

TODO

  • Get the API gateway into terraform...
  • Add in a AWS Quicksight default dashboard based on the JSON reports so you can track over time, etc.
  • Likely change the system when lighthouse v3 gets released.

lightberg's People

Contributors

mcvicar avatar dependabot[bot] avatar

Stargazers

Nicholas Avenell avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.