Branch: master
Clone or download
Latest commit 0916af5 Feb 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
migrations add organizer field to events Jan 18, 2019
scripts fix(db): export bbox subscription with username instead of user id Jan 18, 2018
src Fix test build Feb 21, 2019
.env fix(*): use logging level from environment Jan 17, 2018
.gitignore Add /bin directory to .gitignore Feb 15, 2019
.travis.yml fix(test): don't fail if cargo-update or cargo-travis is already inst… Jan 21, 2018
CHANGELOG.md
Cargo.lock new: add a basic naked frontend for events Feb 21, 2019
Cargo.toml new: add a basic naked frontend for events Feb 21, 2019
LICENSE add license file & badge May 10, 2016
Makefile.clux-muslrust Pin toolchain version for reproducible builds Feb 17, 2019
README.md describe how to render the API docs Feb 4, 2019
classes.puml Add a PlantUML class diagram (#129) Jan 4, 2019
config.toml fix(*): removed all problems leading to warnings Jul 26, 2017
default.nix release v0.0.16 Apr 30, 2016
dev-env.nix new: add a basic naked frontend for events Feb 21, 2019
openapi.yaml add organizer field to events Jan 18, 2019
rust-packages.nix release v0.0.16 Apr 30, 2016
rust-toolchain Update nightly toolchain Feb 21, 2019

README.md

Open Fair DB

The backend for Karte von morgen written in Rust.

Build Status Coverage Status dependency status License

REST API

The API is available under http://api.ofdb.io/v0/.

The current API is documented within the openapi.yaml file. You can render the API documentation e.g. with the swagger editor:

  • go to https://editor.swagger.io
  • go to File -> import URL
  • enter https://raw.githubusercontent.com/slowtec/openfairdb/master/openapi.yaml
  • enjoy ;-)

An other way to see how the API can be used, you can open the network tab in the developer tools of your browser and see the requests that are made to https://kartevonmorgen.org.

If you want to use the API in your project, please contact us at helmut@bildungsagenten.com. The API might still change sometimes. We will try to let you know in that case.

  • GET /entries/:ID_1,:ID_2,...,:ID_n
  • PUT /entries/:ID
  • GET /categories/
  • GET /categories/:ID_1,:ID_2,...,:ID_n
  • POST /ratings
  • GET /ratings
  • GET /ratings/:ID_1,:ID_2,...,:ID_n
  • POST /users
  • POST /confirm-email-address
  • GET /bbox-subscriptions
  • POST /subscribe-to-bbox
  • POST /unsubscribe-all-bboxes

Login & Subscriptions

For the following requests one must be logged in: GET /users/:USERNAME GET /bbox-subscriptions POST /subscribe-to-bbox POST /unsubscribe-all-bboxes

bbox-subscriptions are subscriptions to a certain map area (bounding box,bbox): whenever a new entry is created or an entry is changed within that area, an email notification is sent to the user.

Quick start

Download the latest build openfairdb-x86_64-linux-v0.3.7.tar.gz, unpack and start it:

wget https://github.com/slowtec/openfairdb/releases/download/v0.3.7/openfairdb-x86_64-linux-v0.3.7.tar.gz
tar xzf openfairdb-x86_64-linux-v0.3.7.tar.gz
./openfairdb

Build

Requirements:

Installing Rust & Cargo

If you're using Ubuntu 16.04 LTS you can run

sudo apt-get install curl libssl-dev gcc
curl https://sh.rustup.rs -sSf | sh
rustup install nightly
rustup default nightly

On windows you can download the installer from rustup.rs. (But don't forget to install a C++ toolchain first).

Installing a specific nightly version with rustup (e.g. 2018-01-04) is easy:

rustup default nightly-2018-01-04

Installing SQLite & Diesel

On Ubuntu:

sudo apt-get install sqlite3 libsqlite3-dev
cargo install diesel_cli --no-default-features --features sqlite

Compile & Run

git clone https://github.com/slowtec/openfairdb
cd openfairdb/
diesel migration run
cargo build
./target/debug/openfairdb

On NixOS you can build the project with:

nix-build -E '(import <nixpkgs>{}).callPackage ./default.nix {}'

Docker Build

The bundled Makefile can be used to build a static executable without installing any dependencies locally.

Depending on the permissions of your local Docker installation you may need to use sudo for the invocation of make.

Pull Build Image

The build requires the muslrust Docker image with the corresponding Rust toolchain:

make -f Makefile.x86_64-unknown-linux-musl pre-build

This command has to be executed at least once and can be repeated for updating the muslrust build image.

Execute Build

Use the following command from the project directory to start the build:

make -f Makefile.x86_64-unknown-linux-musl

The source folder is copied into /tmp and mounted as a volume into the Docker container. The Cargo cache is also stored in /tmp and reused on subsequent invocations.

The resulting executable is copied into the folder bin/x86_64-unknown-linux-musl after the build has completed successfully.

Logging

RUST_LOG=debug ./target/debug/openfairdb

If you want to get stacktraces on panics use

export RUST_BACKTRACE=1

DB Backups

At the moment the OpenFairDB does not support online backups. Therefore we use a simple script that copies the DB file once a day.

Domain Model

The rendered class diagram should appear here!

Note: Currently the rendered class diagram must be updated manually by uploading the contents of the file classes.puml to the PlantUML Online Editor and replace the link for the rendered diagram with one of the generated URLs.

License

Copyright (c) 2015 - 2018 Markus Kohlhase

This project is licensed under the AGPLv3 license.