This project need auth service issued jwt for user.
As long as the request is recieved, the AuthorizationFilter.cs
filters will redirect to the SystemAuth url set in appsettings.json
to check whether the jwt is valid.
- APIs: Let detector save data into sqlite, and web can search historical weather data.
- Websocket: Broadcast detected values from sensors by SignalR.
- Create a config
sudo nano /etc/systemd/system/farmer-api.service
- Config sample:
[Unit] Description= FarmerAPI Web API App running on Raspberry pi [Service] WorkingDirectory=/home/pi/IoT/FarmerAPI ExecStart=/opt/dotnet/dotnet /home/pi/IoT/FarmerAPI/FarmerAPI.dll Restart=always # Restart service after 10 seconds if the dotnet service crashes: RestartSec=10 SyslogIdentifier=dotnet-example User=www-data Environment=ASPNETCORE_ENVIRONMENT=Production Envirionment=DOTNET_PRINT_TELEMETRY_MESSAGE=false [Install] WantedBy=multi-user.target
- Enable and run the service:
sudo systemctl enable farmer-api.service sudo systemctl start farmer-api.service