HOW TO: configure/install Snap4CityMAINVM: starting appliance of Snap4City

Valid for VM version 1.6 and previous and Dockers version 1.2 and formers

this Snap4CityMAINVM has been described in https://www.snap4city.org/drupal/node/471 It mainly includes the Snap4City Dashboard Builder and many other tools as a starting Snap4City environment for powerful but small size businesses: it is also the starting poit for the installation of large scale Snap4City solutions. So that we suggest start from this. The alternative can be to start from GITHUB/DISIT installing the tools that you prefer. This VM is also called "Dashboard" internally. 

This virtual machine is based on Debian operating system v8.11 (without graphic Desktop Environment) and it has been run on VMware ESXi v6.5, but you can run on VMware player. In particular, this VM contains what is described in https://www.snap4city.org/drupal/node/471 

PLEASE NOTE THAT IN THE CASE OF Snap4CityMAIN on DockerContainer installation, some of the passwords may be included into the DockerCompose File and are valid only for that version.

As a prerequisite for using this virtual machine, it is necessary to download and install the free VMware Workstation Player (tested with version 15). With this tool you can launch the VM, which by default was created with the following specifications (which can be modified in the VMware "Settings" configuration panel):

number of processor: 8 (you can increase when needed)

RAM:                                    8 GB (it can be easily increased)

Hard-Disk:                           500 GB (thin provisioning) you need at least 34 Gbyte at the first running on your HD

Access to the Operating System, credentials

IP: static à verify into your system (ifconfig da Debian shell)

Operating system: Debian v8.11

username: debian,     password: debian,     password of super user (su): debian

Access to Services

Dashboard the socalled Main of Snap4City

url: http://dashboard/dashboardSmartCity    (it has been assegined as hostname “dashboard”, see “Configuration and Deploy”)

According to the Snap4City model, the user of the environment may have differen roles, and according to the roles, they have access to different kind of activities. 4 Different roles are available usually: Manager, AreaManager, ToolAdmin and RootAdmin. In the VM you have preconfigured 4 users, one for each role.

username: usermanager     (lower level)      password: 5AwJZkp                  (Manager)

username: userareamanager                         password: Mdn!hkH                 (AreaManager)

username: usertooladmin                             password: $vVP8sQ                 (ToolAdmin)

username: userrootadmin (top level)           password: Sl9.wrE@k              (RootAdmin)

MySQL

username: root                             password: password                       nome database: Dashboard

LDAP (User Role Management)

url: http://dashboard/phpldapadmin/

username: cn=admin,dc=ldap,dc=organization,dc=com                            password: FFjIt2u

For docker version:

on the docker to access to the phpldapadmin you need to set host "myldap" in your client hosts file to refer to the machine with docker then open https://myldap:6443/phpldapadmin/  then login with  user: "cn=admin,dc=ldap,dc=organization,dc=com"  password: secret

KeyCloack (Identity and Access Management)

url: http://dashboard:8088/auth/

Administration console:                username: admin             password: admin

Configuration and Deploy

1) The VM is provided with a static IP network configuration, to which the hostname "dashboard" has been associated. To ensure correct operation in any local network, check and note the static IP assigned when the VM is turned on:

 

2) It is necessary to reconfigure the /etc/hosts file as superuser (su), assigning to the hostname "dashboard" the current IP (leaving the other configuration parameters unchanged):

 

You also need to associate the IP of the VM with the host "dashboard" in your work environment, in the computer that you use to work with the Snap4City VM, for example to open dashboard or to create them.
In Linux,  please modify the usual /etc/hosts file as above,
in Windows the hosts file to be modified is located in the path ......\Windows\System32\drivers\etc

3) At this point, your local Snap4City platform is accessible for you from any browser in your local network where the VM is running at the address: http://dashboard/dashboardSmartCity . Please note that each computer that need to access to that URL has to provide the host file configured as above.

4) To make the Node-RED environment works correctly for the creation of IOT Applications, it is necessary to modify file /home/debian/nr-run.sh, replacing the IP associated with the hostname "dashboard" with your local IP and if you have IOTOBSF VM change also its ip:

 

After to have modified the file, it is necessary to restart the Node-RED docker, executing the following commands:

docker rm --force nodered-1

./nr-run.sh

 

The IOT Application Home (in this version of Snap4City platform) is folder:   /var/www/html/dashboardSmartCity   that through a symbolic link points to the source code, which is in the folder:

/home/debian/dashboard-builder/dashboard-frontend

 

The platform has been designed in PHP v5.6.36 (server side) and HTML + Javascript (client side) and with the Apache web server v2.4.10 and Apache Tomcat v8.0.14 (both installed as self-booting services). Please note that to change the code on your work environment, you can use any IDE by choosing to create and edit a project with existing sources on a remote server.

in this version only one IOT Application (including multiple flows) can be allocated. While in the large scale deploy a cluster of VM with dockers container allows to manage multiple processes and IOT Applications automatically managed. See main page for appliancehttps://www.snap4city.org/drupal/node/471

please note that the settings.js has to refer to the local version of the dashboard builder.

The node-red included into some of the MAINVM may be located into a docker, so that the settings.js can be inside the docker. 

if the Node-red has problems with the Invalid_token, it is probable a problem of refresh token. We suggest you to cancel the refresh tokens as "rm /data/refresh_token*" and reboot the docker or VM. 

Additional Notes

  • This Snap4CityMAINVM  is a starting point to deploy a Snap4City platform, details on what is included into this VM can be found on https://www.snap4city.org/drupal/node/471

  • Snap4City Dashboard Manager on the GitHub repository of the Disit Lab, is updated on a weekly basis. We recommend periodic updates from GitHub (positioning yourself in the /home/debian/dashboard-builder/dashboard-frontend folder and executing the "git pull" command), to make sure you always have the code updated to the latest version released.

  • The push on GitHub, or the upload to the master repository of the changes made to the local version in this VM, is disabled by default, and requires authentication if necessary.

  • A number of test dashboards have been created to illustrate examples of the use of some widgets (map, selector, time-trend, single-content, weather forecast, etc.). For example, the "Traffic Sensors Map And Trends" dashboard (created by the user usertooladmin) shows a selector (widgetSelector) that commands the display on a map (widgetExternalContent) of a category of sensors (in this case traffic sensors). Through other cross-widget interactions then you can click on one of the sensor markers on the map to explode a popup with additional information. In the RT DATA (real time data) tab, if real time data is present, it is possible to click on the button corresponding to the desired time range to display each of the various properties measured by the sensor (in this case: concentration, vehicle flow, average speed, etc.). ). The time trend is displayed in the underlying Time Trend widget (widgetTimeTrend) the time trend of the data for that specific measure. Clicking on the "Last Value" button (always in correspondence of each property) will display the last value measured and received in the widget to the left of the Time Trend (widgetSingleContent) with the title Last Value.

  • The "Sensors, Heatmaps and Geometries" dashboard (created by the usermanager user) represents another combo widget of selector + map (different from the previous dashboard map, this map is a widgetMap type widget, and can display not only sensors, devices, points of interest, but also heterogeneous data such as heatmaps and geometries, polylines, etc.) + Time Trend + Single Content to represent, in addition to various types of sensors (environmental and air quality sensors) and their data real-time, also depictions of heatmaps, geometries (polylines) such as traffic flows and cycle paths, in the metropolitan context of the municipality of Florence.

  • For a more in-depth tutorial on the use of the various features of the platform it is advisable to register on https://www.snap4city.org/ and follow the tutorials and videos displayed on the main page, accessible from the menu item "My Snap4City.org" .