Skip to content

Commit fb72c41

Browse files
authored
Merge pull request #411 from flaviocirillo/fogflow-fcfork
Fixed tutorial files and documentation
2 parents 90bf434 + d13991c commit fb72c41

File tree

12 files changed

+56
-35
lines changed

12 files changed

+56
-35
lines changed

broker/ngsild.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,31 @@ func (tb *ThinBroker) NGSILD_CreateEntity(w rest.ResponseWriter, r *rest.Request
3838

3939
err := r.DecodeJsonPayload(&entity)
4040
if err != nil {
41-
DEBUG.Println("not able to decode the received message")
41+
if LoggerIsEnabled(DEBUG) {
42+
DEBUG.Println("not able to decode the received message")
43+
}
4244
rest.Error(w, err.Error(), http.StatusInternalServerError)
4345
return
4446
}
4547

4648
ngsildUpsert := make([]map[string]interface{}, 0)
4749
ngsildUpsert = append(ngsildUpsert, entity)
4850

51+
if LoggerIsEnabled(DEBUG) {
52+
DEBUG.Println("NGSI LD Upsert:")
53+
DEBUG.Println(ngsildUpsert)
54+
}
55+
4956
updateCtxReq := UpdateContextRequest{}
5057
numUpdates := updateCtxReq.ReadFromNGSILD(ngsildUpsert)
5158

5259
// check and add the "Fiware-Correlator" header into the update message
5360
updateCtxReq.Correlator = r.Header.Get("Fiware-Correlator")
5461

55-
// DEBUG.Println(updateCtxReq)
62+
if LoggerIsEnabled(DEBUG) {
63+
DEBUG.Println("NGSI updateCtxReq")
64+
DEBUG.Println(updateCtxReq)
65+
}
5666

5767
if numUpdates > 0 {
5868
tb.handleInternalUpdateContext(&updateCtxReq)

broker/thinBroker.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,9 @@ func (tb *ThinBroker) UpdateContext2RemoteSite(ctxElem *ContextElement, updateAc
429429
func (tb *ThinBroker) notifySubscribers(ctxElem *ContextElement, correlator string, checkSelectedAttributes bool) {
430430
eid := ctxElem.Entity.ID
431431

432-
// DEBUG.Println("elements", ctxElem)
432+
if LoggerIsEnabled(DEBUG) {
433+
DEBUG.Println("elements to check against subscription", ctxElem)
434+
}
433435

434436
tb.e2sub_lock.RLock()
435437
defer tb.e2sub_lock.RUnlock()
@@ -480,7 +482,9 @@ func (tb *ThinBroker) notifySubscribers(ctxElem *ContextElement, correlator stri
480482
elements = append(elements, *ctxElem)
481483
}
482484

483-
// DEBUG.Println("elements", elements)
485+
if LoggerIsEnabled(DEBUG) {
486+
DEBUG.Println("elements", elements)
487+
}
484488
go tb.sendReliableNotify(elements, sid)
485489
}
486490
}

common/communicator/communicator.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ func (communicator *Communicator) consumeOne(d amqp.Delivery, taskProcessor Task
155155
return
156156
}
157157

158-
//log.Printf("Received new message: %s", d.Body)
159-
160158
msg := RecvMessage{}
161159
if err := json.Unmarshal(d.Body, &msg); err != nil {
162160
d.Nack(false, false) // multiple, requeue

designer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"description": "web portal for users to manage the system and applications",
55
"author": "Bin Cheng<bin.cheng@neclab.eu>",
66
"main": "main.js",
7+
"type": "module",
78
"scripts": {
89
"start": "node main.js"
910
},
10-
"type": "module",
1111
"dependencies": {
1212
"amqplib": "^0.8.0",
1313
"axios": "*",

docs/en/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
# -- Options for HTML output ----------------------------------------------
1818
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
1919

20-
#html_theme = 'alabaster'
20+
html_theme = 'sphinx_rtd_theme'
2121
#html_static_path = ['_static']

docs/en/source/onepage.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ To install Docker CE, please refer to `Install Docker CE`_, required version > 1
4949

5050

5151
.. important::
52-
**please also allow your user to execute the Docker Command without Sudo `Docker Post-Install`_**
52+
53+
Please also allow your user to execute the Docker Command without Sudo `Docker Post-Install`_
5354

5455

5556

@@ -76,7 +77,7 @@ Download the docker-compose file and the configuration files as below.
7677
wget https://raw.githubusercontent.com/smartfog/fogflow/refs/heads/development/release/latest/cloud/docker-compose.yml
7778
7879
# the template of the configuration file used by all FogFlow components
79-
wget https://github.com/smartfog/fogflow/blob/development/release/latest/cloud/config-template.json
80+
wget https://raw.githubusercontent.com/smartfog/fogflow/refs/heads/development/release/latest/cloud/config-template.json
8081
8182
# the configuration file for ngsix server
8283
wget https://raw.githubusercontent.com/smartfog/fogflow/refs/heads/development/release/latest/cloud/nginx.conf
@@ -244,13 +245,13 @@ There are two ways to check if the FogFlow cloud node is started correctly:
244245
245246
.. important::
246247

247-
if you see any container is missing, you can run "docker ps -a" to check if any FogFlow component is terminated with some
248+
If you see any container missing, you can run "docker ps -a" to check if any FogFlow component is terminated with some
248249
problem. If there is, you can further check its output log by running "docker logs [container ID]"
249250

250251

251252
- Check the system status from the FogFlow DashBoard
252253

253-
You can open the FogFlow dashboard in your web browser to see the current system status via the URL: http://<my_hostip>/index.html
254+
You can open the FogFlow dashboard in your web browser to see the current system status via the URL: `http://<my_hostip>/index.html`
254255

255256

256257
.. important::
@@ -366,6 +367,8 @@ Let's first connect FogFlow to get the data from a NGSI-LD context broker. The i
366367
In order to do so, send the following request:
367368

368369
.. code-block:: console
370+
371+
369372
curl --silent --output /dev/null --location "http://<SCORPIO_HOST>:9090/ngsi-ld/v1/subscriptions" \
370373
--header 'Content-Type: application/ld+json' \
371374
--data-raw '{
@@ -392,6 +395,8 @@ In order to connect FogFlow to forward data to the NGSI-LD context broker, we ne
392395
with a request that looks like the following (note that to set the destination as NGSI-LD we use a header):
393396

394397
.. code-block:: console
398+
399+
395400
curl --location 'http://<FOGFLOW_BROKER>:8070/ngsi10/subscribeContext' \
396401
--header 'Destination: NGSI-LD' \
397402
--header 'Fiware-Correlator: http://<SCORPIO_HOST>:9090/' \

release/latest/cloud/config-template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"discovery": {
1515
"http_port": 8090,
16-
"storeOnDisk": true,
16+
"storeOnDisk": false,
1717
"delayStoreOnFile" : 3
1818
},
1919
"broker": {
@@ -37,7 +37,7 @@
3737
"webSrvPort": 8080,
3838
"agentPort": 1030,
3939
"ldAgentPort":1090,
40-
"doNotInitApplications":true
40+
"doNotInitApplications":true
4141
},
4242
"rabbitmq": {
4343
"port": 5672,

release/latest/cloud/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"my_hostip": "10.1.99.17",
2+
"my_hostip": "host.docker.internal",
33
"physical_location":{
44
"longitude": 139,
55
"latitude": 35
@@ -9,7 +9,7 @@
99
"info":"stdout",
1010
"error":"stdout",
1111
"protocol": "stdout",
12-
"debug": "stdout"
12+
"debug": "discard"
1313
},
1414
"discovery": {
1515
"http_port": 8090,

release/latest/cloud/docker-compose.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
version: "3"
22
services:
3-
# designer:
4-
# image: fogflow/designer:latest
5-
# volumes:
6-
# - ./config.json:/app/config.json
3+
designer:
4+
image: fogflow/designer:latest
5+
volumes:
6+
- ./config.json:/app/config.json
77
# - ./designerDB/:/app/public/data/meta/
8-
# ports:
9-
# - 8080:8080
10-
# - 1030:1030
11-
# - 1090:1090
12-
# depends_on:
13-
# - discovery
14-
# - cloud_broker
15-
# - rabbitmq
16-
# restart: always
8+
ports:
9+
- 8080:8080
10+
- 1030:1030
11+
- 1090:1090
12+
depends_on:
13+
- discovery
14+
- cloud_broker
15+
- rabbitmq
16+
restart: always
1717

1818
discovery:
1919
image: fogflow/discovery:latest
@@ -22,7 +22,7 @@ services:
2222
# - ./discoveryDB/registrations.json:/registrations.json
2323
# - ./discoveryDB/brokers.json:/brokers.json
2424
# - ./discoveryDB/subscriptions.json:/subscriptions.json
25-
- ./discoveryDB/:/discoveryDB/
25+
# - ./discoveryDB/:/discoveryDB/
2626
ports:
2727
- 8090:8090
2828
restart: always

release/latest/cloud/nginx.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ http {
77
listen 80;
88
server_name www.fogflow.io;
99

10-
# location / {
11-
# proxy_pass http://designer:8080/;
12-
# }
10+
location / {
11+
proxy_pass http://designer:8080/;
12+
}
1313

1414
location /ngsi9/ {
1515
proxy_pass http://discovery:8090/ngsi9/;

0 commit comments

Comments
 (0)