This repository is for the backend for OneChatClient
.
All the values in ./.env.example
files must be set as an environment variable; otherwise, the app will crash with an error.
$ yarn
$ yarn build
The above commands will build this typescript project into the ./dist
directory, from where the app can be hosted.
The project also has Docker
support for a better hosting experience.
$ docker build -t onechat:latest .
$ docker run -d --name onechat --env-file .env -p "8000:8000" onechat:latest
$ docker stop onechat # Stops the container
$ docker container rm onechat
$ docker image rm onechat:latest
Docker compose file is also provided for hosting a PostgreSQL
database along with the app.
$ docker compose up -d --build # Starts up the container in background
$ docker compose down # Stops the container
In order to delete the Docker volumes, use the -v
flag in the down
command.
This repository contains an monitoring-stack.yml
file, which is a Docker Compose file for creating containers for prometheus, grafana, grafana-loki and node-exporter.
# Starting the containers
$ docker compose -f ./monitoring-stack.yml up -d
# List all running containers
$ docker ps
# Stopping the containers
$ docker compose -f ./monitoring-stack.yml down
Grafana provides an Web UI for monitoring the metrics; it can be accessed at http://<your_ip_here>:3000
with the default username and password as admin
- Prometheus -
9090
- Grafana Loki -
3100
- Node Exporter -
9100
NOTE node-exporter
should be hosted along with the application server, not with the monitoring stack. The project's monitoring stack assumes that both the monitoring stack and the application server run on the same physical device.
The project also includes grafana dashboards, which are given below and can be used to create a simple dashboard for visualizing metrics.
- nodejs: Modified version of
11159
at grafana-dashboard.json - node-exporter:
1860
Secure the /metrics
route by placing a reverse proxy like nginx
to block requests from unknown places.