This is a demo microservice with products, shoes, and reviews for sample data.
- Install Docker [https://www.docker.com/products/container-runtime]
- Clone the Repo [https://github.com/zizzle6717/shoes-app.git]
- Create a local .env file and verify node version with
npm run env:init
- Update the newly created .env file with your local environment variables
npm install
in the root directory
- Install Postres and Redis locally
- Optionally use the included docker run scripts in the package.json
- ie. In a separate terminal
npm run docker:run:redis
- ie. In another separate terminal
npm run docker:run:postgres
- Startup Commands
npm run init
(This will generate documentations and populate the database with tables and a few records)npm run build:watch
(watches files for changes and hot module reloads)- In yet another terminal run
npm start
- If running postgres/redis with docker, your setup might look like this... Hot module reloading is configured to restart the app each time a file change is saved.
Assuming you have kubectl installed on your local machine along with minikube or docker-desktop, run the following to commands...
- Apply the mandatory ingress-nginx config.
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
(https://kubernetes.github.io/ingress-nginx/deploy/#prerequisite-generic-deployment-command) - Apply the config files from
/k8s
withkubectl apply -f k8s
TODO: Configure Skaffold
Swagger documentation can be found by visiting http://localhost:7000/docs/
. Replace with the port from you local environment variables.
Run all tests with npm run test
. Also run unit tests only with npm run test:unit
or integration tests only with npm run test:integ
.
Coverage can then be found by visiting http://localhost:7000/coverage/
Use this endpoint to check that the service is running http://localhost:7000/_healthz
Real-time metrics can be found by visiting http://localhost:7000/appmetrics-dash/
Logging can be configured by setting the appropriate environment variables in the .env
file.
To view logs locally in the console, set LOGGING_HOST=console
and set the log level such as LOGGING_LEVEL=info
.
For production or logging with a pre-production instance, LOGGING_HOST
should be the elastic search client node.
Github is configured to build and test each time changes are committed and pushed.
Modify the included .travis.yml
to reconfigure.