GrafanaPostMod/README.md

43 lines
1.6 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GrafanaPostMod
A simple mod that tracks live player counts for your BepInEx modpack.
# ⚠Please Read!⚠️
This mod is for those who run bigger projects, nobody is expected to use this mod unless they like seeing cool numbers go up.
You'll need the following things in order to begin:
- An exposed server for the backend (PLEASE DO NOT EXPOSE YOUR HOME IP)
- A web domain (I suppose it's not REQUIRED if you really want to do it over IP, but never recommended)
- A Grafana instance
- A Prometheus instance
- dotnet v8.0.406
I may be willing to host backends and maybe even grant a subdomain to some modpack developers, however I cannot do this for everyone.
# Building the mod
1. Modify `plugin.cs` on line 16. Replace `https://stats.yourdomain.com` with the subdomain you intend on using for your backend. (Keep `/api/players` there)
2. Modify `Grafana.csproj` and change the Reference paths to your correct directories. You can reference the following games in order to build this project:
- Lethal Company
- Content Warning
- R.E.P.O
There may be more, but those are the ones I know off the top of my head.
3. Open a terminal window in the directory of `Grafana.csproj` and run: `dotnet build .\Grafana.csproj`
The output .dll will be in `obj\Debug\netstandard2.1`
# Setting up the backend
Upload the backend files to a system you plan on running it on, keep in mind it needs to be public facing (I personally recommend a reverse proxy so that the IP isn't just sitting there)
1. Run `npm i` in the same directory as the backend files
2. Run `npm i pm2 -g` then run `pm2 run ./start.sh --name PostBackend` and finally run `pm2 startup`
3.