Mesh Viewer

Installation

Das Mesh Viwer Repository in das Verzeichnis /var/www/meshviewer klonen:

git clone https://github.com/freifunk-herford/meshviewer-build.git /var/www/meshviewer

Folgenden Inhalt in die JSON Konfigurationsdatei unter dem Dateinamen und Pfad /var/www/meshviewer/config.json abspeichern.

{
  "dataPath": [
    "data/"
  ],
  "siteName": "Freifunk Herford",
  "mapSigmaScale": 0.5,
  "showContact": false,
  "maxAge": 14,
  "blinkingHours": 8,
  "mapLayers": [
    { "name": "OpenStreetMap",
      "url": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
      "config": {
        "subdomains": "abc",
        "type": "osm",
        "attribution": "Tiles &copy; Openstreetmap |&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",
        "maxZoom": 18
      }
    },
    {
      "name": "Stamen.TonerLite"
    }
  ],
  "nodeInfos": [
    { "name": "Clientstatistik",
      "href": "data/nodes/{NODE_ID}.png",
      "thumbnail": "data/nodes/{NODE_ID}.png",
      "caption": "Knoten {NODE_ID}"
    }
  ],
  "siteNames": [
    { "site": "ffhf", "name": "Herford" },
    { "site": "ffgl-bcd", "name": "Burscheid" },
    { "site": "ffgl-bgl", "name": "Bergisch Gladbach" },
    { "site": "ffgl-lln", "name": "Leichlingen" },
    { "site": "ffgl-ode", "name": "Odenthal" },
    { "site": "ffgl-ovr", "name": "Overath" },
    { "site": "ffgl-rrh", "name": "Rösrath" },
    { "site": "ffdus", "name": "Flingern" }
  ]
}

Folgenden Inhalt in die Apache Virtual Host Konfigurationsdatei unter dem Dateinamen und Pfad /etc/apache2/sites-available/map.ffhf.conf abspeichern.

<VirtualHost *:80>
    ServerName map.ffhf
    ServerAlias map.* www.map.*
    ServerAdmin info@herford.freifunk.net
    ErrorLog ${APACHE_LOG_DIR}/map-error.log
    CustomLog ${APACHE_LOG_DIR}/map-access.log combined
    DocumentRoot /var/www/meshviewer
    <Directory /var/www/meshviewer>
        Options -Indexes
        Options FollowSymlinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Und mit a2ensite map.ffhf aktivieren.

Salt State File

meshviewer.sls

# Mesh Viewer

meshviewer-repository:
  git.latest:
    - name: https://github.com/freifunk-herford/meshviewer-build.git
    - target: /var/www/meshviewer

/var/www/meshviewer/config.json:
  file.managed:
    - name: /var/www/meshviewer/config.json
    - source: salt://map/var/www/meshviewer/config.json
    - user: map
    - group: map

{% set apache = salt['grains.filter_by']({
  'Debian': {'pkg': 'apache2', 'srv': 'apache2'},
}, default='Debian') %}

{% if grains['os_family'] == 'Debian' %}
/etc/apache2/sites-available/map.ffhf.conf:
  file.managed:
    - name: /etc/apache2/sites-available/map.ffhf.conf
    - source: salt://map/etc/apache2/sites-available/map.ffhf.conf

/etc/apache2/sites-enabled/map.ffhf.conf:
  file.symlink:
    - name: /etc/apache2/sites-enabled/map.ffhf.conf
    - target: /etc/apache2/sites-available/map.ffhf.conf
  service.running:
    - name: {{ apache.srv }}
    - enable: True
    - watch:
        - file: /etc/apache2/sites-enabled/map.ffhf.conf
{% endif %}

{% if grains['os_family'] == 'Debian' %}
# /etc/apache2/sites-available/map.ffhf.conf:
#   apache.configfile:
#     - name: /etc/apache2/sites-available/map.ffhf.conf
#     - config:
#       - VirtualHost:
#         this: '*:80'
#         ServerName:
#           - map.ffhf
#         ServerAlias:
#           - map.*
#         DocumentRoot: /var/www/meshviewer
#         Directory:
#           this: /var/www/meshviewer
#           Order: Deny,Allow
#           Allow from: all
#           AllowOverride: All
{% endif %}