It is a simple HTTP API that allows Doppler client side services to register what features the user access to, and expose a summary.
This is our first production Doppler service based on Node.js running on AWS Lambda and API Gateway using the Serverless Framework.
See https://github.com/FromDoppler/aws-node-http-api-project for details about related POC.
For the moment, we decided to share a bucket for all lambda functions in the same environment, so we have three:
doppler-fun-int-us-east-2
doppler-fun-qa-us-east-2
doppler-fun-production-us-east-2
Each of them has been created manually using the S3 Buckets page.
We are using a custom domain for each environment:
{custom-domain}.fromdoppler.com/lambdas-poc/
➡lambdas-poc-production
API{custom-domain}qa.fromdoppler.net/lambdas-poc/
➡lambdas-poc-qa
API{custom-domain}int.fromdoppler.net/lambdas-poc/
➡lambdas-poc-int
API
Our custom domain is managed by Cloudflare.
- Create a certificate
- Validate certificate
- Create custom domain in AWS
- Add DNS to the custom domain
- Configure mappings
Now it is done by code 😀
$ serverless deploy
After deploying, you should see output similar to:
Deploying doppler-system-usage to stage dev (us-east-1)
✔ Service deployed to stack doppler-system-usage-dev (152s)
endpoint: GET - https://xxxxxxxxxx.execute-api.us-east-2.amazonaws.com/
functions:
hello: doppler-system-usage-dev-hello (1.9 kB)
After successful deployment, you can call the created application via HTTP:
curl https://xxxxxxx.execute-api.us-east-2.amazonaws.com/
Which should result in response similar to the following (removed input
content for brevity):
{
"message": "Go Serverless v2.0! Your function executed successfully!",
"input": {
...
}
}
You can invoke your function locally by using the following command:
serverless invoke local --function hello
Which should result in response similar to the following:
{
"statusCode": 200,
"body": "{\n \"message\": \"Go Serverless v3.0! Your function executed successfully!\",\n \"input\": \"\"\n}"
}
Alternatively, it is also possible to emulate API Gateway and Lambda locally by using serverless-offline
plugin, you can start local emulation with:
serverless shn run-offline.sh
To learn more about the capabilities of serverless-offline
, please refer to its GitHub repository.