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-frontend
renders the website using data fetched fromvoting-service-gateway
.voting-service-gateway
randomly toggles betweenvoting-service-green
andvoting-service-green
and passes the request through to the respective service.voting-service-green
provides the access layer to MongoDB where the data is stored.voting-service-blue
represents 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.sh
to 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 ifpm2
should 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
.env
to 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.