Repository with the Weather Station Dashboard solution.
These WebApp + APIs allow you to watch and search measurements taken by the device you built and configured following the Sensors Reader Project
The WebApp and the APIs are designed to be run with https support against the port 1443. To achieve this, it is necessary to create a certificate and it must be hosted in a place accessible by the docker container. Here, you have a tutorial to create a .pfx file protected by password.
- The device needs a LAN connection, either Wi-Fi or wired, to the database used by the Sensors application.
- A .pfx certificate file created following the steps above and accessible by the Docker server..
- AUTHENTICATION_SECRET - Password to be used by the WebApp to get a token to make authenticated request to the Gateway. It is used also by the AuthenticationService to compare the value passed by anybody who wants to obtain a token.
- AUDIENCE_SECRET - Secret shared by the APIs and the Gateway to manage authenticated requests. The value must be the same in all the services.
- ASPNETCORE_Kestrel__Certificates__Default__Password - Password of the .pfx file.
- ASPNETCORE_Kestrel__Certificates__Default__Path - Absolute path to the .pfx file. It is important that it is mounted and NOT stored in the container due to security reasons.
- SERVER - Server with the PostgreSQL database.
- DATABASE - PostgreSQL database name.
- USER - User to connect to the PostgreSQL database.
- PASSWORD - Password to connect to the PostgreSQL database.
A docker-compose example is provided with the solution code.
version: '3.5'
services:
authentication-service:
container_name: authentication-service
image: weatherstationproject/authentication-service
ports:
- "3443:1443"
environment:
- AUTHENTICATION_SECRET=123456
- AUDIENCE_SECRET=MySecret
- ASPNETCORE_Kestrel__Certificates__Default__Password=123456
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/certificate.pfx
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /path_to_the_pfx_folder:/https:ro
gateway-service:
depends_on:
- authentication-service
- ambient-temperatures-service
- air-parameters-service
- wind-measurements-service
- rainfall-service
- ground-temperatures-service
container_name: gateway-service
image: weatherstationproject/gateway-service
ports:
- "2443:1443"
environment:
- AUDIENCE_SECRET=MySecret
- ASPNETCORE_Kestrel__Certificates__Default__Password=123456
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/certificate.pfx
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /path_to_the_pfx_folder:/https:ro
ambient-temperatures-service:
container_name: ambient-temperatures-service
image: weatherstationproject/ambient-temperature-service
environment:
- AUDIENCE_SECRET=MySecret
- SERVER=127.0.0.1
- DATABASE=database-name
- USER=value
- PASSWORD=value
- ASPNETCORE_Kestrel__Certificates__Default__Password=123456
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/certificate.pfx
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /path_to_the_pfx_folder:/https:ro
air-parameters-service:
container_name: air-parameters-service
image: weatherstationproject/air-parameters-service
environment:
- AUDIENCE_SECRET=MySecret
- SERVER=127.0.0.1
- DATABASE=database-name
- USER=value
- PASSWORD=value
- ASPNETCORE_Kestrel__Certificates__Default__Password=123456
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/certificate.pfx
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /path_to_the_pfx_folder:/https:ro
wind-measurements-service:
container_name: wind-measurements-service
image: weatherstationproject/wind-measurements-service
environment:
- AUDIENCE_SECRET=MySecret
- SERVER=127.0.0.1
- DATABASE=database-name
- USER=value
- PASSWORD=value
- ASPNETCORE_Kestrel__Certificates__Default__Password=123456
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/certificate.pfx
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /path_to_the_pfx_folder:/https:ro
rainfall-service:
container_name: rainfall-service
image: weatherstationproject/rainfall-service
environment:
- AUDIENCE_SECRET=MySecret
- SERVER=127.0.0.1
- DATABASE=database-name
- USER=value
- PASSWORD=value
- ASPNETCORE_Kestrel__Certificates__Default__Password=123456
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/certificate.pfx
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /path_to_the_pfx_folder:/https:ro
ground-temperatures-service:
container_name: ground-temperatures-service
image: weatherstationproject/ground-temperature-service
environment:
- AUDIENCE_SECRET=MySecret
- SERVER=127.0.0.1
- DATABASE=database-name
- USER=value
- PASSWORD=value
- ASPNETCORE_Kestrel__Certificates__Default__Password=123456
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/certificate.pfx
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /path_to_the_pfx_folder:/https:ro
dashboard:
depends_on:
- gateway-service
container_name: dashboard
image: weatherstationproject/dashboard
ports:
- "1443:1443"
environment:
- AUTHENTICATION_SECRET=123456
- ACCUWEATHER_LOCATION_NAME=Moralzarzal
- WEATHER_API_HOST=https://gateway-service:1443
- ACCUWEATHER_API_KEY=agzy4UX4RlokbgSksCKR4ZVbcFAA6bvi
- AUTHENTICATION_SERVICE_HOST=https://authentication-service:1443
- ASPNETCORE_Kestrel__Certificates__Default__Password=123456
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/certificate.pfx
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /path_to_the_pfx_folder:/https:ro
- v1.1.0 - Added historical data pages.
- v1.0.0 - First version with current data page.
- v0.1.0 - Some mockups with the design of the different pages.
Use this code as you wish! Totally free to be copied/pasted.
If you liked the repository, you found it useful and you are willing to contribute, don't hesitate! I will be very grateful! :-)