Skip to content
/ tabletop Public

Event tracking application using .NET Core 3.1, SignalR and Entity Framework Core

Notifications You must be signed in to change notification settings

qdraw/tabletop

Repository files navigation

Tabletop

Tabletop is a cloud-based, mobile-ready, event tracking system. We use it to see if the table footbal is free.

Builds

Travis Build status codecov Donate

Features

  • Display if room is free or in use
  • History views per day
  • Display Latest Activity
  • Realtime Magic

Technical summary

  • .NET Core 3.1
  • ASP.NET MVC
  • Runs on Windows, Linux and Mac OS X
  • Send events from a Arduino with a PIR-Sensor
  • D3.v4 Javascript Datavisualisation

And of course Tabletop itself is open source with a public repository on GitHub.

Installation

Tabletop requires .NET Core v3.1 to run.

Install the dependencies

$ cd tabletop/tabletop
$ dotnet restore
  • Linux and Mac OS X, Update SQL-Server connection string in appsettings.Production.json
  • Windows: You can use the localdb for testing
{
    "ConnectionStrings": {
        "DefaultConnection": "Data Source=data.db",
        "DatabaseType": "sqlite"
    }
}

Run Database migration

$ dotnet ef database update

Add a test user using the SQL command

INSERT INTO [dbo].[ChannelUser] (NameId,Name,NameUrlSafe,IsAccessible,IsVisible,Bearer)
VALUES ('cc9299c5-03a6-409a-be35-30981acfa7ac','Test Channel','test','true','true','secret')

And finaly run the app

$ dotnet run

Add some test data

curl -X POST -F 'status=1' -F 'name=test' -H 'Authorization: Bearer secret'
'http://localhost:5000/api/update'

Arduino client

I use a Arduino Ethernet shield with the Ethernet2 library and a PIR-sensor. To Setup additional libraries check: https://www.arduino.cc/en/Guide/Libraries.

The Arduino code is open source in the tabletop_client folder

Adjust the bearer and server in tabletop/tabletop_client/tabletop_client.ino

char clientName[] = "test";
char Bearer[] = "secret";
char server[] = "qdraw.nl"; // without http://
// the url will be: http://qdraw.nl/tabletop/api/update

To setup the PIR-sensor please check this scheme: Tabletop Scheme

For production environments...

You can use the environment variable TABLETOP_SQL. If there is no variable the app will check appsettings.json or appsettings.Production.json.

Personaly I run this application on a linux-arm server and use PM2 to manage the process. PM2 is a production process manager for Node.js but you can be used to manage binary executables.

Building for linux-arm

Create a new build for linux-arm

$ cd tabletop/tabletop
$ ./publish-linux-arm.sh
Creating a new PM2 instance

This bash script ask for a SQL Server connectionstring

$ ./new-pm2.sh
Insert here the production SQL string