|
| 1 | +# Deploy |
| 2 | + |
| 3 | +This folder contains configuration for running Forti locally using Docker Compose. It brings up the core services — `rawdataforecaster`, `correctedforecaster`, and `jsonfrontend` — using local forecast data. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- [Docker](https://docs.docker.com/get-docker/) with Compose support |
| 8 | +- Local forecast data (see [Preparing data](#preparing-data) below) |
| 9 | + |
| 10 | +## Preparing data |
| 11 | + |
| 12 | +Forecast data can be produced using [forti-prep](https://github.com/metno/forti-prep), a companion tool that downloads and post-processes the input datasets into the format expected by Forti. |
| 13 | + |
| 14 | +By default, the Compose setup expects forecast data to be available at `../data/forecast` (relative to this folder), which corresponds to `data/forecast/` in the repository root. You can override this with the `FORECAST_DATA_PATH` environment variable. |
| 15 | + |
| 16 | +## Services |
| 17 | + |
| 18 | +| Service | Description | Default port | |
| 19 | +|---|---|---| |
| 20 | +| `rawdataforecaster` | Serves forecast data over gRPC from a local directory | `5052` | |
| 21 | +| `correctedforecaster` | Post-processes forecast data and re-exposes it over gRPC | — | |
| 22 | +| `jsonfrontend` | REST API that serves point forecast timeseries as JSON | `8080` | |
| 23 | + |
| 24 | +`correctedforecaster` is optional and must be enabled via a Docker Compose [profile](#profiles). |
| 25 | + |
| 26 | +## Usage |
| 27 | + |
| 28 | +Build and start the base services: |
| 29 | + |
| 30 | +```bash |
| 31 | +docker compose up --build |
| 32 | +``` |
| 33 | + |
| 34 | +Test that the API is responding: |
| 35 | + |
| 36 | +```bash |
| 37 | +curl 'http://localhost:8080/?lat=59&lon=11' |
| 38 | +``` |
| 39 | + |
| 40 | +### Enabling correctedforecaster |
| 41 | + |
| 42 | +`correctedforecaster` is disabled by default. To enable it, set both variables in your `.env` file: |
| 43 | + |
| 44 | +```bash |
| 45 | +COMPOSE_PROFILES=corrected |
| 46 | +JSONFRONTEND_UPSTREAM=correctedforecaster:5051 |
| 47 | +``` |
| 48 | + |
| 49 | +Both need to change together: `COMPOSE_PROFILES` starts the container, and `JSONFRONTEND_UPSTREAM` points `jsonfrontend` at it. Leave `COMPOSE_PROFILES` empty (or unset) to run without correction. |
| 50 | + |
| 51 | +## Environment variables |
| 52 | + |
| 53 | +| Variable | Default | Description | |
| 54 | +|---|---|---| |
| 55 | +| `FORECAST_DATA_PATH` | `../data/forecast` | Path to the local forecast data directory | |
| 56 | +| `TOPOGRAPHY_DATA_PATH` | `../data/topography` | Path to the local topography data directory (used by `correctedforecaster`) | |
| 57 | +| `JSONFRONTEND_UPSTREAM` | `rawdataforecaster:5052` | gRPC upstream address for `jsonfrontend` | |
| 58 | + |
| 59 | +These can be set in a `.env` file in this directory (`.env` is gitignored). Copy `.env.example` as a starting point: |
| 60 | + |
| 61 | +```bash |
| 62 | +cp .env.example .env |
| 63 | +``` |
| 64 | + |
| 65 | +## Configuration |
| 66 | + |
| 67 | +`rawdataforecaster.config.json` configures how `rawdataforecaster` reads forecast data: |
| 68 | + |
| 69 | +```json |
| 70 | +{ |
| 71 | + "source": { |
| 72 | + "bucket": "file:///data/forecast" |
| 73 | + }, |
| 74 | + "areas": ["meps"], |
| 75 | + "loader": { |
| 76 | + "type": "blob" |
| 77 | + } |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +- **`source.bucket`** — points to the mounted forecast data directory inside the container. |
| 82 | +- **`areas`** — list of forecast areas to load (e.g. `meps`). |
| 83 | +- **`loader.type`** — `"blob"` streams data on demand rather than loading everything into memory. Keep this as `"blob"` unless you have a specific reason to change it. |
0 commit comments