petabencana / cognicity-serverless

API Services for Cognicity with serverless framework
0 stars 3 forks source link

cognicity-serverless

API Server for CogniCity

Summary

This is the NodeJS serverless function which is deployed uses lambda and AWS API Gateway to route the requests , which runs the CogniCity Data API used by Urban Risk Map instances, such as PetaBencana.id site.

Run

  1. Install requirements from the provided package.json by doing npm install.

  2. Copy the env.sample file to a local .env and fill-in the required parameters. This local file will be ignored by Git and so should be secret safe. Further details on configuration are described below.

  3. To run a local development instance of the server do serverless offline start --param="service={NAME OF THE SERVICE}"

  4. Also make sure to check for the Comments in the following files which needs to be commented out for running it locally

Configuration

Server configuration parameters are stored in a configuration file which is parsed by index.js on startup. Local configuration parameters are imported from the dev.env.yml into src/config.js. See config.js for full details example configuration. Any variable not defined in dev.env.yml will pickup the default value below (also see config.js)—note that local environment variables will override both .env and config.js. The following environment variables are currently supported by the configurtion:

Create a dev/stage/prod.env.yml file , the database configurations are picked up from this file and any env needed for env can be added here before deploying

Package management

Before deployment:

Release

The release procedure is as follows:

API Notes

Full API documentation at https://docs.petabencana.id. This documentation is stored in the petabencana-docs repository.

The swagger files under /apigw describe the API in swagger format (with AWS API Gateway extensions) for each of our deployments. For a new or updated deployment, the references to the (Elastic Beanstalk) hostnames and Lambda Amazon Resource Names will need to be updated first before import, and then permissions to trigger Lambdas granted to the API.

License

See LICENSE.md