beherbergung/backend
Johannes Lötzsch 298b2e4357
Merge pull request #11 from PluggPreagar/main
Update README.md
2022-03-17 09:20:39 +01:00
..
.clj-kondo backend: template (from swlkup) 2022-03-06 23:09:59 +01:00
data/import backend: import + serve offers from db 2022-03-15 02:46:34 +01:00
nix backend: template (from swlkup) 2022-03-06 23:09:59 +01:00
resources graphiql - init web interface 2022-03-09 08:10:35 +01:00
src backend: allow optional limit for import! 2022-03-16 21:54:21 +01:00
test/beherbergung fixed: test after date was modified in sample-data 2022-03-09 18:33:49 +01:00
.gitattributes backend: template (from swlkup) 2022-03-06 23:09:59 +01:00
.gitignore fixed: default value of :import-file 2022-03-09 07:43:51 +01:00
DB.md backend: template (from swlkup) 2022-03-06 23:09:59 +01:00
project.clj backend: geocode 2022-03-15 04:42:52 +01:00
README.md Update README.md 2022-03-17 09:06:24 +01:00

„beherbergung“ server

The core of the server is an graphql-api based on specialist.

As database the datalog implementation XTDB is used with a RocksDB data store. Some help how to access the database for development/debug purposes can be found in ./DB.md

Running development server

To start the server and send queries, run:

lein run

curl -H 'Content-type: application/json' -d '{"query":"{ TODO }"}' http://localhost:4000/graphql

Testing

lein test

Production build

lein ring uberjar

java -jar target/beherbergung-*standalone.jar

Reproducible builds

Whenever dependencies are changed, rebuild the mvn2nix-lock.json:

nix run ..#backendUpdatedDeps

This allows to build by:

nix build ..#backend

Configuration

Configuration management is done with yogthos. Default values are set at src/config.edn, there you see the available options. In .lein-env.example you find the variables you should set yourself. To set config options at runtime, use environment variables, java system properties or an .edn file specified using the config environment variable.

Notes to developers

State management

Global state (e.g. instances of database and webserver) are managed by mount.

Installation

Windows

The backend runs clojure. To install clojure you might use leiningen.

java install

But first check to have a java installtion ready to run.

java -version

If not - you can download it e.g. from Adopt. Dowload a LTS and HotSpot Version using the links and commands below "Windows x64 jdk installation". Basically it is just a Unziping and adding PATH to Environment.

lein install

consider download, self-install and run via lein.bat

  • locally
  • or in a folder from your PATH-Variable (call SET in commandline to check)
curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein.bat >lein.bat
lein run

debug

in case of failure you can add detail information by activating verbose-mode

SET VERBOSE=true
lein run

to check using test-data use

set DB_SEED="src/beherbergung/db/seed/test.edn"
lein run