зеркало из
1
0
Форкнуть 0

chore(docs): Point README at monorepo

This commit is contained in:
Shane Tomlinson 2019-04-03 07:01:35 +01:00 коммит произвёл GitHub
Родитель ffeea8e7c3
Коммит 058939c86c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 2 добавлений и 129 удалений

131
README.md
Просмотреть файл

@ -1,130 +1,3 @@
# fxa-email-event-proxy
# This repository has been migrated to https://github.com/mozilla/fxa/tree/master/packages/fxa-email-event-proxy
[![Build Status](https://travis-ci.org/mozilla/fxa-email-event-proxy.svg?branch=master)](https://travis-ci.org/mozilla/fxa-email-event-proxy)
[![CircleCI](https://circleci.com/gh/mozilla/fxa-email-event-proxy/tree/master.svg?style=svg)](https://circleci.com/gh/mozilla/fxa-email-event-proxy/tree/master)
This repo proxies events
from the [Sengrid Event Webhook](https://sendgrid.com/docs/API_Reference/Event_Webhook/event.html)
and the [SocketLabs Notification API](https://www.socketlabs.com/api-reference/notification-api/)
to our SES bounce, complaint and delivery queues.
In doing so,
it acts as a bridge
that enables our existing queue-processing logic
in [`fxa-email-service`](https://github.com/mozilla/fxa-email-service)
to handle notifications that originate from Sendgrid and SocketLabs.
It runs in AWS Lambda,
behind an API Gateway trigger.
Note that events from
only one of either Sendgrid or SocketLabs
can be processed by any single instance
of this code.
If you want to process both,
you'll need to configure
two separate instances.
## Dev environment
The code runs in node.js
version 8 or later.
Assuming that you have
node and npm
set up already,
you can install the dependencies locally
like so:
```
npm i
```
You can run the tests
like so:
```
npm t
```
You can manually build
a zip bundle for Lambda
like so:
```
npm run build
```
## Tagging releases
```
git tag -a v1.$TRAIN.$PATCH
git push origin v1.$TRAIN.$PATCH
```
This will kick off a build [in CircleCI](https://circleci.com/gh/mozilla/fxa-email-event-proxy).
## Setting up Lambda
1. Run `npm run build`
to create a zip archive,
or use a pre-built artifact
from the tag build in CI.
2. Create a new Lambda function.
Upload the zip.
3. Assign it roles to access CloudWatch Logs
and SQS bounce, complaint and delivery queues..
4. Set environment variables:
* `AUTH`:
Random authentication string
used to block requests.
By including the same string
in your requests from Sendgrid/SocketLabs
as the value of an `?auth=` query parameter,
you can ensure that only valid traffic
is able to send events successfully.
* `PROVIDER`:
Name of the provider
this instance will handle requests from.
Valid values are `sendgrid` and `socketlabs`.
* `BOUNCE_QUEUE_URL`:
URL of the bounce SQS queue
* `COMPLAINT_QUEUE_URL`:
URL of the complaint SQS queue
* `DELIVERY_QUEUE_URL`:
URL of the delivery SQS queue
You can also set explicit values
for `SQS_ACCESS_KEY`, `SQS_SECRET_KEY` and `SQS_REGION`
if necessary.
5. If it's for SocketLabs,
also set these environment variables
based on settings available
in the SocketLabs control panel:
* `SOCKETLABS_SECRET_KEY`
* `SOCKETLABS_VALIDATION_KEY`
6. Create an API Gateway trigger.
Then configure Sendgrid or SocketLabs
to use that URL for the webhook.
Config should look something like this at the end:
<img width="1281" alt="Screenshot showing AWS Lambda config to set up fxa-email-event-proxy for Sendgrid" src="https://user-images.githubusercontent.com/64367/43510256-fd421898-956c-11e8-9e19-a9066152d8c2.png" />
You can see working example Lambda functions
in the dev IAM:
* Sendgrid:
https://console.aws.amazon.com/lambda/home?region=us-east-1#/functions/fxa-sendgrid-event-proxy?tab=graph
* SocketLabs:
https://console.aws.amazon.com/lambda/home?region=us-east-1#/functions/fxa-socketlabs-event-proxy?tab=graph
Please file issues and open pull requests against https://github.com/mozilla/fxa