/lipas

Lipas is a nationwide, public GIS service of Finnish sport and recreation facilities.

Primary LanguageClojureMIT LicenseMIT

LIPAS

prod | dev | ci | issues | dev-tasks | use-cases (finnish) | ideas (finnish)

LIPAS is a nationwide, public GIS service of Finnish sport facilities. More information here.

Tech stack

Architecture diagram

Webapp

Webapp is written in Clojure(script).

Backend

Webapp backend is a simple HTTP(s) service with endpoints for different tasks. Some endpoints require authentication. Authentication is implemented using HTTP-basic authentication and signed JWT-tokens.

Frontend

Postgis database

Spatial PostGIS for master data storage.

Nginx

Web facing Nginx reverse proxy, ssl-termination.

Mapproxy

Mapproxy basemap proxy and cache.

ELK-stack

ELK (ElasticSearch, Logstash, Kibana) is used to provide webapp search funtionalities as well as data and monitoring information.

Old Lipas

All data flows also to old Lipas which exposes the data through Geoserver and legacy REST-Api.

REST-API

See Api-documentation here.

GeoServer

Geoserver publishing spatial data. See available layers here.

Dev-env setup

# Create env-file from template
cp .env.sample.sh .env.sh

# Fill in secrets
$EDITOR .env.sh

# 1. ALTERNATIVE: Run setup script
# This runs the clj app in a container also
./setup-dev.sh

# 2. ALTERNATIVE:
# Start proxy-local container
bb up
cd webapp
# Start repl
lein repl
user=> (reset)
# Start cljs build
npm i
npm run watch

Extra

Add following to your hosts file to use same hostnames in both docker and host while developing.

# Lipas dev
127.0.0.1       postgres
127.0.0.1       backend-dev
127.0.0.1       mapproxy
127.0.0.1       elasticsearch
127.0.0.1       kibana
127.0.0.1       logstash
127.0.0.1       proxy

Production build

Backend

docker compose run backend-build

See certs/README.md.

Frontend

docker compose run frontend-npm-deps
docker compose run frontend-build

Apple Silicon considerations

Open Source Routing Machine currently has not an arm64 build. It is much faster than using the x86 image so consider building it yourself:

git clone https://github.com/Project-OSRM/osrm-backend.git
cd osrm-backend
docker build -t osrm-local --platform arm64 -f docker/Dockerfile .

Then you need to replace every usage of osrm/osrm-backend image with osrm-local, for example:

sed -i '.backup' s|osrm/osrm-backend|osrm-local|g docker-compose.yml
sed -i '.backup' s|osrm/osrm-backend|osrm-local|g osrm/README.md

Then see osrm/README.md to build the osrm files.

See Project-OSRM/osrm-backend#6133

Backups

# Dump
docker exec -i lipas-postgres-1 pg_dump -U lipas -Fc > lipas.backup
# Restore
docker exec -i lipas-postgres-1 pg_restore -Fc < lipas.backup
# Rebuild ES index
docker compose run --rm backend-index-search