Freifunk API

Installation

Als Benutzer map die Verzeichnisse /home/map/scripts/map mit mkdir -p /home/map/scripts/map anlegen.

Eine virtuelle Python3 Umgebung erstellen:

apt install python3 python3-dev python-virtualenv
cd /home/map/scripts/map
virtualenv --python=python3 venv3

Das FFFlash Repository in das Verzeichnis /home/map/scripts/map klonen:

git clone https://github.com/spookey/ffflash.git /home/map/scripts/map/ffflash

Die Vorraussetzungen für FFFlash in der virtuellen Python3 Umgebung installieren:

cd /home/map/scripts/map
sour..ce venv3/bin/active
pip install --upgrade pip -r ffflash/requirements.txt

Folgenden Inhalt in die JSON Freifunk API Datei unter dem Dateinamen und Pfad /var/www/meshviewer/freifunk-api/herford.json abspeichern.

{
  "name": "Freifunk Herford",
  "url": "http://herford.freifunk.net",
  "location": {
    "city": "Herford",
    "country": "DE",
    "lat": 52.11815408871958,
    "lon": 8.670616149902344,
    "address": {
      "Name": "Freifunk Herford - RecyclingBörse",
      "Street": "Heidestrasse 7",
      "Zipcode": "32051"
    }
  },
  "contact": {
    "email": "info@herford.freifunk.net",
    "jabber": "freifunk-bielefeld@conference.jabber.ccc.de",
    "facebook": "https://www.facebook.com/FreifunkHerford",
    "twitter": "@freifunkhf"
  },
  "state": {
    "focus": [
      "infrastructure/backbone",
      "Public Free Wifi",
      "Social Community Building",
      "Local services and content",
      "Free internet access"
    ],
    "lastchange": "2016-11-10T03:03:43.965Z"
  },
  "nodeMaps": [
    {
      "url": "http://map.herford.freifunk.net/",
      "interval": "1min",
      "technicalType": "meshviewer",
      "mapType": "geographical"
    }
  ],
  "techDetails": {
    "firmware": {
      "name": "gluon",
      "url": "http://firmware.herford.freifunk.net/",
      "docs": "http://herford.freifunk.net/mitmachen/firmware/"
    },
    "dns": [
      {
        "domainname": "ffhf",
        "nameserver": [
          "map.herford.freifunk.net"
        ]
      }
    ],
    "networks": {
      "ipv4": [
        {
          "network": "10.34.0.0/24"
        }
      ]
    },
    "routing": [
      "batman-adv"
    ],
    "updatemode": [
      "manual",
      "autoupdate"
    ],
    "legals": [
      "vpninternational"
    ]
  },
  "api": "0.4.14"
}

Hinweis

Diese Datei kann man mit Hilfe des Freifunk API Generator erstellt werden.

Die Dateirechte mit chown map:map /var/www/meshviewer/freifunk-api/herford.json anpassen.

Salt State File

ffflash.sls

# Freifunk API

# http://ffflash.readthedocs.io/en/latest/

ffflash-prepare:
  pkg.installed:
    - pkgs:
        {% if grains['os_family'] == 'Debian' %}
        - python3
        - python3-dev
        - python-virtualenv
        {% endif %}
  file.managed:
    - name: /var/www/meshviewer/freifunk-api/herford.json
    - source: salt://map/var/www/meshviewer/freifunk-api/herford.json
    - user: map
    - group: map
    - makedirs: True

# https://freifunk.net/api-generator/

ffflash-repository:
  git.latest:
    - name: https://github.com/spookey/ffflash.git
    - target: /home/map/scripts/map/ffflash
    - unless: test -d /home/map/scripts/map/ffflash
    - user: map

ffflash-venv:
  virtualenv.managed:
    - python: python3
    - cwd: /home/map/scripts/map
    - name: /home/map/scripts/map/venv3
    - requirements: /home/map/scripts/map/ffflash/requirements.txt
    - pip_upgrade: True
    - user: map
    - require:
      - pkg: ffflash-prepare
      - git: ffflash-repository