tutorials.TourGuide-App
tutorials.TourGuide-App copied to clipboard
Deployment on Fiware Cloud
Hi,
Tried to get the docker compose version working for a showcase (https://github.com/Fiware/tutorials.TourGuide-App/blob/develop/docker-compose.yml)
- i can access the application under http://tourguide after changing the /etc/hosts entries ( used your scripts)
- when i hit the login button, keystone throws an error in the web application that the application id wasnt found ( seems there is only CLIENT_ID and not the actual application in the paramter)
need help pl.
Hi!
I guess you've launched the docker-compose.yml
file directly using docker-compose.
After having all the services running, you still need to configure some of them using the CLI provided.
In your case, you will need to configure keyrock adding the set of users, organizations, apps, roles and permissions by running:
$ ./tour-guide configure keyrock
And after that, configuring the Oauth credentials:
$ ./tour-guide configure oauth
You can check the documentation for further information: http://fiwaretourguide.readthedocs.io/en/latest/fiware-tour-guide-application-a-tutorial-on-how-to-integrate-the-main-fiware-ges/configuring-security-aspects/
thx will try it and report back
works thank you! Will try to deploy it on fiware cloud ( following http://simple-docker-hosting-on-fiware-cloud.readthedocs.org/en/latest/manuals/install/ )
i expect the following problems:
- since application itself has hosts as dns names in it - and i have them assigned in /etc/hosts on my local computer this wont work for a public instance.
- am i right that there is no quick fix or config i am missing for that?
but i think will be fine for showcasing from a laptop that has the public ip of the vm on fiware cloud mapped to the service names .
you agree?
Well, it depends on the services you would like to show. Internally the application will work, and also, some of the services are mapped to the host; that means you can reach the service without modifying the hosts file. Those services are the ones in which docker-compose
section includes the ports
exposed.
So teorically, if you would like to reach Orion, the following query should work:
curl <public_ip>:1026/v2/entities
Apart from Orion, Keyrock and IDAS ports will be also exposed. See the docker-compose file to check the ports mapping.
So for example, to have Keyrock working, before loading the default provision script using the CLI as mentioned above, you will need to change the redirect_uri
and url
of the script here, adding the public IP of the VM machine where Keyrock is reachable (in that case, we need to reach Horizon, which is exposed in the port 8000
).
I hope this does the trick.
Best
Hi,
what i would like to show is the running the web application showing the restaurants on the map.
then having a small script adding a restaurant through a orion call (which should work).
then showing that the web application has added the restaurant tothe map.
To the point that the web application should work internally. if i remove the hosts entries and access the web application through the ip, no restaurants are retrieved. The chrome console shows me:
- AJAXRequest.js:41 OPTIONS http://tourguide/api/orion/restaurants/ net::ERR_NAME_NOT_RESOLVED
the problem here lies in https://github.com/Fiware/tutorials.TourGuide-App/blob/develop/client/js/restaurantsAPI.js line 23: var baseURL = 'http://tourguide/api/orion/';
you could use window.location.protocol + "//" + window.location.host + "/api/orion/" to get this working i think .-)
Well, this is a completely different issue here. This one regards the client, which I'm not familiar with.
Maybe @FiwareULPGC can help you with your request.
Hi,
client part is working now. Was able to deploy a slightly modified version (https://github.com/hedata/tutorials.TourGuide-App/tree/deployment_on_fiware_cloud) here: http://130.206.127.12/client/
havent changed the keyrock part (for now) but restaurants are shown.
I am now playing with talking to orion, following the guide http://fiwaretourguide.readthedocs.io/en/latest/development-context-aware-applications/v2/how-to-update-and-query-context-information/
`GET <cb_host>:<cb_port>/v2/entities?type=Restaurant&q=name==Elizalde&attrs=name,department&options=keyValues
[ { "id": "0115206c51f60b48b77e4c937835795c33bb953f", "type": "Restaurant", "name": "Elizalde" "department": "Franchise1" } ]` Works
Creating a review: `POST <cb_host>:<cb_port>/v2/entities?options=keyValues
Headers:
{ 'Content-Type': 'application/json', 'Fiware-Service': 'tourguide' }
Payload:
{ "type": "Review", "id": "review-Elizalde-34", "author": "Client1234", "itemReviewed": "0115206c51f60b48b77e4c937835795c33bb953f", "reviewBody": "Cheap and nice place to eat.", "ratingValue": 4 }` Gives Status Code: 201 which should be ok
refreshing the web application doesnt show the review though
Interestingly when looking at the docker logs of the mongodb
i find an entry that looks right
2016-10-25T14:23:07.711+0000 [conn2] insert orion-tourguide.entities query: { _id: { id: "review-Elizalde-34", type: "Review", servicePath: "/" }, attrNames: [ "ratingValue", "itemReviewed", "author", "reviewBody" ], attrs: { ratingValue: { type: "Text", creDate: 1477405387, modDate: 1477405387, value: "4", mdNames: [] }, itemReviewed: { type: "Text", creDate: 1477405387, modDate: 1477405387, value: "0115206c51f60b48b77e4c937835795c33bb953f", mdNames: [] }, author: { type: "Text", creDate: 1477405387, modDate: 1477405387, value: "Client1234", mdNames: [] }, reviewBody: { type: "Text", creDate: 1477405387, modDate: 1477405387, value: "Cheap and nice place to eat.", mdNames: [] } }, creDate: 1477405387, modDate: 1477405387 } ninserted:1 keyUpdates:0 numYields:0 locks(micros) w:115164 133ms
Maybe documentation is wrong explaining how to create Reviews. In the beginning reviews were intended to be created by using the TourGuide-App API. I've generated a review using it and it works displaying it in the client:
POST /api/orion/review HTTP/1.1
Host: tourguide
Content-Type: application/json
fiware-service: tourguide
x-auth-token: r9rqYR3Yurxq93loZwh7G70BncBGDJ
{
"@type": "Review",
"itemReviewed": {
"@type": "Restaurant",
"name": "Lola"
},
"reviewBody": "Testing",
"reviewRating": {
"@type": "Rating",
"ratingValue": 5
}
}
The thing is that, in the entity you've generated, I miss some fields like:
-
dateCreated
(ISO format) -
reviewRating
instead ofratingValue
-
publisher
A valid format without using keyValues could be the one used in the reviewsGenerator.js file: https://github.com/Fiware/tutorials.TourGuide-App/blob/develop/server/feeders/reviewsgenerator.js#L231
Thank you.
Will test this tomorrow.
Got the keyrock part working made the changes you suggested to tourguide-provision.py
Allthough again the app server didnt work. Had to add dirty hacks to oauth2.js (couldnt do it through the config.js since the same variable is used as redirect and for asking the keyrock server where one time you need the public ip adress and one time you need the internal name otherwise the whole thing crashes)
you can see the changes in https://github.com/hedata/tutorials.TourGuide-App/commit/829588d2bbef4bde39e0bb3dd8a66bb46b700969
also moved and changed the Dockerfile so i could debug faster.
One thing to note the performance of the whole keyrock part is abusemawl. 3-4 secs waiting time between authentication and redirect.. and the whole thing is running on 4096 MB RAM | 2 VCPU | 40GB Disk machine
Hmmm I think that maybe you can avoid using that dirty hack changing the Keyrock hostname
in the docker-compose file adding the IP, something like this:
keyrock:
image: fiware/idm:v5.3.0
hostname: 130.206.127.12
container_name: keyrock
links:
- authzforce
expose:
- "5000"
- "8000"
ports:
- "5000:5000"
- "8000:8000"
Regarding the performance, I actually don't remember having any issues with it, but as we are using simple requests I guess it's not regarding TourGuide-App.
Let us know if you finally could put it into work! :)
yeah performance part is really weird.. on my dev laptop it runs like a charm ( no docker host entries or anything ) .. on the server it must have same redirect errors or something.. but no idea atm
just tested the creation of a review as you suggested -> works like a charm.
i have one more question. does the client already show some sensor data without being logged in if i create lets say temperature?
AFAIK client does not display any sensor information :(
hmm that sucks would be nice to show
- generating reviews through smartphone app
- generating temperature through some sensor
updates shown through the webapp
Hi, Has the documentation about hosting on fiware cloud moved? I can't find it. This link does not work. Same page is also referenced from here.
Thanks Lukas
Seems that the readthedocs page is broken, yes, but actually we are not maintaining this documentation. Here is the source: https://github.com/fiware-docker/simple-docker-hosting/blob/master/doc/manuals/install.md
Hello, Ok, thanks for the answer. I'll try that.
Although the documentation is not maintained, the page https://github.com/Fiware/tutorials.TourGuide-App should not contain dead links either.