$ npx eslint . --ext ts
✖ 4 problems (3 errors, 1 warnings)
I’m working on it, it’s not always possible to fix all the errors. My main problem is with a library that is not using TypeScript yet (for redis).
SonarQube is a platform for code quality and bug detection. It also provides dashboards and help to fix the problems.
The hardest rule to follow is to keep the complexity of each function at a maximum of 15. Each condition is adding points depending its complexity and its place in the code.
Deployment on the server
Ansible is a configuration management, it uses YAML to write rules and conditions. I appreciate it because it’s easy to write and to deploy, the side effect is that it can be slow to run.
Who doesn’t know the Docker containers?
Thanks to it, I can run the NodeJS version that I need, run multiple times the game on the same server and add a bit of security to the game. I prefer to use directly Docker (with compose) instead of Kubernetes because of the overhead. I might switch to Swarm in the future to get the benefits of an orchestractor.
Grafana is a very powerful visualization, I have dashboards to monitor the server:
- Ellas War, an API is called on a regular base to display the game’s metrics
- Redis, information about the Redis instance used by the game
Dozzle is a log viewer for Docker containers. Light, available via a web interface and easy to use.
I’m trying to use basic tools and to save as much as possible the resources of my server for the game. Unfortunately, I can’t run all theses services locally or on my servers, it would take to much resources and be too much work. In my next article I will talk about the external tools that I’m using.