82 lines
1.7 KiB
Markdown
82 lines
1.7 KiB
Markdown
# 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.
|
|
|
|
## Setup
|
|
Rename `.env-sample` to `.env` and fill in credentials
|
|
|
|
## Run
|
|
```
|
|
docker-compose up --build --no-cache --force-recreate
|
|
```
|
|
|
|
## 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.
|
|
|
|
## Web
|
|
[http://0.0.0.0:9090/](http://0.0.0.0:9090/)
|
|
|
|
## nginx proxy config
|
|
```
|
|
server {
|
|
listen 80;
|
|
server_name laikazinas.lsm.lv;
|
|
|
|
location / {
|
|
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;
|
|
}
|
|
}
|
|
```
|
|
|
|
## Local development
|
|
```
|
|
// 1st terminal
|
|
podman-compose up postgres
|
|
|
|
// 2nd terminal
|
|
sbt run
|
|
|
|
// 3rd terminal
|
|
cd web/
|
|
npm run dev
|
|
```
|
|
|
|
Run one file
|
|
```sbt "runMain grib.GribParserTest"```
|
|
|
|
## Backend Tech:
|
|
- scala: cats-effects, http4s, fs2, circe, scalatest
|
|
- postgres
|
|
|
|
## Frontend Tech:
|
|
- SolidJS
|
|
- Vite
|
|
|
|
## Fly commands
|
|
```
|
|
// suspend instance
|
|
fly scale count 0
|
|
```
|
|
|
|
```
|
|
// check display
|
|
fly ssh console
|
|
df -h
|
|
```
|
|
|
|
```
|
|
fly scale memory 512
|
|
```
|