diglabby / mapa

Repository for Mapa project
GNU Affero General Public License v3.0
15 stars 21 forks source link
hacktoberfest

Demo: https://mapa.falanster.by/

Development

BrowserStack Status Build Status License

Are you're interested in contributing to KVM? The following is a description of a quickstart. If you're looking for a more comprehensive introduction, have a look at CONTRIBUTING.md.

1. Dependencies

To be able to start development you'll need the following tools:

Now clone this repository:

git clone https://github.com/diglabby/mapa.git

Go to the root of it and install all the dependencies:

cd mapa/
yarn install

or

npm install

2. OpenFairDB local development setup

The easiest way to get a local setup running is by using the remote API of OpenFairDB. To do so change src/constants/URLs.js to https://github.com/goodmap/goodmap-old/blob/e9658f1d2a8d77effe4cfabc085b5c7a2c65c3f3/src/constants/URLs.js#L64

OFDB_API: {
  //link: window.location.origin + "/api" //use when you run openfairdb locally
  link: window.location.protocol + "//" + "api.ofdb.io/v0" //use this to use the remote api
//    link: window.location.protocol + "//" + "dev.ofdb.io/v0" //if you want to work with development environment

}

The alternative is to run OpenFairDB Server locally:

2.1. Linux setup:

wget https://github.com/slowtec/openfairdb/releases/download/v0.5.5/openfairdb_v0.5.5.x86_64-unknown-linux-musl.tar.xz
tar xzf openfairdb_v0.5.5.x86_64-unknown-linux-musl.tar.xz
./openfairdb

To actually get started you also need to add some content. (Save database, copy it to openfairdb directory, unzip and override the previous database).

Change this file webpack.config.babel.js according to this commit. And src/constants/URLs.js according to this commit

Launch OpenfairDB

RUST_LOG=info ROCKET_PORT=6767 DATABASE_URL=openfair.db ./openfairdb

from /path/to/openfairdb/ directory.

openfairdb should now be listening on port 6767.

If both openfairdb and mapa app are running, but no entries are displayed in mapa and you have an ECONNREFUSED error in console, then you should do the following:

  1. Go to file webpack.config.babel.js.
  2. Change line 25 to this: target: "http://[::1]:6767",
  3. Rerun the mapa app.

2.2. Docker setup:

  1. Clone the openfairdb repo.
  2. Go to openfairdb folder: cd ./openfairdb
  3. Build image and run the container by commands from openfairdb repo
  4. openfairdb should now be listening on port 6767.

3. Get the web app running:

    cd /path/to/mapa/
    yarn start

or

    npm start

The web app is now listening on port 8080. Open it in your browser https://localhost:8080.

On every file change in src/, the app will be build for you and the browser reloads automatically.

4. Tests

All the tests can be found in the spec/ folder. To run the tests type

npm t

5. Backend

KVM uses the OpenFairDB as its backend.

License

Copyright (c) 2015 - 2018 Markus Kohlhase mail@markus-kohlhase.de This project is licensed under the AGPLv3 license.