Starter kit with node, express, docker to use with Truce platform
- Configure AWS CLI.
- Install PM2 globally.
npm install pm2 -g - Node version required:
8.2.0
Read this document to set up linting in Sublime.
- Clone this starter kit.
git clone https://gitlab.com/transin/starter-kit-node - Run
npm install - Remove the
.gitfolder usingrm .git
- Add
.envfile to the local code - To start Development environment use
npm run dev - To stop use
Ctrl + C
- We are using keycloak (Enterprise level auth platfrom) for all auth purposes. Link
- Clone the repo
- Check if it runs locally without using docker
- Build image from code using
docker build -t <Image Name> . - Run the image using
docker run -it -p 3000:3000 -e PORT=3000 -e AWS_ACCESS_KEY="accesskey" -e AWS_SECRET_KEY="secretkey" --name <container name you want> <Image Name>
We are using PostGres hosted on AWS RDS for all RDMS purposes and DynamoDB for all nosql purposes.
All ECS instances have EFS integrated to it and mounted on /efs.
At the heart of our entire infrastructure we have Kafka to which you can read and write. We are using kafka-node module for integration.
Read more about how to connect kafka to our system here.
We are currently using redis as caching mechanism for all the services.
- We are using
winstonandmorgonfor logging - Please read this link before proceeding furthur.
- All server logs can be seen in cloud-watch in AWS, in the foleder
SERVICE_NAME-service - Deployment automatically creates a log folder in AWS Cloudwatch. You can into your AWS account and check the logs.
- Always use
logger.loginstead ofconsole.log
- Always implement
/pingapi for every microservice so that we can configure health checks on this url
https://www.codementor.io/olatundegaruba/nodejs-restful-apis-in-10-minutes-q0sgsfhbd https://scotch.io/tutorials/test-a-node-restful-api-with-mocha-and-chai
Copy the .env.sample to create a .env file
cp .env.sample .env
Update the .env details locally
In docker file for production: global install pm2 RUN npm start