Files
WeatherTool/README.md
T

82 lines
1.7 KiB
Markdown
Raw Normal View History

2023-06-22 13:59:44 +03:00
# Weather Tool
Tool for downloading historical and real-time data from 33 weather stations in Latvia. It aggregates and displays data for different time periods, cities, and weather parameters.
2023-12-19 17:48:48 +02:00
## Setup
Rename `.env-sample` to `.env` and fill in credentials
2023-12-19 16:06:32 +02:00
## Run
```
docker-compose up --build --no-cache --force-recreate
2023-12-19 16:06:32 +02:00
```
## Local synthetic weather data
The local database can be populated with deterministic hourly sample data for all 33 stations. The seed covers the previous 18 months through the current hour and can be run repeatedly without creating duplicates.
```sh
docker compose --profile tools run --rm seed
```
This workflow is intended only for development and UI testing. It uses the normal `weather` table and application APIs; it does not provide LVGMC forecast CSV or HARMONIE GRIB fixtures.
2023-12-19 17:48:48 +02:00
## Web
2023-12-28 12:11:08 +02:00
[http://0.0.0.0:9090/](http://0.0.0.0:9090/)
2023-12-19 17:48:48 +02:00
## nginx proxy config
```
server {
listen 80;
server_name laikazinas.lsm.lv;
location / {
2023-12-28 12:11:08 +02:00
proxy_pass http://localhost:9090; # Forward requests to the Scala app
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
```
2023-12-19 17:48:48 +02:00
## Local development
2023-06-22 13:59:44 +03:00
```
2023-12-19 17:48:48 +02:00
// 1st terminal
2025-01-24 23:01:49 +02:00
podman-compose up postgres
2023-06-22 13:59:44 +03:00
2023-12-19 17:48:48 +02:00
// 2nd terminal
2025-01-24 23:01:49 +02:00
sbt run
// 3rd terminal
2023-06-22 13:59:44 +03:00
cd web/
npm run dev
```
2025-01-30 15:53:26 +02:00
Run one file
2025-01-30 22:57:32 +02:00
```sbt "runMain grib.GribParserTest"```
2025-01-30 15:53:26 +02:00
2023-12-19 17:48:48 +02:00
## Backend Tech:
- scala: cats-effects, http4s, fs2, circe, scalatest
- postgres
2023-06-22 13:59:44 +03:00
2023-12-19 17:48:48 +02:00
## Frontend Tech:
2023-06-22 13:59:44 +03:00
- SolidJS
2025-01-02 16:09:57 +02:00
- Vite
## Fly commands
```
// suspend instance
fly scale count 0
```
2025-02-13 23:21:19 +02:00
```
// check display
fly ssh console
df -h
```
2025-01-02 16:09:57 +02:00
```
fly scale memory 512
```