HOWTO: Repair the problem of the maps in the Sentilo Catalog Web Application

415 views
Skip to first unread message

io.se...@gmail.com

unread,
Jul 6, 2018, 5:36:36 AM7/6/18
to sen...@googlegroups.com

Dear friends of Sentilo,


As you know, our map map is based on Google Maps. Recently, Google has applied a new management mode for its Keys APIs, and the Sentilo maps layer has been affected by it.

Please, see this url for more information about Google APIs usage and Billing information: https://developers.google.com/maps/documentation/javascript/usage-and-billing

The effect is that it paralyzes the use of the main map and the rest of the maps of the application. 



Below we explain how to proceed in order to update the configuration of the Sentilo Catalog Web Application and how to solve this problem.


Basically it is necessary to include a valid API Key in the catalog application you are using.


Please, note before continuing, that it is important to indicate that you must have a valid Google Maps API Key (please visit the following url for more information: https://developers.google.com/maps/documentation/javascript/get-api-key, follow GET STARTED link in order to obtain a valid GMaps API Key).



Once we have the correctly generated Key API, we will apply it in the configuration of the Sentilo Catalog Web Application. For this, we will take as an example the configuration in the Sentilo 1.7.0 Virtual Machine (you can find it at http://www.sentilo.io/xwiki/bin/view/Sentilo.Community.Documentation/Use+a+Virtual+Machine)

There are different methods to get successfully configured your catalog application. Please, read carefully the entire following content to decide which of the proposed solutions is the most useful for each case.



A. Modification of the source code (must recompile source code and redeploy war file to Tomcat)


This is the recommended method, since the configuration file will remain with the correct value each time we recompile the code for some reason.

  • Go to the Sentilo Catalog Web Application source code folder
    • $ cd /home/sentilo/src/sentilo/sentilo-catalog-web
  • Edit the catalog application configuration file:
    • $ nano src/main/resources/properties/catalog-config.properties
  • At the end of the file, you'll find this property: google.api.key=
    • please, set as value your own Google Maps API Key value
  • Recompile the Sentilo Catalog Application, running next command:
    • $ mvn clean package
  • Go with root user identity for system facilities
    • $ sudo su -
  • Stop Tomcat 8 service
    • # service tomcat8 stop
  • Deploy the war file
    • # cp ./target/sentilo-catalog-web.war /opt/tomcat8/webapps/
  • Start Tomcat8 service
    • # service tomcat8 start
  • Exit root identity
    • # exit
  • Open a web browser and validate the correct operation of maps (note that the tomcat service startup can take some seconds)




B. Edit the web application configuration file directly (it is not necessary to recompile the source code)


Note that this is the fastest and easiest method, but the least safe, since if we ever recompile the source code, we will lose the modified values.

  • Go with root user identity for system facilities
    • $ sudo su -
  • Stop Tomcat 8 service
    • # service tomcat8 stop
  • Edit the Sentilo Catalog Web application configuration file within the Tomcat 8 deployed webapps directory
    • # vi /opt/tomcat8/webapps/sentilo-catalog-web/WEB-INF/classes/properties/
  • At the end of the file, you'll find this property: google.api.key=
    • please, set as value your own Google Maps API Key value
  • Start Tomcat8 service
    • # service tomcat8 start
  • Exit root identity
    • # exit
  • Open a web browser and validate the correct operation of maps (note that the tomcat service startup can take some seconds)


----



Once the process is finished, and the tomcat8 service started, we can see the welcome screen again:





See below a sample of catalog-config.properties file content, look for the last line including your own Gmaps Api Key (you must paste your own one over the PASTE_HERE_YOUR_OWN_GMAPS_API_KEY  text replacing it):


#-------------------------------------------------------------------------------
# Sentilo
#
# Original version 1.4 Copyright (C) 2013 Institut Municipal d’Informàtica, Ajuntament de Barcelona.
# Modified by Opentrends adding support for multitenant deployments and SaaS. Modifications on version 1.5 Copyright (C) 2015 Opentrends Solucions i Sistemes, S.L.
#
#
# This program is licensed and may be used, modified and redistributed under the
# terms  of the European Public License (EUPL), either version 1.1 or (at your
# option) any later version as soon as they are approved by the European
# Commission.
#
# Alternatively, you may redistribute and/or modify this program under the terms
# of the GNU Lesser General Public License as published by the Free Software
# Foundation; either  version 3 of the License, or (at your option) any later
# version.
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
#
# See the licenses for the specific language governing permissions, limitations
# and more details.
#
# You should have received a copy of the EUPL1.1 and the LGPLv3 licenses along
# with this program; if not, you may find them at:
#
#   https://joinup.ec.europa.eu/software/page/eupl/licence-eupl
#   http://www.gnu.org/licenses/
#   and
#   https://www.gnu.org/licenses/lgpl.txt
#-------------------------------------------------------------------------------
##############################################################################################
# This file allows to configure the parameters needed to access to catalog backend (MondoDB)
# and other stuffs
##############################################################################################
catalog
.app.id=sentilo-catalog
catalog
.default.locale=en

# Timezone and pattern in which dates are printed in views and graphics
catalog
.default.timezone=UTC
catalog
.default.datePattern=dd/MM/yyyy HH:mm:ss

# Defaul observations number in charts
catalog
.default.chart.numObs=10

# The limit of points to store for each route
route
.max.size=20

#MongoDB config params
catalog
.mongodb.host=127.0.0.1
catalog
.mongodb.port=27017
catalog
.mongodb.database=sentilo
catalog
.mongodb.user=sentilo
catalog
.mongodb.password=sentilo

#Authorized api client IP
catalog
.api.client.ip=127.0.0.1

#Sentilo endpoint
rest
.client.host=http://127.0.0.1:8081
#Token used to call the REST API: must be equal to the sentilo-catalog token
rest
.client.identity.key=c956c302086a042dd0426b4e62652273e05a6ce74d0b77f8b5602e0811025066

# Google API key to use Google Maps
google
.api.key=PASTE_HERE_YOUR_OWN_GMAPS_API_KEY

Where PASTE_HERE_YOUR_OWN_GMAPS_API_KEY will be some text like: AIzaSyDbRzw1ragH1QuvxLrwaOKrLhYdIsmcd9s

----


We trust that with these two configuration methods you will be able to make the Sentilo Catalog Web Application maps available again and we hope that you have been very helpful.

Do not hesitate to make your questions or comments about it.




Best regards,
Sentilo Team
Auto Generated Inline Image 1
Auto Generated Inline Image 2
Auto Generated Inline Image 3
Auto Generated Inline Image 4

Cow Jesna

unread,
Jul 9, 2018, 10:07:02 AM7/9/18
to Sentilo
Dear Sentilo Team,

Thanks for your answer for repairing the map. I was trying the solution A, but it failed at the step of stopping Tomcat 8 service (as shown at the last few lines of my captured screen below). How should I fix it?

Regards,
Jeff


io.se...@gmail.com

unread,
Jul 10, 2018, 6:59:21 AM7/10/18
to Sentilo
Dear Jeff,

We have detected some cases in which the system indicates that the instance of tomcat8 does not exist, but has succeeded in stopping it previously.

We urge you to validate the existence of your process through the command:

ps -aux | grep tomcat8

If there is no instance, it really has been stopped, and you can proceed normally.

In any case, you can make the changes and restart the system, in case the service administration does not work.

We apologize for the inconvenience caused. We will try to solve it in future versions of the Sentilo virtual machine.

Please let us know if you have been able to finally solve it.


Best regards,

Sentilo Team

Cow Jesna

unread,
Jul 12, 2018, 5:29:39 AM7/12/18
to Sentilo
Dear Sentilo Team,

I checked with the ps command and seems the tomcat8 was stopped, then I tried with both solution A and B, but they seemed not working.
Below is the captured screen for solution A. It failed to find the file.


Below is the captured screen for solution B (in the procedure of using vi editor). The file seems to be empty.




Thanks,

Jeff


io.se...@gmail.com

unread,
Jul 17, 2018, 5:44:43 AM7/17/18
to Sentilo
Hello Jeff,

It seems that you are issuing the "cp" command from /root. But, the war file is in /home/sentilo/src/sentilo/sentilo-catalog-web/target.

Please make sure you followed the path A including all steps, including the "cd /home/sentilo/src/sentilo/sentilo-catalog-web" and "mvn clean package".
We had previously a small typo in the path A steps, it is fixed now, sorry about that. It should work now by just copying the commands.

Hope it helps,

Regards,
Sentilo Team.

Cow Jesna

unread,
Jul 17, 2018, 9:27:45 AM7/17/18
to Sentilo
Dear Sentilo Team,

So much thanks for your help, I have fixed the key error by following your solution A (with cd /home/sentilo/src/sentilo/sentilo-catalog-web/ before deploying the war file). By the way, there are still typos of "tomcat8" in your solution, which were typed as "tomat8".

Thanks again!

Regards,
Jeff

Jarlienr

unread,
Aug 2, 2019, 9:28:52 AM8/2/19
to Sentilo
Problem with  cp ./target/sentilo-catalog-web.war /opt/tomcat8/webapps/

The problem is the destination file  does not exist this time around. I searched and found /tomcat8  at /etc folder but the is no /webapps folder.

With that solution B also does not work with the same reason as there /tomcat8/webapps and its subdirectories  are  missing  
ErrorCP.jpg

Jarlienr

unread,
Aug 2, 2019, 9:31:00 AM8/2/19
to Sentilo
ADDENDUM: I use the latest VM at the main site.

Sentilo IO

unread,
Aug 5, 2019, 2:47:53 AM8/5/19
to Sentilo
Hi Jarlienr,

yes, the webapps folder location has changed in the latest 1.8.0 VM. Now it's /var/lib/tomcat8/webapps/. 

The original post is one year old and it refers to the previous VM.

Now there's a Tomcat 8 from the Ubuntu repository, and this package does not use /opt directory.

In /home/sentilo/README there are more detailed instructions on how to change the api key. 

Regards,
Sentilo Team
Reply all
Reply to author
Forward
0 new messages