Skip to content

Commit 595ec91

Browse files
committed
Updated Readme with new info for local testing
1 parent f80269f commit 595ec91

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

README.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,45 @@
2222
Provision a Lambda based relay script that will, self test, self deploy and consume SendGrid webhook endpoints and relay them to Mongodb's Atlas cloud service. Also included as part of the microservice is information on how to setup the AWS IAM policies with the least permissive [policy](.iam.md#example-policy) possible. The service is deployable using the Travis github hooks and will automatically test with local integrations of NodeJS and MongoDB that are stored within the docker containers.
2323

2424

25-
## Local Development via Docker with Mapped volumes
26-
The folder ./.docker folder contains the dev containers as well as the travis production containers. [**.env.example**](#process) must be populated when running in development as per the process below.
25+
## Local Dependancies
26+
1. npm
27+
2. Docker (optional but recommended)
2728

28-
### Local Dependancies
29-
1. Docker
30-
2. docker-compose
31-
3. npm
32-
33-
### Process
29+
## Process
3430
1. Copy .env.example to .env
35-
2. Update ENVIRONMENT to "development"
36-
3. Change TESTFILE location if desired
37-
4. Install NPM dependancies
31+
2. Check DATABASE points to valid MongoDB URI ([mongo setup](#mongo-setup))
32+
3. Install NPM dependancies
3833
```bash
3934
npm install
4035
```
4136

42-
5. Init Docker
37+
4. Test
4338
```bash
4439
# run test via local docker containers
45-
npm run test
40+
npm test
4641
# clean up containers
4742
npm run cleanup
4843
```
4944

50-
- This will run the lambda function with the 'event' argument data overwritten from the TESTFILE json.
51-
- docker exits when lambda function returns code (sendgrid_app_1 exited with code ~)
52-
- ~ = 0 = success;
45+
## Mongo Setup
46+
You can set the DATABASE environment variable to any valid Mongo connection URI.
47+
48+
However, it is recommend you test to a local isolated Mongo instance.
49+
50+
Via provided NPM script:
51+
```bash
52+
npm run setup-mongo
53+
```
54+
55+
Via Docker directly:
56+
```bash
57+
docker run --detach --name sendgrid-mongo --expose 27017 -p 127.0.0.1:27017:27017/tcp mongo
58+
```
5359

60+
To change local port due to any conflicts:
61+
- Update `127.0.0.1:27017` to `127.0.0.1:xxxxx` where `xxxxx` is new port.
62+
- Update .env connection string with new port
63+
- This can be ran manually, or updated in `package.json` for ongoing convenience
5464

5565
## Pending updates
5666
- [X] enforce unique index on sg_message_id

0 commit comments

Comments
 (0)