This project is currently being refactored, performance and API will be unstable.
open-api is a graphQL API that will serve multiple purposes:
environment | url | method |
---|---|---|
staging | https://hxtsoafqna.execute-api.us-east-1.amazonaws.com/stage/api | GET |
staging | https://hxtsoafqna.execute-api.us-east-1.amazonaws.com/stage/graphql | POST |
production | ||
production |
We welcome pull requests 🎉! Please follow these steps to contribute.
Tokens are verified using public keys, each tenant will have their own certificate containing the public key.
Certificates are stored either on developer laptops in .env files, or in an environment variable
JWT_CERT for deployments. We use Travis for deployments, and scripts/deploy.sh
will pick either JWT_CERT_STAGE or JWT_CERT_PROD and export it as JWT_CERT. This
will be picked up and deployed by Serverless.
Certificates are base64 encoded to prevent encoding issues. This works around the fact that Travis uses Bash to export environment variables, which causes issues with newlines and other characters have a special meaning in shells.
To add a new certificate, download it as a .pem file, and base64 encode it. Use yarn encode-file
if you want a
convenient script:
â–¶ yarn encode-file ~/Downloads/freecodecamp-dev.pem
yarn run v1.6.0
$ node scripts/base64encode.js /Users/ojongerius/Downloads/freecodecamp-dev.pem
Original contents:
-----BEGIN CERTIFICATE-----
MIIDDzCCAfegAwIBAgIJGHAmUeq9oGcAMA0GCSqGSIb3DQEBCwUAMCUxIzAhBgNV
<SNIP>
zIPPbMj9c6D7tETg2ZeHEthScPsgoPSHXxYu5N9ImoY/KLjDD5Nk364e0M+ZT8rF
rbgxgxHNJH92enBwsqrq7CWi2Q==
-----END CERTIFICATE-----
Base64 encoded (copy this):
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpNSUlERHpDQ0FmZWdBd0lCQWdJSkdIQW1VZXE5b0djQU1B
<SNIP>
MzY0ZTBNK1pUOHJGDQpyYmd4Z3hITkpIOTJlbkJ3c3FycTdDV2kyUT09DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tDQo=
✨ Done in 0.23s.
And copy the base64 encoded string to your destination.
Deployment is normally done by CI.
If you want to do a manual deployment:
Configure your AWS credentials, see https://serverless.com/framework/docs/providers/aws/guide/credentials
Ensure that you have the serverless
package install globally
yarn global add serverless
Assert that the stages configured in serverless.yml
in line with what you'd like to deploy to, and run:
serverless --stage=YOUR_STAGE_HERE deploy
TBD
Copyright (c) 2018 freeCodeCamp.
The computer software in this repository is licensed under the BSD-3-Clause.