This repository contains a set of Node.js/Express services that provide a simple multi-tier application that lets you vote for using spaces versus tabs in code.
voting-frontendrenders the website using data fetched fromvoting-service-gateway.voting-service-gatewayrandomly toggles betweenvoting-service-greenandvoting-service-greenand passes the request through to the respective service.voting-service-greenprovides the access layer to MongoDB where the data is stored.voting-service-bluerepresents a faulty version and returns an error.
- This sample expects MongoDB to be running on
localhost:27017- please install the community edition following the instructions for your platform. - After downloading/cloning this repository open your console, change into the root of the repository and run
install.shto install all dependencies. This can take a while. - While still in the root directory, run
npx pm2 startOrRestart ecosystem.config.js. Answer "yes" if you are prompted ifpm2should be downloaded. - (To stop all services, run
npx pm2 stop ecosystem.config.js.)
- Copy .env-sample and rename it to
.env. - In Sentry, create the following projects and edit
.envto set the respective DSN:
browser(JS)frontend(Express)gateway(Express)service-green(Express)service-blue(Express)
- Restart all services by running
npx pm2 startOrRestart ecosystem.config.js.
The frontend at localhost:8080.
Use the buttons to cast your vote. Every time a ☠️ is shown instead of the tally, you hit the faulty service-blue.
If you can't access the frontend, or voting doesn't work, run pm2 status and look for a service with status error.
Do get the logs for a service, run pm2 logs servicename.
- Currently some transactions may show up as
<< unparameterized >>. - Currently the frontend traces don't connected to the backend traces.
