Skip to content

openforis/fra-platform

Repository files navigation

FRA Platform

Prerequisites

First, install Yarn (modern npm replacement).

Then, install NodeJs (currently the LTS version we are using is 20.11.1).

The .env file

The .env file is needed for development and locally running the stack.

It must be added to the root directory of the project and match the .env.template

Building web application

To build it once:

yarn run build

To constantly build it when something changes, run:

yarn watch

Running the server

yarn start

Database

Create your own local datbase

If you have a Docker server configured locally, just run this command:

sudo docker run -d --name fra-db -p 5442:5432 -e POSTGRES_DB=frap-dev -e POSTGRES_PASSWORD=frap -e POSTGRES_USER=frap postgres:15.4

Otherwise, check .env configurations for setting it up manually (note that the server port is not default!)

Migrations

Migrations are run automatically on startup of the server.

Adding a database migration

When you need e.g. a new table to the database (say "kuikka"), create a migration template with:

yarn run create-migration kuikka

Now you'll see new sql files in db/migration/migrations/sql/<timestamp>-kuikka-<up/down>.sql

You should edit the <timestamp-kuikka-up.sql to contain your create table -statement. Maybe also add the corresponding drop table to <timestamp>-kuikka-down.sql if we ever want to run migrations downwards.

Redis

Install 2 instances of redis 6.2.6 (one for queues and one for data)

sudo docker run --name fra-queue-redis -p 6379:6379 -d redis:6.2.6
sudo docker run --name fra-data-redis -p 6389:6379 -d redis:6.2.6

Design decisions

  • all numeric values for areas are stored in hectares, and converted for UI for user unnits
  • Data points are stored in precision of year

Icons

Download the desktop app at https://nucleoapp.com

Add icon to set

  • Select the icon you like
  • Add to Project
  • Select FRA Platform

Export icon set

Using the traditional table framework

FRA Platform contains a simple framework for creating tables with fixed amount of rows and columns. These tables can store and retrieve their own data so it reduces the need to custom-code the logic for these simple cases. The user guide is here.