An open API service indexing awesome lists of open source software.

https://github.com/fiverr/lighthouse-scores-to-email

Send simple PageSpeed scores to your email
https://github.com/fiverr/lighthouse-scores-to-email

cli docker lighthouse pagespeed pagespeed-insights-api

Last synced: 23 days ago
JSON representation

Send simple PageSpeed scores to your email

Awesome Lists containing this project

README

        

# lighthouse-scores-to-email [![](https://user-images.githubusercontent.com/516342/75164343-59cb6900-5729-11ea-80f1-392b57445ab2.png)](https://hub.docker.com/r/fiverr/lighthouse-scores-to-email) [![](https://circleci.com/gh/fiverr/lighthouse-scores-to-email.svg?style=svg)](https://circleci.com/gh/fiverr/lighthouse-scores-to-email)

Get [Lighthouse scoring](https://developers.google.com/web/tools/lighthouse/v3/scoring) via [Google PageSpeed Insights](https://developers.google.com/speed/docs/insights/v5/about) delivered to your email.

| ![](https://user-images.githubusercontent.com/516342/75387150-8dee8780-58eb-11ea-8780-a359edabe262.png)
| -

## Configurations

Add email and general configurations to `/configuration/config.js`
Add pages configurations to `/configuration/pages.json`

Example configuration files

> #### configuration/pages.json
> ```json
> {
> "Example": "https://example.net/",
> "Start Page" : "https://www.start.co.il"
> }
> ```

> #### configuration/config.json
> ```json
> {
> "email": {
> "to": "[email protected]",
> "authUser": "[email protected]",
> "authPassword": ""
> },
> "lightHouseApiKey": ""
>}
>```

To load configurations during run time from external file, use docker volume.
```
-v "$(pwd)"/pages.json:/usr/src/app/configuration/pages.json
```

## getting-started with Docker

```
docker pull fiverr/lighthouse-scores-to-email:latest
```

Export your variables to the environment and pass them through alongside your pages.json file
```
docker run \
-v "$(pwd)"/pages.json:/usr/src/app/configuration/pages.json \
-e APIKEY \
-e AUTH_USER \
-e AUTH_PASSWORD \
-e EMAIL_TO \
-e STATSD_HOST \
-e STATSD_PORT \
fiverr/lighthouse-scores-to-email:latest
```

Or send as config file
```
docker run \
-v "$(pwd)"/pages.json:/usr/src/app/configuration/pages.json \
-v "$(pwd)"/config.json:/usr/src/app/configuration/config.json \
fiverr/lighthouse-scores-to-email:latest
```

## Get your credentials here

Get your [PageSpeed API key](https://developers.google.com/speed/docs/insights/v4/first-app).

Use Gmail with Google's [app passwords](https://support.google.com/accounts/answer/185833).

## Set up environment variables or configuration using config file

| Env Variable | Config File path | Value | Default
| - | - | - | -
| `APIKEY` | `lightHouseApiKey` | SpeedTest [API Key](https://developers.google.com/speed/docs/insights/v4/first-app) | __Mandatory__
| `AUTH_USER` | `email.authUser` | Email username | None
| `AUTH_PASSWORD` | `email.authPassword` | [App password](https://support.google.com/accounts/answer/185833) | None
| `EMAIL_TO` | `email.to` | Recipient Email address | None
| `EMAIL_FROM` | `email.from` | Sender Email address | `Lighthouse Gazette `
| `EMAIL_SUBJECT` | `email.subject` | Subject of the email | `Google LightHouse Report ✔`
| `EMAIL_HOST` | `email.host` | SMTP host | `smtp.gmail.com`
| `EMAIL_PORT` | `email.port` | SMTP port | `465`
| `STATSD_HOST` | `statsd.host` | StatsD hosname | None
| `STATSD_PORT` | `statsd.port` | StatsD port | `8125`
| `STATSD_PREFIX` | `statsd.prefix` | Custom prefix to metric | `lighthouse_scores_to_email`
| `SECURE` | `email.secure` | Should use SSL | `true`
| - | `categories` | [Lighthouse categories](https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed#category) | `['PERFORMANCE', 'SEO', 'ACCESSIBILITY', 'BEST_PRACTICES']`
| - | `strategies` | [Lighthouse strategies](https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed#category) | `['MOBILE', 'DESKTOP']`

## Add links to your email (for example, links for grafana)

> #### configuration/config.json
> ```json
> {
> "email": {
> "list": [
> {
> "text": "Email provided by Fiverr SRE team",
> "url": "https://play.grafana.org/"
> },
> {
> "text": "View trends on Grafana dashborad",
> "url": "https://play.grafana.org/"
> }
> ]
> }
> }
>```