Commit 8f0dd53c authored by Eric - kg6wxc's avatar Eric - kg6wxc
Browse files

Many changes.

Removed user-edited files so they do not get overwritten when updating
the scripts.
The user-edited files are now contained in the user-file.tar.gz archive.
Once decompressed they will not be effected by future "git pull"
operations.

Made changes to how the scripts find the included files, the whole thing
can now just live in one directory, allowing for easier future updates.

Added http-meshmap.conf file to plug in to apache configs. This allows
the <WEBROOT>/meshmap directory to live virtually anywhere on the
filesystem.

Updated README file to reflect these new instructions.
parent 5ac5c496
give me a bit!
AREDN Network Automatic Mapping System
2016-2018 - Eric Satterlee / KG6WXC
This README file last updated: april 2018
add to httpd.conf (/etc/httpd/conf/httpd.conf or on Debian /etc/apache2/httpd.conf)
REQUIREMENTS:
-------------
Apache webserver
PHP
MySQL/MariaDB
An available AREDN Mesh node, preferably connected to an AREDN network...
Map Tiles, either in a static directory or available via some tile server.
Include conf/extra/httpd-meshmap.conf
MAP TILE SERVER INFO
-------------
It is way beyond the scope of this README file to help in setting up a map tile server.
You are unfortunaly on your own there.
It is a time consuming and computationaly expensive process, but can be done on "normal" hardware.
It also takes 100's of GB of HD space if you want to map the entire world.
A good place to start for more info is: https://switch2osm.org/serving-tiles/
If you attempt it, be patient, you will get it wrong a few times but in the end you might be suprised. :)
Restart Apache
Without a map tile server, Mesh users may not see any map tiles. On the mesh, you cannot expect the client
to have internet access in order to retrieve the tiles, you must provide them yourself.
The cronscript can be run from cron every minute (or at whatever interval you choose)
* * * * * /home/kg6wxc/MeshMap/cronscript.sh
INITIAL SETUP FOR A RASPBIAN 9 (Stretch) SYSTEM
-------------
1: Import the SQL file to create the database
Example: sudo mysql < node_map.sql
2: Create a user for the database, you might have to login to the mysql as root.
Here is an example of creating a mySQL user on Raspbian (which would apply for most linuxes):
sudo mysql
CREATE USER 'mesh-map'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, UPDATE, DELETE, DROP, TRIGGER on node_map.* TO 'mesh-map'@'localhost';
FLUSH PRIVLEGES;
3: Decompress user-files.tar.gz
Example: tar -zxvf user-files.tar.gz
This will create the files for the settings, They are distributed in compressed format
so that *your* files do not get overwritten when the rest of the scripts get updated.
The file scripts/user-settings.ini is probably the most important.
It is very important to make sure your SQL username and password are correct in scripts/user-settings.ini!!
Also important is, if the system that this is running on cannot resolve "localnode.local.mesh" you can
change that in the user-settings.ini file.
There are many other things you can change in the ini files.
There is also a "custom.ini" file that can be used for more site specific overrides if needed.
3.5: To make sure it is all working at this point is probably a good idea.
You should now be able to run get-map-info.php from the scripts directory.
I would suggest giving it a test run first.
Run it like this for test mode: ./get-map-info.php --test-mode-no-sql
That will just make sure the scripts can reach your localnode and the rest of the network.
It will output it's progress, but is not updating the database.
Run: ./get-map-info.php --test-mode-with-sql to have it output it's progress and update the database.
Run: ./get-map-info.php without arguments for "normal" mode, where there is no on screen output
4: Edit httpd-meshmap.conf to reflect the correct directories.
5: Copy httpd-meshmap.conf to the apache2 "Conf Available" directory, /etc/apache2/conf-available
Edit /etc/apache2/httpd.conf and add the line: Include conf/extra/httpd-meshmap.conf somewhere.
Once that is all done, run: sudo a2enconf httpd-meshmap
If successful, it will tell you to reload apache, do so.
6: Load up the page: http://myhostname/meshmap/index.php and you should hopefully see your data.
Map tiles are one of the biggest issues with something like this and are beyond the scope of this README
file.
7: The cronscript.sh file is to automatically run the polling script and can be run from cron every minute.
(or at whatever interval you choose)
The script will only run when the polling intervals in the user-settings.ini file have expired.
You must edit the cronscript.sh file and make sure the path to get-map-info.php is correct!
A cron entry is as easy as this:
* * * * * /home/kg6wxc/MeshMap/cronscript.sh
Use crontab -e to edit your users cron jobs.
#!/bin/sh
#change to the directory get-map-info.php is in
cd /home/kg6wxc/MeshMap/scripts
./get-map-info.php
#
# This line creates the alias so that /meshmap can be put anywhere really
#
Alias /meshmap "/srv/meshmap/webpage/"
Alias /meshmap "/home/pi/meshmap/webpage"
#
# DirectoryIndex: sets the file that Apache will serve if a directory
......@@ -31,14 +31,14 @@ Alias /meshmap "/srv/meshmap/webpage/"
# These lines should block access to the scripts directory
# by web clients
#
<Directory "/srv/meshmap/scripts/">
<Directory "/home/pi/meshmap/scripts">
Require all denied
</Directory>
#
# These lines allow access to the webpage directory
#
<Directory "/srv/meshmap/webpage/">
<Directory "/home/pi/meshmap/webpage">
AllowOverride None
Require all granted
</Directory>
\ No newline at end of file
File mode changed from 100755 to 100644
......@@ -34,7 +34,7 @@
* OTHER NOTES HERE
******/
$INCLUDE_DIR = "/srv/meshmap";
$INCLUDE_DIR = "..";
//our user-settings file. (ALWAYS REQUIRED!, change path if you moved it!)
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
......@@ -42,41 +42,46 @@ $USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
//kg6wxc's functions. (ALWAYS REQUIRED!, change path if you moved it!)
require $INCLUDE_DIR . "/scripts/wxc_functions.inc";
//output only to console, nothing saved. (great to just see what it does)
/***********************************************************************
*DO NOT CHANGE ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING!!!!
************************************************************************/
$TEST_MODE_NO_SQL = 0;
//output to console, but *with* calls to the database. (see what it's doing while saving data)
$TEST_MODE_WITH_SQL = 1;
$TEST_MODE_WITH_SQL = 0;
if ($argv[1] == "--test-mode-no-sql") {
//output only to console, nothing saved. (great to just see what it does)
$TEST_MODE_NO_SQL = 1;
}
if ($argv[1] == "--test-mode-with-sql") {
//output to console, but *with* calls to the database. (see what it's doing while saving data)
$TEST_MODE_WITH_SQL = 1;
}
//are we in either test mode?
if ($TEST_MODE_NO_SQL) {
$showRuntime = 1;
$testLinkInfo = 1;
$testNodePolling = 1;
$do_sql = 0;
$getLinkInfo = 1;
$getNodeInfo = 1;
echo "TEST MODE (NO SQL) ENABLED!\n";
$showRuntime = 1;
$testLinkInfo = 1;
$testNodePolling = 1;
$do_sql = 0;
$getLinkInfo = 1;
$getNodeInfo = 1;
echo "TEST MODE (NO SQL) ENABLED!\n";
}elseif ($TEST_MODE_WITH_SQL) {
$showRuntime = 1;
$testLinkInfo = 1;
$testNodePolling = 1;
$do_sql = 1;
$getLinkInfo = 0;
$getNodeInfo = 0;
echo "TEST MODE (WITH SQL) ENABLED!\n";
$showRuntime = 1;
$testLinkInfo = 1;
$testNodePolling = 1;
$do_sql = 1;
$getLinkInfo = 0;
$getNodeInfo = 0;
echo "TEST MODE (WITH SQL) ENABLED!\n";
}else {
$showRuntime = 0;
$testLinkInfo = 0;
$testNodePolling = 0;
$do_sql = 1;
$getLinkInfo = 0;
$getNodeInfo = 0;
$showRuntime = 0;
$testLinkInfo = 0;
$testNodePolling = 0;
$do_sql = 1;
$getLinkInfo = 0;
$getNodeInfo = 0;
}
/***********************************************************************
*DO NOT CHANGE ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING!!!!
************************************************************************/
//this is probably missing for you, do not worry about it.
//It just contains very site specific things, you don't need it.
@include $INCLUDE_DIR . "/wxc_custom.inc";
......
[meshmap-settings]
; Mesh Node Markers
Device_Default = 'images/mapMarkers/greenRadioCircle-icon.png';
Device_Linux = 'images/mapMarkers/linux.png';
Device_900MHz = 'images/mapMarkers/magentaRadioCircle-icon.png';
Device_24GHz = 'images/mapMarkers/purpleRadioCircle-icon.png';
Device_3GHz = 'images/mapMarkers/blueRadioCircle-icon.png';
Device_5GHz = 'images/mapMarkers/goldRadioCircle-icon.png';
Device_Unknown = 'images/mapMarkers/greyRadioCircle-icon.png';
; Software Versions
Device_OOD = 'images/mapMarkers/redCircle.png';
Device_Experimental = 'images/mapMarkers/orangeCircle.png';
; Link colours
; Colours are also control in webpage/css/meshmap.css
DTD_Link_Plus = "steelblue";
DTD_Link_Minus = "#A020F0";
;Link_Tunnel = "lightblue";
Link_Tunnel = "#808080";
Link_Infinite = "black";
Link_GOOD = "#00FF00";
Link_BAD = "#00FF00";
; Additional Markers
Marker_Police ='images/mapMarkers/police.png';
Marker_Fire ='images/mapMarkers/fire.png';
Marker_Hospital='images/mapMarkers/hospital.png';
Marker_EOC ='images/mapMarkers/EOC.png';
Marker_Operator ='images/mapMarkers/operator.png';
Marker_Future ='images/mapMarkers/Red_Marker.png';
<?php
$INCLUDE_DIR = "/home/ride/MeshMap";
$INCLUDE_DIR = "..";
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
require $INCLUDE_DIR . "/scripts/wxc_functions.inc";
@include $INCLUDE_DIR . "/wxc_custom.inc";
......
[user-settings]
;Please change the below variables for your setup.
;For instance, if your on the USA east coast, your "localTimeZone" should be changed to: "America/New_York"
;You want to make your changes in between the quotes,
;Each section has comments that should explain what they are for.
;;SQL username, password, database name, table names.
;You **must** at least update username, passwd, and server to reflect *your* environment!
sql_user = "mesh-map"
sql_passwd = "mesh-map_sql_user_password"
sql_server = "localhost"
sql_db = "node_map"
sql_db_tbl = "node_info"
sql_db_tbl_node = "node_info"
sql_db_tbl_topo = "topology"
;this table is only needed for map_display.php
sql_db_tbl_marker = "marker_info"
;;Your localnode's IP address or hostname
;Just leave it set at "localnode.local.mesh" unless you need to change it
localnode = "localnode.local.mesh"
;;Current firmware version.
;(this will have to be edited by hand each time it changes)
;Sorry, no way around that yet.
current_stable_fw_version = "3.16.1.1"
;;Time Zone we're going to be running in.
;It must be in "PHP Format". Sorry. :)
;Please see: http://php.net/manual/en/timezones.php
;If you need to change it, you can find it there.
localTimeZone = "America/Los_Angeles"
;;How often would you like the script sections to run? (in minutes)
;node_polling_interval controls how often the scripts go out across the mesh to poll each node
;this defaults to once an hour (60 minutes)
;node polling uses mesh resources and really should not be done all that often.
;more than once an hour is probably overkill, unless it's needed for a big build out or something.
;link_interval controls how often we update the link info
;this defaults to 5 minutes
;getting the link info *does not* really use mesh resources, we just ask our localnode for the info.
;in other words this part could be made to operate in pretty much realtime, but it does not yet.
node_polling_interval = "91"
link_update_interval = "5"
;;There is another, new, aspect to node polling, it can be run in parallel.
;a separate php script is spawned for each node on the network,
;this runs much faster time wise, but you lose the ability to see what the node polling script is doing.
;it probably doesn't use more resources than doing it sequetially, it just does it all in one big burst.
;this does make the link lines take a bit longer properly to build in the database,
;as sometimes the info is just not there yet. over time this seems to work itself out.
;All this is being worked on, but for now, turn the parallelism on or off here
node_polling_parallel = "0"
numParallelThreads = "2"
;;Map Center Coordinates and starting zoom level
;this might take some experimenting to get just right
map_center_coordinates = "34.35, -119.6"
map_initial_zoom_level = "10"
;;if you have map tiles or a tile server of your own
offlineMapTileDir = "osm_tiles"
;;The Title of the web page, web page logo and the text above the map.
pageTitle = "Mesh Map"
pageLogo = ""
logoHeaderText = "Mesh Map"
;;Welcome to the Mesh Map Message
welcomeMessage = "Welcome to the Mesh Map"
otherTopOfMapMsg = ""
;;Custom message if you are on the Mesh Server
meshServerText = "You are connected to the Mesh Network and running on device: %s"
;;Custom Message if you are on the Internet Server
inetServerText = "Your are connected to the internet and are running on device: %s"
;;Custom Mesh Warning message
meshWarning = ""
;;Node expiration intervals
;after how many *days* do nodes get removed when we have not heard from them?
;if the same node re-appears after this time it will get automatically removed from the ignore list,
;and will continue to be updated as normal.
node_expire_interval = "30"
expire_old_nodes = "0"
;;How many *hours* to ignore hosts that give us a 404 error when asking for the json files
;a "404 error" from the node usually indicates it is running really old firmware.
;this allows the script to only check these nodes once a day, and not waste time.
;hopefully the owner will update one of these days. :)
error404_expire_interval = "26"
;;How many *minutes* to ignore nodes that give us a "no route to host" error
;these may be temporary errors and should not be ignored long
errorNoRoute_expire_interval = "90"
;;How many *minutes* to ignore nodes that give us a "connection refused" error
;these can also be quite temporary, like when olsrd happens to be restarting or something
errorRefused_expire_interval = "90"
;;The map has the ability to tell what host it is running on.
;Things can change accordingly. Say you want the map on the mesh?
;You'll need offline map files and to use offline js add-on scripts.
;If your system can be accessed by both the mesh and the internet,
;this may come in handy.
;Just set these next three variables accodingly, if unsure leave them.
meshServerHostName = ""
inetServerHostname = ""
;;Values below control how the map is displayed in map_display.php
;--------------------------------------------------------------
;Map size
; 0 = display the map in full screen.
; 1 = display the map in an iFrame.
map_iFrame_Enabled = "0"
<?php
$INCLUDE_DIR = "/srv/meshmap";
$INCLUDE_DIR = "../..";
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
include $INCLUDE_DIR . "/scripts/wxc_functions.inc";
@include $INCLUDE_DIR . "/wxc_custom.inc";
......
......@@ -4,7 +4,7 @@
*Eric Satterlee - KG6WXC aka ride
*/
//simple page to add non-mesh stations to the map
$INCLUDE_DIR = "/srv/meshmap";
$INCLUDE_DIR = "../..";
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
require $INCLUDE_DIR . "/scripts/wxc_functions.inc";
@include $INCLUDE_DIR . "/wxc_custom.inc";
......
......@@ -3,7 +3,7 @@
*status_updates.php
*Eric Satterlee - KG6WXC aka ride
*/
$INCLUDE_DIR = "/srv/meshmap";
$INCLUDE_DIR = "../..";
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
include $INCLUDE_DIR . "/scripts/wxc_functions.inc";
@include $INCLUDE_DIR . "/wxc_custom.inc";
......
......@@ -5,7 +5,7 @@
*/
//simple page to change node locations on the map
//this page does the actual changing
$INCLUDE_DIR = "/srv/meshmap";
$INCLUDE_DIR = "../..";
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
require $INCLUDE_DIR . "/scripts/wxc_functions.inc";
@include $INCLUDE_DIR . "/wxc_custom.inc";
......
<?php
//simple page to change node locations on the map
$INCLUDE_DIR = "/srv/meshmap";
$INCLUDE_DIR = "../..";
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
require $INCLUDE_DIR . "/scripts/wxc_functions.inc";
@include $INCLUDE_DIR . "/wxc_custom.inc";
......
......@@ -6,7 +6,7 @@
//simple page to to view removed nodes
//nodes are removed from the main database table
//if they have not been heard from in 30 days
$INCLUDE_DIR = "/srv/meshmap";
$INCLUDE_DIR = "../..";
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
require $INCLUDE_DIR . "/scripts/wxc_functions.inc";
@include $INCLUDE_DIR . "/wxc_custom.inc";
......
......@@ -101,8 +101,7 @@
* -----------------
**/
$INCLUDE_DIR = "/srv/meshmap";
//$INCLUDE_DIR = "/home/kg6wxc/MeshMap";
$INCLUDE_DIR = "..";
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
global $MESH_SETTINGS;
$MESH_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/meshmap-settings.ini");
......
......@@ -23,7 +23,7 @@
***************************************************************************/
$INCLUDE_DIR = "/srv/meshmap";
$INCLUDE_DIR = "..";
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
global $MESH_SETTINGS;
$MESH_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/meshmap-settings.ini");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment