mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	
						commit
						e9547cc6b0
					
				
					 25 changed files with 173 additions and 181 deletions
				
			
		| 
						 | 
				
			
			@ -13,6 +13,12 @@
 | 
			
		|||
  when: named_install
 | 
			
		||||
  tags: base, named, network, domain
 | 
			
		||||
 | 
			
		||||
- name: Installing vector map test page
 | 
			
		||||
  include_role: 
 | 
			
		||||
      name: osm-vector-maps
 | 
			
		||||
  when: osm_vector_maps_install
 | 
			
		||||
  tags: base, map
 | 
			
		||||
 | 
			
		||||
- name: Installing captive portal
 | 
			
		||||
  include_tasks: roles/captive-portal/tasks/main.yml
 | 
			
		||||
  when: captive_portal_install
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
 | 
			
		||||
 | 
			
		||||
# Info needed to install Lokole
 | 
			
		||||
lokole_version: 0.1.41
 | 
			
		||||
lokole_version: 0.1.39
 | 
			
		||||
lokole_admin_user: admin    # lowercase seems nec here (even though uppercase Admin/changeme is IIAB's OOB recommendation!)
 | 
			
		||||
lokole_admin_password: changeme
 | 
			
		||||
lokole_install_path: "{{ content_base }}/lokole"    # /library/lokole
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ wondershaper_upspeed: "1024"
 | 
			
		|||
 | 
			
		||||
# Wi-Fi
 | 
			
		||||
host_ssid: IIAB
 | 
			
		||||
hostapd_wait: 1
 | 
			
		||||
hostapd_wait: 5
 | 
			
		||||
host_wifi_mode: g
 | 
			
		||||
host_channel: 6
 | 
			
		||||
host_wireless_n: False
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,7 +53,7 @@
 | 
			
		|||
    creates: /etc/sysconfig/olpc-scripts/setup.d/installed/gateway
 | 
			
		||||
  when: iiab_network_mode == "Gateway"
 | 
			
		||||
 | 
			
		||||
- name: Waiting {{ hostapd_wait }} seconds for network to stabilize
 | 
			
		||||
- name: Waiting {{ hostapd_wait }} seconds for network to stabilize (iiap-gen-iptables will fail if dnsmasq isn't ready!)
 | 
			
		||||
  shell: sleep {{ hostapd_wait }}
 | 
			
		||||
 | 
			
		||||
- name: Run /usr/bin/iiab-gen-iptables
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,15 @@
 | 
			
		|||
openvpn_install: True
 | 
			
		||||
openvpn_enable: False
 | 
			
		||||
# openvpn_install: True
 | 
			
		||||
# openvpn_enabled: False
 | 
			
		||||
 | 
			
		||||
# For /etc/iiab/openvpn_handle
 | 
			
		||||
openvpn_handle: ""
 | 
			
		||||
# openvpn_handle: ""
 | 
			
		||||
 | 
			
		||||
# cron seems necessary on CentOS:
 | 
			
		||||
openvpn_cron_enabled: False
 | 
			
		||||
# openvpn_cron_enabled: False
 | 
			
		||||
 | 
			
		||||
openvpn_server: xscenet.net
 | 
			
		||||
openvpn_server_virtual_ip: 10.8.0.1
 | 
			
		||||
openvpn_server_port: 1194
 | 
			
		||||
# openvpn_server: xscenet.net
 | 
			
		||||
# openvpn_server_virtual_ip: 10.8.0.1
 | 
			
		||||
# openvpn_server_port: 1194
 | 
			
		||||
 | 
			
		||||
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
 | 
			
		||||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								roles/osm-vector-maps/defaults/main.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								roles/osm-vector-maps/defaults/main.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
osm_vector_maps_install: True
 | 
			
		||||
osm_vector_maps_enabled: True
 | 
			
		||||
vector_map_path: '{{ content_base }}/www/osm-vector-maps'
 | 
			
		||||
 | 
			
		||||
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
 | 
			
		||||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
 | 
			
		||||
 | 
			
		||||
iiab_map_url : http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden
 | 
			
		||||
| 
						 | 
				
			
			@ -1,16 +1,16 @@
 | 
			
		|||
// osm_functions.js  -- (non authoritative see below) src = iiab/roles/files/
 | 
			
		||||
// map_functions.js  -- (non authoritative see below) src = iiab/roles/files/
 | 
			
		||||
// copyright 2019 George Hunt
 | 
			
		||||
// CAUTION -- this file is duplicate to admin-console/console/files/js/osm_fuctions.js -- please think of admin-console as authoritative
 | 
			
		||||
// CAUTION -- this file is duplicate to admin-console/console/files/js/map_fuctions.js -- please think of admin-console as authoritative
 | 
			
		||||
//     Placed here in duplicate to ease debugging, and simplify dependences
 | 
			
		||||
 | 
			
		||||
var regionGeojson = {};
 | 
			
		||||
var regionList = [];
 | 
			
		||||
var regionInstalled = [];
 | 
			
		||||
var commonAssetsDir = '/common/assets/';
 | 
			
		||||
var mapAssetsDir = '/osm-vector/maplist/assets/';
 | 
			
		||||
var mapAssetsDir = '/osm-vector-maps/maplist/assets/';
 | 
			
		||||
var iiab_config_dir = '/etc/iiab/';
 | 
			
		||||
var onChangeFunc = "setSize";
 | 
			
		||||
var osmCatalog = {};
 | 
			
		||||
var mapCatalog = {};
 | 
			
		||||
 | 
			
		||||
// following 2 lines an experiment to see if test page and console can be common
 | 
			
		||||
//var jquery = require("./assets/jquery.min");
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ var osmCatalog = {};
 | 
			
		|||
function getOsmStat(){
 | 
			
		||||
  // called during the init
 | 
			
		||||
  console.log('in getOsmStat');
 | 
			
		||||
  readOsmCatalog( true ); // we want checkboxes
 | 
			
		||||
  readMapCatalog( true ); // we want checkboxes
 | 
			
		||||
  readOsmIdx();
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
| 
						 | 
				
			
			@ -27,25 +27,25 @@ function readOsmIdx(){
 | 
			
		|||
	//consoleLog ("in readOsmIdx");
 | 
			
		||||
  var resp = $.ajax({
 | 
			
		||||
    type: 'GET',
 | 
			
		||||
    url: consoleJsonDir + 'osm-vector-idx.json',
 | 
			
		||||
    url: consoleJsonDir + 'osm-vector-maps-idx.json',
 | 
			
		||||
    dataType: 'json'
 | 
			
		||||
  })
 | 
			
		||||
  .done(function( data ) {
 | 
			
		||||
  	osmInstalled = data['regions'];
 | 
			
		||||
  	mapInstalled = data['regions'];
 | 
			
		||||
   regionInstalled = [];
 | 
			
		||||
   for (region in data['regions']) {
 | 
			
		||||
    if (data['regions'].hasOwnProperty(region)) {
 | 
			
		||||
        regionInstalled.push(region);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
    //consoleLog(osmInstalled + '');
 | 
			
		||||
    //consoleLog(mapInstalled + '');
 | 
			
		||||
  })
 | 
			
		||||
  .fail(jsonErrhandler);
 | 
			
		||||
 | 
			
		||||
  return resp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function readOsmCatalog(checkbox){
 | 
			
		||||
function readMapCatalog(checkbox){
 | 
			
		||||
   checkbox = checkbox || true;
 | 
			
		||||
	console.log ("in readOsmCalalog");
 | 
			
		||||
   regionList = [];
 | 
			
		||||
| 
						 | 
				
			
			@ -56,11 +56,11 @@ function readOsmCatalog(checkbox){
 | 
			
		|||
  })
 | 
			
		||||
  .done(function( data ) {
 | 
			
		||||
  	 regionJson = data;
 | 
			
		||||
    osmCatalog = regionJson['regions'];
 | 
			
		||||
    for(var key in osmCatalog){
 | 
			
		||||
      //console.log(key + '  ' + osmCatalog[key]['title']);
 | 
			
		||||
      osmCatalog[key]['name'] = key;
 | 
			
		||||
      regionList.push(osmCatalog[key]);
 | 
			
		||||
    mapCatalog = regionJson['regions'];
 | 
			
		||||
    for(var key in mapCatalog){
 | 
			
		||||
      //console.log(key + '  ' + mapCatalog[key]['title']);
 | 
			
		||||
      mapCatalog[key]['name'] = key;
 | 
			
		||||
      regionList.push(mapCatalog[key]);
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
  .fail(jsonErrhandler);
 | 
			
		||||
| 
						 | 
				
			
			@ -120,13 +120,13 @@ function genRegionItem(region,checkbox) {
 | 
			
		|||
function instOsmItem(name) {
 | 
			
		||||
  var command = "INST-OSM-VECT-SET";
 | 
			
		||||
  var cmd_args = {};
 | 
			
		||||
  cmd_args['osm_vect_id'] = name;
 | 
			
		||||
  cmd_args['map_vect_id'] = name;
 | 
			
		||||
  cmd = command + " " + JSON.stringify(cmd_args);
 | 
			
		||||
  sendCmdSrvCmd(cmd, genericCmdHandler);
 | 
			
		||||
  osmDownloading.push(name);
 | 
			
		||||
  if ( osmWip.indexOf(name) != -1 )
 | 
			
		||||
     osmWip.push(osmCatalog[name]);
 | 
			
		||||
  console.log('osmWip: ' + osmWip);
 | 
			
		||||
  mapDownloading.push(name);
 | 
			
		||||
  if ( mapWip.indexOf(name) != -1 )
 | 
			
		||||
     mapWip.push(mapCatalog[name]);
 | 
			
		||||
  console.log('mapWip: ' + mapWip);
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -161,19 +161,19 @@ function updateOsmSpace(cb){
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
function updateOsmSpaceUtil(region, checked){
 | 
			
		||||
  var size =  parseInt(osmCatalog[region].size);
 | 
			
		||||
  var size =  parseInt(mapCatalog[region].size);
 | 
			
		||||
 | 
			
		||||
  var modIdx = selectedOsmItems.indexOf(region);
 | 
			
		||||
 | 
			
		||||
  if (checked){
 | 
			
		||||
    if (regionInstalled.indexOf(region) == -1){ // only update if not already installed mods
 | 
			
		||||
      sysStorage.osm_selected_size += size;
 | 
			
		||||
      sysStorage.map_selected_size += size;
 | 
			
		||||
      selectedOsmItems.push(region);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    if (modIdx != -1){
 | 
			
		||||
      sysStorage.osm_selected_size -= size;
 | 
			
		||||
      sysStorage.map_selected_size -= size;
 | 
			
		||||
      selectedOsmItems.splice(modIdx, 1);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -188,29 +188,29 @@ function totalSpace(){
 | 
			
		|||
  $( ".extract" ).each(function(ind,elem){
 | 
			
		||||
    var data = JSON.parse($(this).attr('data-region'));
 | 
			
		||||
    var region = data.name;
 | 
			
		||||
    var size = parseInt(osmCatalog[region]['size']);
 | 
			
		||||
    var size = parseInt(mapCatalog[region]['size']);
 | 
			
		||||
    var chk = $( this ).find(':checkbox').prop("checked") == true;
 | 
			
		||||
    if (chk && typeof size !== 'undefined')
 | 
			
		||||
        sum += size;
 | 
			
		||||
    });
 | 
			
		||||
   var ksize = sum / 1000;
 | 
			
		||||
  $( "#osmDiskSpace" ).html(readableSize(ksize));
 | 
			
		||||
  $( "#mapDiskSpace" ).html(readableSize(ksize));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$( '#instOsmRegion').on('click', function(evnt){
 | 
			
		||||
   readOsmCatalog();
 | 
			
		||||
   osm.render();
 | 
			
		||||
   readMapCatalog();
 | 
			
		||||
   map.render();
 | 
			
		||||
});
 | 
			
		||||
*/
 | 
			
		||||
function renderOsm(){
 | 
			
		||||
   console.log('in renderOsm');
 | 
			
		||||
   window.map.setTarget($("#osm-container")[0]);
 | 
			
		||||
   window.map.setTarget($("#map-container")[0]);
 | 
			
		||||
   window.map.render();
 | 
			
		||||
   renderRegionList(true);
 | 
			
		||||
}
 | 
			
		||||
function initOsm(){
 | 
			
		||||
var dummy = 0;
 | 
			
		||||
   sysStorage.osm_selected_size = 0;
 | 
			
		||||
   $.when(readOsmCatalog(true)).then(renderRegionList);
 | 
			
		||||
   sysStorage.map_selected_size = 0;
 | 
			
		||||
   $.when(readMapCatalog(true)).then(renderRegionList);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								roles/osm-vector-maps/files/test-index.redirect
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								roles/osm-vector-maps/files/test-index.redirect
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
<head> 
 | 
			
		||||
  <meta http-equiv="refresh" content="0; URL=/osm-vector-maps/maplist/" />
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										84
									
								
								roles/osm-vector-maps/tasks/main.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								roles/osm-vector-maps/tasks/main.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,84 @@
 | 
			
		|||
- name: Make sure the osm-vector-maps directory exists
 | 
			
		||||
  file: 
 | 
			
		||||
    path: '{{ vector_map_path }}/maplist/assets'
 | 
			
		||||
    state: directory
 | 
			
		||||
    owner: '{{ apache_user }}'
 | 
			
		||||
    group: '{{ apache_user }}'
 | 
			
		||||
    mode: '0755'
 | 
			
		||||
 | 
			
		||||
- name: Fetch the catalog for osm maps
 | 
			
		||||
  get_url:
 | 
			
		||||
    url: "{{ iiab_map_url }}/assets/regions.json"
 | 
			
		||||
    dest: '{{ vector_map_path }}/maplist/assets/'
 | 
			
		||||
 | 
			
		||||
- name: Create a link to osm catalog in /common/assets
 | 
			
		||||
  file:
 | 
			
		||||
    src: "{{ vector_map_path }}/maplist/assets/regions.json"
 | 
			
		||||
    dest: "{{ doc_root }}/common/assets/regions.json"
 | 
			
		||||
    state: link
 | 
			
		||||
 | 
			
		||||
- name: Fetch the javascript bundle with openlayers for test page
 | 
			
		||||
  get_url:
 | 
			
		||||
    url: "{{ iiab_map_url }}/../main.js"
 | 
			
		||||
    dest: '{{ vector_map_path }}/maplist/'
 | 
			
		||||
 | 
			
		||||
- name: Fetch the index.html for test page
 | 
			
		||||
  template:
 | 
			
		||||
    src: "index.html"
 | 
			
		||||
    dest: '{{ vector_map_path }}/maplist/index.html'
 | 
			
		||||
 | 
			
		||||
# Bboxes (bounding boxes) are currently square.  But geofabrik has non-rectangular bboxes.
 | 
			
		||||
# So bring the bounding box definition from cloud (bboxes.geojson is big)
 | 
			
		||||
- name: Fetch the bounding box description for osm maps
 | 
			
		||||
  get_url:
 | 
			
		||||
    url: "{{ iiab_map_url }}/assets/bboxes.geojson"
 | 
			
		||||
    dest: '{{ vector_map_path }}/maplist/assets/'
 | 
			
		||||
 | 
			
		||||
- name: Install python-geojson package, that helps with geojson
 | 
			
		||||
  package:
 | 
			
		||||
    name: python-geojson
 | 
			
		||||
    state: present
 | 
			
		||||
 | 
			
		||||
- name: Install the script to update osm catalog
 | 
			
		||||
  template:
 | 
			
		||||
    src: iiab-update-map
 | 
			
		||||
    dest: /usr/bin/iiab-update-map
 | 
			
		||||
    mode: "0755"
 | 
			
		||||
 | 
			
		||||
- name: Run the script that does osm-vector-maps housekeeping
 | 
			
		||||
  shell: /usr/bin/iiab-update-map
 | 
			
		||||
 
 | 
			
		||||
- name: Copy the Countries geojson to assets
 | 
			
		||||
  copy: 
 | 
			
		||||
    src: countries.json
 | 
			
		||||
    dest: '{{ vector_map_path }}/maplist/assets'
 | 
			
		||||
 | 
			
		||||
#  It is too complicated to use a single file for both iiab and admin-console
 | 
			
		||||
- name: Copy the duplicated javascript to assets
 | 
			
		||||
  copy: 
 | 
			
		||||
    src: map_functions.js
 | 
			
		||||
    dest: '{{ vector_map_path }}/maplist/assets'
 | 
			
		||||
 | 
			
		||||
- name: Install /etc/{{ apache_config_dir }}/osm-vector-maps.conf from template
 | 
			
		||||
  template:
 | 
			
		||||
    src: osm-vector-maps.conf
 | 
			
		||||
    dest: "/etc/{{ apache_config_dir }}/osm-vector-maps.conf"
 | 
			
		||||
 | 
			
		||||
- name: Create symlink osm-vector-maps.conf from sites-enabled to sites-available (debuntu, not nec for redhat)
 | 
			
		||||
  file:
 | 
			
		||||
    src: /etc/apache2/sites-available/osm-vector-maps.conf
 | 
			
		||||
    path: /etc/apache2/sites-enabled/osm-vector-maps.conf
 | 
			
		||||
    state: link
 | 
			
		||||
  when: osm_vector_maps_enabled and is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: Remove symlink /etc/apache2/sites-enabled/osm-vector-maps.conf (debuntu)
 | 
			
		||||
  file:
 | 
			
		||||
    path: /etc/apache2/sites-enabled/osm-vector-maps.conf
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: not osm_vector_maps_enabled and is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: Copy the redirect to the test page -- delete this if more than one map
 | 
			
		||||
  copy: 
 | 
			
		||||
    src: test-index.redirect
 | 
			
		||||
    dest: "{{ vector_map_path }}/index.html"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
#!/usr/bin/env python
 | 
			
		||||
# Scan the osm-vector directory, update the osm-vector-idx.json, add menu-defs
 | 
			
		||||
# Scan the osm-vector-maps directory, update the osm-vector-maps-idx.json, add menu-defs
 | 
			
		||||
 | 
			
		||||
from geojson import Feature, Point, FeatureCollection, Polygon
 | 
			
		||||
import geojson
 | 
			
		||||
| 
						 | 
				
			
			@ -25,9 +25,9 @@ else:
 | 
			
		|||
 | 
			
		||||
doc_root = get_iiab_env('WWWROOT')
 | 
			
		||||
menuDefs = doc_root + "/js-menu/menu-files/menu-defs/"
 | 
			
		||||
osm_vector_idx_dir = doc_root + "/common/assets"
 | 
			
		||||
#map_doc_root = '{{ osm_vector_path }}'
 | 
			
		||||
map_doc_root = '/library/www/osm-vector'
 | 
			
		||||
vector_map_idx_dir = doc_root + "/common/assets"
 | 
			
		||||
#map_doc_root = '{{ vector_map_path }}'
 | 
			
		||||
map_doc_root = '/library/www/osm-vector-maps'
 | 
			
		||||
# map_catalog will be global, assumed always available
 | 
			
		||||
map_catalog = {}
 | 
			
		||||
map_menu_def_list = []
 | 
			
		||||
| 
						 | 
				
			
			@ -43,7 +43,7 @@ def main():
 | 
			
		|||
   installed_maps = get_installed_regions()
 | 
			
		||||
   print(installed_maps)
 | 
			
		||||
 | 
			
		||||
   write_osm_vector_idx(installed_maps)
 | 
			
		||||
   write_vector_map_idx(installed_maps)
 | 
			
		||||
 | 
			
		||||
   # For installed regions, check that a menu def exists, and it's on home page
 | 
			
		||||
   for fname in installed_maps:
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +106,7 @@ def get_installed_regions():
 | 
			
		|||
         installed.append('maplist')
 | 
			
		||||
   return installed
 | 
			
		||||
 | 
			
		||||
def write_osm_vector_idx(installed_maps):
 | 
			
		||||
def write_vector_map_idx(installed_maps):
 | 
			
		||||
   map_dict ={} 
 | 
			
		||||
   idx_dict = {}
 | 
			
		||||
   for fname in installed_maps:
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +125,7 @@ def write_osm_vector_idx(installed_maps):
 | 
			
		|||
      idx_dict[item]['region'] = region
 | 
			
		||||
      idx_dict[item]['language'] = map_dict['perma_ref'][:2]
 | 
			
		||||
 | 
			
		||||
   with open(osm_vector_idx_dir + '/osm_version_idx.json','w') as idx:
 | 
			
		||||
   with open(vector_map_idx_dir + '/osm_version_idx.json','w') as idx:
 | 
			
		||||
      idx.write(json.dumps(idx_dict,indent=2)) 
 | 
			
		||||
 | 
			
		||||
def create_menu_def(region,default_name,intended_use='map'):
 | 
			
		||||
| 
						 | 
				
			
			@ -46,12 +46,12 @@
 | 
			
		|||
                 return (bytes / Math.pow(1024, e)).toFixed(2) + " " + s[e];
 | 
			
		||||
               }
 | 
			
		||||
            </script>
 | 
			
		||||
            <script src="/osm-vector/maplist/assets/osm_functions.js"></script>
 | 
			
		||||
            <script src="/osm-vector-maps/maplist/assets/map_functions.js"></script>
 | 
			
		||||
            <script>
 | 
			
		||||
               window.$ = window.$ = jQuery;
 | 
			
		||||
               $.when(readOsmCatalog()).done(function() {
 | 
			
		||||
               $.when(readMapCatalog()).done(function() {
 | 
			
		||||
                     renderRegionList(false);
 | 
			
		||||
               });
 | 
			
		||||
            </script>
 | 
			
		||||
<script type="text/javascript" src="/osm-vector/maplist/main.js"></script></body>
 | 
			
		||||
<script type="text/javascript" src="/osm-vector-maps/maplist/main.js"></script></body>
 | 
			
		||||
</html>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
# For downloadable regional vector tilesets
 | 
			
		||||
Alias /maps {{ osm_vector_path }}
 | 
			
		||||
Alias /osm-vector {{ osm_vector_path }}
 | 
			
		||||
<Directory {{ osm_vector_path }}>
 | 
			
		||||
Alias /maps {{ vector_map_path }}
 | 
			
		||||
Alias /osm-vector-maps {{ vector_map_path }}
 | 
			
		||||
<Directory {{ vector_map_path }}>
 | 
			
		||||
    Options Indexes FollowSymLinks
 | 
			
		||||
    AllowOverride All
 | 
			
		||||
    Require all granted
 | 
			
		||||
| 
						 | 
				
			
			@ -1,9 +0,0 @@
 | 
			
		|||
osm_vector_install: True
 | 
			
		||||
osm_vector_enabled: True
 | 
			
		||||
osm_vector_path: '{{ content_base }}/www/osm-vector'
 | 
			
		||||
 | 
			
		||||
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
 | 
			
		||||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
 | 
			
		||||
 | 
			
		||||
menu_def_dir: '{{ doc_root }}/js-menu/menu-files/menu-defs'
 | 
			
		||||
iiab_osm_url : http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +0,0 @@
 | 
			
		|||
<head> 
 | 
			
		||||
  <meta http-equiv="refresh" content="0; URL=/osm-vector/maplist/" />
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,100 +0,0 @@
 | 
			
		|||
- name: Make sure the osm-vector directory exists
 | 
			
		||||
  file: 
 | 
			
		||||
    path: '{{ osm_vector_path }}/maplist/assets'
 | 
			
		||||
    state: directory
 | 
			
		||||
    owner: '{{ apache_user }}'
 | 
			
		||||
    group: '{{ apache_user }}'
 | 
			
		||||
    mode: '0755'
 | 
			
		||||
 | 
			
		||||
- name: Fetch the catalog for osm maps
 | 
			
		||||
  get_url:
 | 
			
		||||
    url: "{{ iiab_osm_url }}/assets/regions.json"
 | 
			
		||||
    dest: '{{ osm_vector_path }}/maplist/assets/'
 | 
			
		||||
 | 
			
		||||
- name: Create a link to osm catalog in /common/assets
 | 
			
		||||
  file:
 | 
			
		||||
    src: "{{ osm_vector_path }}/maplist/assets/regions.json"
 | 
			
		||||
    dest: "{{ doc_root }}/common/assets/regions.json"
 | 
			
		||||
    state: link
 | 
			
		||||
 | 
			
		||||
- name: Fetch the javascript bundle with openlayers for test page
 | 
			
		||||
  get_url:
 | 
			
		||||
    url: "{{ iiab_osm_url }}/../main.js"
 | 
			
		||||
    dest: '{{ osm_vector_path }}/maplist/'
 | 
			
		||||
 | 
			
		||||
- name: Fetch the index.html for test page
 | 
			
		||||
  template:
 | 
			
		||||
    src: "index.html"
 | 
			
		||||
    dest: '{{ osm_vector_path }}/maplist/index.html'
 | 
			
		||||
 | 
			
		||||
# Bboxes (bounding boxes) are currently square.  But geofabrik has non-rectangular bboxes.
 | 
			
		||||
# So bring the bounding box definition from cloud (bboxes.geojson is big)
 | 
			
		||||
- name: Fetch the bounding box description for osm maps
 | 
			
		||||
  get_url:
 | 
			
		||||
    url: "{{ iiab_osm_url }}/assets/bboxes.geojson"
 | 
			
		||||
    dest: '{{ osm_vector_path }}/maplist/assets/'
 | 
			
		||||
 | 
			
		||||
- name: Install python-geojson package, that helps with geojson
 | 
			
		||||
  package:
 | 
			
		||||
    name: python-geojson
 | 
			
		||||
    state: present
 | 
			
		||||
 | 
			
		||||
- name: Install the script to update osm catalog
 | 
			
		||||
  template:
 | 
			
		||||
    src: iiab-update-osm
 | 
			
		||||
    dest: /usr/bin/iiab-update-osm
 | 
			
		||||
    mode: "0755"
 | 
			
		||||
 | 
			
		||||
- name: Run the script that does osm-vector housekeeping
 | 
			
		||||
  shell: /usr/bin/iiab-update-osm
 | 
			
		||||
 
 | 
			
		||||
- name: Copy the Countries geojson to assets
 | 
			
		||||
  copy: 
 | 
			
		||||
    src: countries.json
 | 
			
		||||
    dest: '{{ osm_vector_path }}/maplist/assets'
 | 
			
		||||
 | 
			
		||||
#  It is too complicated to use a single file for both iiab and admin-console
 | 
			
		||||
- name: Copy the duplicated javascript to assets
 | 
			
		||||
  copy: 
 | 
			
		||||
    src: osm_functions.js
 | 
			
		||||
    dest: '{{ osm_vector_path }}/maplist/assets'
 | 
			
		||||
 | 
			
		||||
- name: Install /etc/{{ apache_config_dir }}/osm-vect.conf from template
 | 
			
		||||
  template:
 | 
			
		||||
    src: osm-vector.conf
 | 
			
		||||
    dest: "/etc/{{ apache_config_dir }}/osm-vector.conf"
 | 
			
		||||
 | 
			
		||||
- name: Create symlink osm-vector.conf from sites-enabled to sites-available (debuntu, not nec for redhat)
 | 
			
		||||
  file:
 | 
			
		||||
    src: /etc/apache2/sites-available/osm-vector.conf
 | 
			
		||||
    path: /etc/apache2/sites-enabled/osm-vector.conf
 | 
			
		||||
    state: link
 | 
			
		||||
  when: osm_vector_enabled and is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: Remove symlink /etc/apache2/sites-enabled/osm-vector.conf (debuntu)
 | 
			
		||||
  file:
 | 
			
		||||
    path: /etc/apache2/sites-enabled/osm-vector.conf
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: not osm_vector_enabled and is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: Copy the redirect to the test page -- delete this if more than one map
 | 
			
		||||
  copy: 
 | 
			
		||||
    src: test-index.redirect
 | 
			
		||||
    dest: "{{ osm_vector_path }}/index.html"
 | 
			
		||||
 | 
			
		||||
- name: Create a directory for map menu-def
 | 
			
		||||
  file: 
 | 
			
		||||
    path: '{{ menu_def_dir }}'
 | 
			
		||||
    state: directory
 | 
			
		||||
 | 
			
		||||
- name: Determine status of splash menu def
 | 
			
		||||
  stat:
 | 
			
		||||
    path: '{{ menu_def_dir }}/en-map_test.json'
 | 
			
		||||
  ignore_errors: True
 | 
			
		||||
  register: menu_def
 | 
			
		||||
 | 
			
		||||
- name: Do not overwrite if it already exists
 | 
			
		||||
  copy:
 | 
			
		||||
    src: en-map_test.json
 | 
			
		||||
    dest: '{{ menu_def_dir }}/en-map_test.json'
 | 
			
		||||
  when: menu_def.stat.exists is defined and not menu_def.stat.exists
 | 
			
		||||
| 
						 | 
				
			
			@ -71,8 +71,8 @@ elif [ -f /etc/debian_version ]; then    # Includes Debian, Ubuntu & Raspbian
 | 
			
		|||
    echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \
 | 
			
		||||
         > /etc/apt/sources.list.d/iiab-ansible.list
 | 
			
		||||
 | 
			
		||||
    echo -e '\nIF YOU FACE ERROR "signatures couldn'"'"'t be verified because the public key is not available" THEN REPEATEDLY RE-RUN "sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367"\n'
 | 
			
		||||
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
 | 
			
		||||
    echo -e '\nIF YOU FACE ERROR "signatures couldn'"'"'t be verified because the public key is not available" THEN REPEATEDLY RE-RUN "sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367"\n'
 | 
			
		||||
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367
 | 
			
		||||
 | 
			
		||||
    echo -e "\napt update; apt install ansible\n"
 | 
			
		||||
    apt update
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,8 +71,8 @@ elif [ -f /etc/debian_version ]; then    # Includes Debian, Ubuntu & Raspbian
 | 
			
		|||
    echo "deb http://ppa.launchpad.net/ansible/ansible-2.6/ubuntu xenial main" \
 | 
			
		||||
         > /etc/apt/sources.list.d/iiab-ansible.list
 | 
			
		||||
 | 
			
		||||
    echo -e '\nIF YOU FACE ERROR "signatures couldn'"'"'t be verified because the public key is not available" THEN REPEATEDLY RE-RUN "sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367"\n'
 | 
			
		||||
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
 | 
			
		||||
    echo -e '\nIF YOU FACE ERROR "signatures couldn'"'"'t be verified because the public key is not available" THEN REPEATEDLY RE-RUN "sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367"\n'
 | 
			
		||||
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367
 | 
			
		||||
 | 
			
		||||
    echo -e "\napt update; apt install ansible\n"
 | 
			
		||||
    apt update
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,8 +71,8 @@ elif [ -f /etc/debian_version ]; then    # Includes Debian, Ubuntu & Raspbian
 | 
			
		|||
    echo "deb http://ppa.launchpad.net/ansible/ansible-2.7/ubuntu xenial main" \
 | 
			
		||||
         > /etc/apt/sources.list.d/iiab-ansible.list
 | 
			
		||||
 | 
			
		||||
    echo -e '\nIF YOU FACE ERROR "signatures couldn'"'"'t be verified because the public key is not available" THEN REPEATEDLY RE-RUN "sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367"\n'
 | 
			
		||||
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
 | 
			
		||||
    echo -e '\nIF YOU FACE ERROR "signatures couldn'"'"'t be verified because the public key is not available" THEN REPEATEDLY RE-RUN "sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367"\n'
 | 
			
		||||
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367
 | 
			
		||||
 | 
			
		||||
    echo -e "\napt update; apt install ansible\n"
 | 
			
		||||
    apt update
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ pip_packages_dir: "{{ iiab_base }}/pip-packages"
 | 
			
		|||
yum_packages_dir: "{{ iiab_base }}/yum-packages"
 | 
			
		||||
downloads_dir: "{{ iiab_base }}/downloads"
 | 
			
		||||
iiab_download_url: http://download.iiab.io/packages
 | 
			
		||||
iiab_osm_url : http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden
 | 
			
		||||
iiab_map_url : http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden
 | 
			
		||||
 | 
			
		||||
content_base: "/library"
 | 
			
		||||
doc_base: "{{ content_base }}/www"
 | 
			
		||||
| 
						 | 
				
			
			@ -352,9 +352,9 @@ mongodb_enabled: False
 | 
			
		|||
mongodb_port: 27018
 | 
			
		||||
 | 
			
		||||
# Regional OSM vector maps use much less disk space than bitmap/raster versions
 | 
			
		||||
osm_vector_install: True
 | 
			
		||||
osm_vector_enabled: True
 | 
			
		||||
osm_vector_path: '{{ content_base }}/www/osm-vector'
 | 
			
		||||
osm_vector_maps_install: True
 | 
			
		||||
osm_vector_maps_enabled: True
 | 
			
		||||
vector_map_path: '{{ content_base }}/www/osm-vector-maps'
 | 
			
		||||
 | 
			
		||||
# roles/sugarizer/meta/main.yml auto-invokes 2 above prereqs: mongodb & nodejs
 | 
			
		||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -230,8 +230,8 @@ moodle_enabled: True
 | 
			
		|||
# If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER
 | 
			
		||||
 | 
			
		||||
# Regional OSM vector maps use much less disk space than bitmap/raster versions
 | 
			
		||||
osm_vector_install: True
 | 
			
		||||
osm_vector_enabled: True
 | 
			
		||||
osm_vector_maps_install: True
 | 
			
		||||
osm_vector_maps_enabled: True
 | 
			
		||||
 | 
			
		||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
 | 
			
		||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -230,8 +230,8 @@ moodle_enabled: False
 | 
			
		|||
# If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER
 | 
			
		||||
 | 
			
		||||
# Regional OSM vector maps use much less disk space than bitmap/raster versions
 | 
			
		||||
osm_vector_install: True
 | 
			
		||||
osm_vector_enabled: True
 | 
			
		||||
osm_vector_maps_install: True
 | 
			
		||||
osm_vector_maps_enabled: True
 | 
			
		||||
 | 
			
		||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
 | 
			
		||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -230,8 +230,8 @@ moodle_enabled: False
 | 
			
		|||
# If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER
 | 
			
		||||
 | 
			
		||||
# Regional OSM vector maps use much less disk space than bitmap/raster versions
 | 
			
		||||
osm_vector_install: True
 | 
			
		||||
osm_vector_enabled: True
 | 
			
		||||
osm_vector_maps_install: True
 | 
			
		||||
osm_vector_maps_enabled: True
 | 
			
		||||
 | 
			
		||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
 | 
			
		||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue