Bumps [Microsoft.AspNetCore.Authentication.JwtBearer](https://github.com/dotnet/aspnetcore) from 5.0.4 to 5.0.9. - [Release notes](https://github.com/dotnet/aspnetcore/releases) - [Commits](https://github.com/dotnet/aspnetcore/compare/v5.0.4...v5.0.9) --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Authentication.JwtBearer dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]>
WotBlitzStatisticsPro
Detailed player & tank statistics and history for World of Tanks: Blitz
- Uses Wargaming API Service for gathering players statistics
- Stores statistics snapshots in local database
- Allows to view players, their tanks and achievements statistics, and how it was change in time
Technologies used:
- Backend - GraphQL API based on .NET 5.0 Web server (GraphQL HotChocolate + MongoDB)
- Frontent - Blazor WebAssembly + Radzen components
Local MongoDB Installation for debugging (Docker desktop for Windows)
For the developing and debugging purposes, you have to istall MongoDB locally on your dev machine and run it as a service. Alternatively, if you have istalled Docker desktop for Windows, you can deploy MongoDB inside the container. To do so, create an empty folder and make 2 files there: docker-compose.yml and .env. Second one will contain sensitive data.
Example for docker-compose.yml with mongo-express shell:
version: "3"
services:
mongo:
image: mongo
restart: always
container_name: "mein-mongo"
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: "${DB_USERNAME}"
MONGO_INITDB_ROOT_PASSWORD: "${DB_PASSWORD}"
volumes:
- "mongodblvolume:/data/db"
mongo-express:
image: mongo-express
container_name: "mein-mongo-express"
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: "${DB_USERNAME}"
ME_CONFIG_MONGODB_ADMINPASSWORD: "${DB_PASSWORD}"
volumes:
mongodblvolume:
Example of .env file
DB_USERNAME=root
DB_PASSWORD=P@SSW0RT!
To install docker, use shell command:
docker-compose up -d
That's all. You can use mongo shell like this:
docker exec -it mein-mongo bash
mongo --username root --password --authenticationDatabase admin
use your_database_name
db.someSampleCollection.insert({})
Or you can use mongo-express by this address: http://localhost:8081/
To use this mongo instance in application, use this connection string in appsettings.json:
{
"Mongo": {
"ConnectionString": "mongodb://root:P@SSW0RT!@localhost:27017/?authSource=admin"
}
}
Backup and restore database using mongodump/mongorestore
Mongudump/mongorestore documentation
To backup or restore database, donwnload mongo database tools for Windows here. You can unzip tools somewhere and add path to them in environment variables.
- To backup for example
WotBlitzStatisticsProdatabase fromlocalhostwith port 27017, execute this command:
mongodump --host=localhost --port=27017 --username=root --password="[YOUR PASSWORD]" --out=backup/mongodump-2020-12-27 --db=WotBlitzStatisticsPro --authenticationDatabase=admin
- To restore
WotBlitzStatisticsProtolocalhostwith port 27017, execute this command:
mongorestore --host=localhost --port=27017 --username=root --password="[YOUR PASSWORD]" --authenticationDatabase=admin mongodump-2020-12-27
Deploying solution using docker-compose
- First, build container image to have it locally:
- docker build -t mike/wot-blitz-statistics-pro:v1 .
- Create environment file
.envand fill the values in it (without square brackets):
WARGAMING_APPLICATION_ID=[your_application_id]
MONGO_CONNECTION_STRING=mongodb://[your_db_user]:[your_db_password]@mongo:27017/?authSource=admin
MONGO_DATABASE_NAME=WotBlitzStatisticsPro
DB_USERNAME=[your_db_user]
DB_PASSWORD=[your_db_password]
- Deploy application, using command:
docker-compose up -d
-
Navigate to http://localhost:8000 (or http://localhost:8000/graphql/ for GraphQl playground)
-
Do delete the deployment, use command:
docker-compose down
Deploying solution using Kubernetes and kubectl
- First, build container image to have it locally:
- docker build -t mike/wot-blitz-statistics-pro:v1 .
- Create a k8s
secretand fill the values in it (without square brackets), using command:
kubectl create secret generic wot-blitz-statistics-secret --from-literal='MONGO_INITDB_ROOT_PASSWORD=[your_db_password]' --from-literal='MONGO_INITDB_ROOT_USERNAME=[your_db_user]' --from-literal='Mongo__ConnectionString=mongodb://[your_db_user]:[your_db_password]@wot-blitz-statistics-pro-app-mongo-service:27027/?authSource=admin' --from-literal='Mongo__DatabaseName=WotBlitzStatisticsPro' --from-literal='WargamingApi__ApplicationId=[your_application_id]'
- Deploy application, using command:
kubectl apply -f k8s
-
Navigate to http://localhost:8040 (or http://localhost:8040/graphql/ for GraphQl playground)
-
Do delete the deployment, use command:
kubectl delete -f k8s