/ORTE-backend

Application for creating and managing places (or "Orte") on a map

Primary LanguageRubyGNU General Public License v3.0GPL-3.0

Release Last commit Code Coverage w/SimpleCov Linters + RSpec Maintainability

ORTE-backend

Backend application for creating and managing places/POIs (or in german "Orte"), formatted text and assets like images, audio and video on a web-based map. Additionally relations between places can be set. Output is a public available API w/JSON or exportable as CSV/JSON/GeoJSON data. It has also some extra features like visualising relations between places and a map to go feature (see below).

Based on Ruby on Rails 6.1, Ruby 3, MySQL/MariaDB, jQuery, Leaflet and Foundation 6.

Contributions to this application are appreciated (see below).

Address and geolocation lookup

This application uses Nominatim, a search engine for OpenStreetMap data to look up address and geolocation data. By implementing this application you should respect the Nominatim Usage Policy!

Map to go feature

ORTE Backend ist basically a backend which provides JSON and GeoJSON export of its layers and map. Since version 0.7 offers a "map to go" feature, where user can generate a static, Nuxt.js based website from their single layer (and its places) and place this site on their webspace. So you can get your frontend website and all defined data directly out of the application.

Installation

Basic steps for a local installation on your machine:

Requirements

  • Webserver (e.g. Apache or NGINX)
  • Passenger stand-alone
  • Ruby 2.7+, RVM, Rubygems
  • MySQL/Maria DB
  • ffmpeg (for the video feature), ImageMagick (for the image feature)
  • Redis

Get repository

$ git clone git@github.com:a-thousand-channels/ORTE-backend.git

Prepare Rails

$ gem install bundler
$ bundle install

Setup MySQL/Maria DB

$ sudo mysql -u root
> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
> GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost';
> CREATE DATABASE orte CHARACTER SET utf8 COLLATE utf8_general_ci;
> CREATE DATABASE orte_test CHARACTER SET utf8 COLLATE utf8_general_ci;
> exit;
$ bundle exec rails db:schema:load
$ bundle exec rails db:seed

Settings for server setup

Some settings (like email settings or database setup) you'll need for productive installation on a server are stored in the credential file.

Edit the credential file with

$ EDITOR=vim bundle exec rails credentials:edit

All used and needed variables are explained in the credentials.yml.default file.

To use this in different environments, with development and installations for staging or production server you can use the multi-environment credentials that came with Rails 6.1.

To create/edit a specific credential file for staging use:

$ EDITOR=vim bundle exec rails credentials:edit --environment staging

For details on this technique please read this good explainer about credentials in Rails 6.1

Also edit settings.yml to define your custom server address.

Optional: Mapbox Token for satellite imagery

As a default at ORTE, satellite imagery is used as a base layer. This imagery is available only up to level 18. If you want to have satellite imagery on a higher zoom level (19-21), where you can more clearly see details on streets, places and buildings, than you have to define an additional satellite imagery provider. ORTE has as a preset for Mapbox satellite imagery, but to use it, you need to have a Mapbox account and to generate a Mapbox API Token. (Of course this completely optional, and you switch on user level or permant on map level to a OSM base map.)

You can define your mapbox token in the credentials (token[:mapbox])

Run application locally

$ bundle exec rails s

Test applocation locally

$ RAILS_ENV=test bundle exec rails db:migrate
$ RAILS_ENV=test COVERAGE=true bundle exec rspec spec

Credits

Project by A thousand channels, initiated by Ulf Treger with kind support by and in collaboration with:

  • Pragma Shift, Hamburg, for initial code donation,
  • Treffentotal 2018, Hamburg (first use public case with a map at map.treffentotal.de, which gets its geolocations from ORTE backend via JSON),
  • Participants of workshops of city/data/explosion at Kunst- und Kulturverein Spedition, Bremen,
  • Members of the working group "Queer narratives, mappped" 💖 for acceptance testing, ideas and requests for improving the user interface and the maps.
  • Sandbostel Camp Memorial for the public submission interface and to Sefux for coding it.
  • There is a fork by Leerstandsmeldungen with PostgreSQL and Pundit Gem for a more sophisticated model of authorization and roles.

Feedback & Contributions

Feedback, bug reports and code contributions are most welcome.

Send Feedback to hello@a-thousand-channels.xyz

Please file bug reports and feature request to our Github Repository at https://github.com/a-thousand-channels/ORTE-backend

For code contributions, please fork this repo, make a branch, commit your code & create a pull request.

All contributors shall respect the Contributor Covenant Code of Conduct

Licence

This project is licensed under a GNU General Public Licence v3