Skip to content

Configuration

Distributed Systems and Internet Technology Lab, Distributed Data Intelligence and Tech. Lab edited this page Nov 28, 2019 · 14 revisions

Configuration data is reported into .ini files in the dashboard_frontend/conf folder

The environment.ini file indicate which environment is running (dev, test, prod) and states which parameter to get from the other ini files.

enviroment.ini for development environment:

fileDesc = "Environment"
customForm = "true"
fileDeletable = "false"
environment[desc] = "Environment"
environment[value] = "dev"

the general.ini contains some general site configuration options:

fileDesc = "General"
customForm = "false"
fileDeletable = "false"
host[desc] = "Host"
host[dev] = "localhost"
host[test] = "localhost"
host[prod] = "localhost"
appUrl[desc] = "Application URL"
appUrl[dev] = "http://localhost/dashboardsmartcity/dashboardManagerFixTemp/dashboardSmartCity"
appUrl[test] = "http://localhost/dashboardSmartCity"
appUrl[prod] = "http://www.mydashboard.com"
appHost[desc] = "Application host"
appHost[dev] = "localhost"
appHost[test] = "localhost"
appHost[prod] = "www.mydashboard.com"
cacheControlMaxAge[desc] = "Browser cache control max age"
cacheControlMaxAge[dev] = "1800"
cacheControlMaxAge[test] = "1800"
cacheControlMaxAge[prod] = "1800"
sessionDuration[desc] = "Browser session duration(s)"
sessionDuration[dev] = "28800"
sessionDuration[test] = "3600"
sessionDuration[prod] = "14400"
crossWidgetDefaultLoadWaitTime[desc] = "Cross widget default load wait time"
crossWidgetDefaultLoadWaitTime[dev] = "2250"
crossWidgetDefaultLoadWaitTime[test] = "2250"
crossWidgetDefaultLoadWaitTime[prod] = "2250"
selectoWebDefaultLoadWaitTime[desc] = "Selector Web default load wait time"
selectoWebDefaultLoadWaitTime[dev] = "100"
selectoWebDefaultLoadWaitTime[test] = "200"
selectoWebDefaultLoadWaitTime[prod] = "200"

the "host" value is used for the database connection, while the database.ini file contains specific info for database connection (username, password, dbname):

fileDesc = "Database"
customForm = "false"
fileDeletable = "false"
username[desc] = "Database username"
username[dev] = "user"
username[test] = "user"
username[prod] = "user"
password[desc] = "Database password"
password[dev] = "password"
password[test] = "password"
password[prod] = "password"
dbname[desc] = "Schema name"
dbname[dev] = "Dashboard"
dbname[test] = "Dashboard"
dbname[prod] = "Dashboard"

Note: for the "dbname" settings leave it to Dashboard, as most queries explicitly use the Dashboard database, and currently is useless to change this parameter.

setting SSO

The appUrl parameter in the general.ini file is the prefix used to generate the redirect uri after the successful login, thus it has to match to the valid redirect uris registered in the client setting on keycloak.

the sso.ini file contains information used for setting up the login process:

fileDesc = "OpenIDConnect Single Sign On"
customForm = "false";
fileDeletable = "false"
ssoClientId[desc] = "Client id"
ssoClientId[dev] = "php-dashboard-builder"
ssoClientId[test] = "php-dashboard-builder"
ssoClientId[prod] = "php-dashboard-builder"

ssoClientSecret[desc] = "Client secret"
ssoClientSecret[dev] = "..."
ssoClientSecret[test] = "..."
ssoClientSecret[prod] = "..."

ssoEndpointsFromUrl[desc] = "SSO settings inferred from URL"
ssoEndpointsFromUrl[dev] = "no"
ssoEndpointsFromUrl[test] = "no"
ssoEndpointsFromUrl[prod] = "no"

ssoEndpoint[desc] = "SSO endpoint"
ssoEndpoint[dev] = "http://dashboard:8088"
ssoEndpoint[test] = "http://dashboard:8088"
ssoEndpoint[prod] = "http://dashboard:8088"

ssoTokenEndpoint[desc] = "SSO token endpoint"
ssoTokenEndpoint[dev] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/token"
ssoTokenEndpoint[test] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/token"
ssoTokenEndpoint[prod] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/token"

ssoAuthorizationEndpoint[desc] = "SSO Authorization endpoint"
ssoAuthorizationEndpoint[dev] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/auth"
ssoAuthorizationEndpoint[test] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/auth"
ssoAuthorizationEndpoint[prod] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/auth"

ssoUserinfoEndpoint[desc] = "SSO Userinfo endpoint"
ssoUserinfoEndpoint[dev] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/userinfo"
ssoUserinfoEndpoint[test] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/userinfo"
ssoUserinfoEndpoint[prod] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/userinfo"

ssoJwksUri[desc] = "SSO Jwks endpoint"
ssoJwksUri[dev] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/certs"
ssoJwksUri[test] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/certs"
ssoJwksUri[prod] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/certs"

ssoIssuer[desc] = "SSO Issuer"
ssoIssuer[dev] = "http://dashboard:8088/auth/realms/master"
ssoIssuer[test] = "http://dashboard:8088/auth/realms/master"
ssoIssuer[prod] = "http://dashboard:8088/auth/realms/master"

ssoEndSessionEndpoint[desc] = "SSO EndSession endpoint"
ssoEndSessionEndpoint[dev] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/logout"
ssoEndSessionEndpoint[test] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/logout"
ssoEndSessionEndpoint[prod] = "http://dashboard:8088/auth/realms/master/protocol/openid-connect/logout"

You need to set the client secret that you have in client setting of keycloak and change the all the urls to point to the keycloak server.

setting the organizations

the organization information is stored in the "Organizatons" table:

  • organizationName: name and identifier used for the organization
  • kbUrl: base url to be used for the servicemap serving data of the organization (more organizations can use the same servicemap)
  • gpsCentreLatLng: latitude,longitude of the organization
  • zoomLevel: zoom level to be used on a map
  • lang: the language to be used for the organization
  • broker: name of the broker to be used for the organization
  • orionIP: base url to be used to interact with the orion broker

setting the menu

the menu is built using data from the MainMenu, MainMenuSubmenus, MobMainMenu, MobMainMenuSubmenus tables. If you need to change it you have to change directly the tables. In particular for some menu/submenu it is stored the absolute url to the tool providing the feature, the tool is shown in a iframe in the main page using SSO to let user not see that the page is not produced by the main tool. In this case you need to change manually the absolute url on the table. Moreover if you have set your own organization name you need to change or add it to the organizations column.

The "Mob" version of the tables are structured like the other "main" tables but are used for producing the mobile version of the menu.

The menu shown to users depends also on the "domain" used to connect to the tool, the available domains are identified in the domains table. On the basis of the hostname used in the url to connect to the dashboard-builder it is identified the domain and thus the menu to be shown to the users.

setting the cron tasks

some PHP tasks are run periodically to populate the Dashboard.DashboardWizard table with the IoT devices, services etc. that are present on the service map KB. These scripts are run via some .sh scripts that are in the ScheduledTasks directory, you may change these scripts to run or not some checks depending on your data and configurations.

To setup the cron tasks run crontab -e and write the following (changing the paths if needed):

@reboot rm /var/www/html/dashboardSmartCity/ScheduledTasks/running*.txt

* * * * * /var/www/html/dashboardSmartCity/ScheduledTasks/run-iotapp.sh
0 * * * * /var/www/html/dashboardSmartCity/ScheduledTasks/run.sh
*/10 * * * * /var/www/html/dashboardSmartCity/ScheduledTasks/run-10min.sh
30 * * * * /var/www/html/dashboardSmartCity/ScheduledTasks/run-health.sh

In particular:

  • run-iotapp.sh is executed every minute and it runs in sequence:
    • IOT_Sensor_FeedDashboardWizard.php to get IoT sensors from the KB
    • IOT_App_FeedDashboardWizard.php to get metrics generated from the IoT Apps
    • Personal_Data_FeedDashboardWizard.php to get MyKPI, MyPOI and MyData from the personal data
    • IOT_Actuator_FeedDashboardWizard.php to get IoT actuators from the KB
  • run-10min.sh is executed every 10 minutes and it runs the health check of the car park predictions
  • run-health.sh is executed every 30 minutes and it runs the health check of all the data that is present in the wizard.
  • run.sh is executed every hour and it runs in sequence:
    • FeedDasbhoardWizard.php to get sensors (not IoT sensors) from the KB
    • Heatmap_FeedDashboardWizard.php to get heatmaps from the geoserver

Moreover consider that the scripts make a "cd" to the directory itself, thus if their location is changed they need to be modified accordingly, the scripts write a log file so the user running the cron tasks have to have write access to the directory.

Clone this wiki locally