You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,8 +35,9 @@ We use the following tools:
35
35
during the build and write the results to a cache file to be included in the
36
36
bundle; then when the Lambda service starts up it can read from the cache
37
37
rather than introspecting the database again.
38
+
- serverless.js (optional) - for automated AWS deployments.
38
39
39
-
## Building lambda.zip
40
+
## Setup
40
41
41
42
First clone this repository locally, and install dependencies:
42
43
@@ -50,18 +51,25 @@ Next, set up a `.env` file matching your environment:
50
51
cp .env.template .env
51
52
```
52
53
53
-
And modify the `src/postgraphileOptions.js`file to your taste.
54
+
And modify the `src/postgraphileOptions.js`and `serverless.yml` files to your taste.
54
55
55
-
Finally run:
56
+
## Automatic Deployment with Serverless.js
57
+
58
+
#### Deployment Prerequisites
59
+
60
+
-[serverless](https://serverless.com/framework/docs/providers/aws/guide/installation/) - `yarn global add serverless`
61
+
62
+
After configuring your `.env` file, ~/.aws/credentials, and postgraphileOptions.js, you can deploy to AWS using serverless.js by running:
56
63
57
64
```
58
-
yarn build
65
+
yarn deploy
59
66
```
60
67
61
-
This will result in a `lambda.zip` file that you can upload to Amazon Lambda.
68
+
## Setting up a Lambda endpoint manually
62
69
63
-
## Setting up a Lambda endpoint
70
+
If you prefer not to use the serverless.js framewwork, you can also deploy your lambda function manually.
64
71
72
+
0. Run `yarn build` to create `lambda.zip` file that you can upload to Amazon Lambda.
65
73
1. Visit https://console.aws.amazon.com/lambda/home and click 'Create function'
66
74
2. Select "Author from scratch" and give your function a name, select the most recent Node.js release (at least 8.10+), create (or select) a role (I granted "Simple microservice permissions")
67
75
3. Click "Create function" and wait about 15 seconds; you should be greeted with a "Congratulations" message.
@@ -171,7 +179,7 @@ Do the same as for the test, but instead of running `yarn test` at the end, inst
171
179
yarn sam
172
180
```
173
181
174
-
This will set up a local GraphQL endpoint at http://127.0.0.1:3000/
182
+
This will set up a local GraphQL endpoint at http://127.0.0.1:3000/graphql
175
183
176
184
You can then use a GraphQL client such as Altair or GraphQL Playground to issue requests.
0 commit comments