OpenMTC / OpenMTC

OpenMTC is a reference implementation of the oneM2M standard, for conducting applied research and developing innovative M2M and IoT applications.
http://www.openmtc.org
Eclipse Public License 1.0
46 stars 22 forks source link

start-app.sh not working in macOS Catalina #52

Open juliopovedacs opened 4 years ago

juliopovedacs commented 4 years ago

Hello,

When I try to run $ ./start-app.sh the following appears:

error1

I ignored the readlink message and entered the number 2:

error2

but then an error appeared:

error3

Can you help me please?

Thank you.

juliopovedacs commented 4 years ago

I was able to solve it by executing:

$ brew install coreutils

$ nano start-app.sh

In start-app.sh, I changed readlink with greadlink

I will create a pull request with this change in start-app.sh.

lcoimbra commented 4 years ago

After getting it to run, were you able to get the ipe with the respective gui working correctly? Having the gui receive notifications when content is pushed to the subscribed containers?

juliopovedacs commented 4 years ago

Hello @lcoimbra. After executing:

$ brew install coreutils

$ nano start-app.sh

and changing readlink with greadlink in start-app.sh, I was able to run the OpenMTC examples.

lcoimbra commented 4 years ago

Hello! Thank you for getting back to me! I'm not using macOS so I didn't have that issue. My problem is with the communication of notifications from the backend to the gui, where the request always results in 404, this is visible in the backend logs below:

Configuring M2M backend...done
DEBUG:openmtc_gevent.main:Trying config file location: /config-backend.json
DEBUG:openmtc_gevent.main:Trying config file location: /etc/openmtc/gevent/config-backend.json
DEBUG:openmtc_gevent.main:Reading config file: /etc/openmtc/gevent/config-backend.json
DEBUG:rdflib:RDFLib Version: 5.0.0
::ffff:172.17.0.3 - - [2020-08-05 20:46:42] "POST /~/in-cse-1/onem2m HTTP/1.1" 201 569 0.020918
::ffff:172.17.0.3 - - [2020-08-05 20:46:42] "GET /~/in-cse-1/onem2m HTTP/1.1" 200 496 0.010105
::ffff:172.17.0.1 - - [2020-08-05 20:46:50] "DELETE /onem2m/TestGUI HTTP/1.1" 404 183 0.000955
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "POST /onem2m HTTP/1.1" 201 568 0.004598
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "GET /onem2m/TestGUI?rcn=5 HTTP/1.1" 200 563 0.006829
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&fu=1&lbl=commands HTTP/1.1" 200 352 0.035137
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&fu=1&lbl=measurements HTTP/1.1" 200 401 0.020118
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "GET /~/mn-cse-1/onem2m/TestIPE/devices/Temp-1/measurements?rcn=5 HTTP/1.1" 200 677 0.030798
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "POST /~/mn-cse-1/onem2m/TestIPE/devices/Temp-1/measurements HTTP/1.1" 201 953 0.032633
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "GET /~/mn-cse-1/onem2m/TestIPE/devices/Humi-2/measurements?rcn=5 HTTP/1.1" 200 748 0.031940
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "POST /~/mn-cse-1/onem2m/TestIPE/devices/Humi-2/measurements HTTP/1.1" 201 953 0.023399
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "GET /~/mn-cse-1/onem2m/TestIPE/devices/Humi-1/measurements?rcn=5 HTTP/1.1" 200 676 0.047576
::ffff:172.17.0.1 - - [2020-08-05 20:47:03] "POST /~/mn-cse-1/onem2m/TestIPE/devices/Humi-1/measurements HTTP/1.1" 201 954 0.030878
::ffff:172.17.0.1 - - [2020-08-05 20:47:04] "PUT /onem2m/TestGUI HTTP/1.1" 200 563 0.006206
::ffff:172.17.0.1 - - [2020-08-05 20:47:04] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A03.611139%2B00%3A00&fu=1&lbl=commands HTTP/1.1" 200 236 0.024195
::ffff:172.17.0.1 - - [2020-08-05 20:47:04] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A03.844831%2B00%3A00&fu=1&lbl=measurements HTTP/1.1" 200 290 0.030844
::ffff:172.17.0.1 - - [2020-08-05 20:47:04] "GET /~/mn-cse-1/onem2m/TestIPE/devices/Temp-2/measurements?rcn=5 HTTP/1.1" 200 680 0.025316
::ffff:172.17.0.1 - - [2020-08-05 20:47:04] "POST /~/mn-cse-1/onem2m/TestIPE/devices/Temp-2/measurements HTTP/1.1" 201 954 0.029276
::ffff:172.17.0.3 - - [2020-08-05 20:47:05] "POST /_/openmtc.org/in-cse-1/CTestGUI HTTP/1.1" 404 183 0.021268
::ffff:172.17.0.1 - - [2020-08-05 20:47:05] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A04.638004%2B00%3A00&fu=1&lbl=commands HTTP/1.1" 200 236 0.056333
::ffff:172.17.0.1 - - [2020-08-05 20:47:06] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A04.947689%2B00%3A00&fu=1&lbl=measurements HTTP/1.1" 200 236 0.046836
::ffff:172.17.0.3 - - [2020-08-05 20:47:06] "POST /_/openmtc.org/in-cse-1/CTestGUI HTTP/1.1" 404 183 0.005611
::ffff:172.17.0.1 - - [2020-08-05 20:47:06] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A05.702681%2B00%3A00&fu=1&lbl=commands HTTP/1.1" 200 236 0.012797
::ffff:172.17.0.1 - - [2020-08-05 20:47:07] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A06.014767%2B00%3A00&fu=1&lbl=measurements HTTP/1.1" 200 236 0.024260
::ffff:172.17.0.3 - - [2020-08-05 20:47:07] "POST /_/openmtc.org/in-cse-1/CTestGUI HTTP/1.1" 404 183 0.008673
::ffff:172.17.0.1 - - [2020-08-05 20:47:07] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A06.719502%2B00%3A00&fu=1&lbl=commands HTTP/1.1" 200 236 0.015317
::ffff:172.17.0.1 - - [2020-08-05 20:47:08] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A07.042444%2B00%3A00&fu=1&lbl=measurements HTTP/1.1" 200 236 0.021980
::ffff:172.17.0.3 - - [2020-08-05 20:47:08] "POST /_/openmtc.org/in-cse-1/CTestGUI HTTP/1.1" 404 183 0.005285
::ffff:172.17.0.1 - - [2020-08-05 20:47:08] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A07.738322%2B00%3A00&fu=1&lbl=commands HTTP/1.1" 200 236 0.012859
::ffff:172.17.0.1 - - [2020-08-05 20:47:09] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A08.068041%2B00%3A00&fu=1&lbl=measurements HTTP/1.1" 200 236 0.021762
::ffff:172.17.0.3 - - [2020-08-05 20:47:09] "POST /_/openmtc.org/in-cse-1/CTestGUI HTTP/1.1" 404 183 0.004436
::ffff:172.17.0.1 - - [2020-08-05 20:47:09] "GET /~/mn-cse-1/onem2m?drt=1&rcn=5&cra=2020-08-05+20%3A47%3A08.755494%2B00%3A00&fu=1&lbl=commands HTTP/1.1" 200 236 0.013045

The gui application is able to detect containers it is looking for, but after subscribing to a container to receive notifications of new content pushed to that container it never receives anything.

[1] onem2m-gui-sensors-actuators-final.py
[2] onem2m-gui-sensors-final.py
[3] onem2m-ipe-sensors-actuators-final.py
[4] onem2m-ipe-sensors-final.py
Choose the app to start: 1
discovered commands container: /mn-cse-1/onem2m/TestIPE/devices/Switch-AirCon/commands

discovered commands container: /mn-cse-1/onem2m/TestIPE/devices/Switch-Window/commands

Subscribing to Resource: /mn-cse-1/onem2m/TestIPE/devices/Temp-1/measurements
Subscribing to Resource: /mn-cse-1/onem2m/TestIPE/devices/Humi-2/measurements
Subscribing to Resource: /mn-cse-1/onem2m/TestIPE/devices/Humi-1/measurements
Subscribing to Resource: /mn-cse-1/onem2m/TestIPE/devices/Temp-2/measurements

Did this ever happen to you when you got the start-app script running on your system?

juliopovedacs commented 4 years ago

Hi @lcoimbra,

I checked again and I am obtaining the same results as you (some 404s) and I am not sure why this is happening.

Sorry for not being able to help you.

We should be obtaining what appears in the following page right?

https://fiware-openmtc.readthedocs.io/en/latest/training/console-outputs/training-sensor-actuator-gui/index.html

juliopovedacs commented 4 years ago

Hi @lcoimbra,

How are you trying to run the example please? I am trying the following:

First, in one terminal window I run the backend image by executing the run-backend script inside OpenMTC/openmtc-gevent/

Then, in another terminal window I run the gateway image by executing the run-gateway script inside OpenMTC/openmtc-gevent/

After that, in another window I run the start-app.sh script inside OpenMTC/doc/training executing ./start-app.sh and I enter the number 4 to run onem2m-gui-sensors-actuators-final.py (I am not sure why this option is number 4 for me and not number 1 as it appears to you).

In the windows were I ran the backend and gateway images, I see some successful GET requests, but no POST requests.

Have you been able to run this example correctly?

Thank you.

lcoimbra commented 4 years ago

Hello,

Thank you for checking on your side too! Yes, I was expecting an output like the one on the outputs page.

https://fiware-openmtc.readthedocs.io/en/latest/training/console-outputs/training-sensor-actuator-gui/index.html

I have been working with the project running inside docker containers. I started by following the quick start guide, then I tried following the example demonstrated in the webinar: https://youtu.be/gBF4gCTLGww?t=1766 (timestamp 29:26) where they use several other environment variables.

Initially I thought that, since I was working with docker and using the start-app.sh locally, the docker container was unable to communicate with the host system to send the notifications asynchronously. I then replicated one of the containers and ran the consumer and producers from there, but the result was the same.

I have also attempted to customise the config files for both the gateway and backend without success. I have launched a clean install of ubuntu in a virtualbox virtual machine and the outputs were the same.

I also don't know why for me the start-app.sh options listing shows different, but probably just a difference in ordering from macOS to Fedora. When running the examples, it is the ipe and gui pair of the same example, the ipe represents the producer and the gui the consumer that should be notified of new content pushed to the containers.

I will keep trying to figure this out.

lcoimbra commented 4 years ago

Hello!

After running the backend and gateway locally the way you mentioned, I actually got it to work!!

First, in one terminal window I run the backend image by executing the run-backend script inside OpenMTC/openmtc-gevent/

Then, in another terminal window I run the gateway image by executing the run-gateway script inside OpenMTC/openmtc-gevent/

I still don't understand why it is not working with docker, but I will work with everything local for now while investigating this further.

juliopovedacs commented 4 years ago

Hello @lcoimbra,

That's great to hear! Hm, I am not sure why it is not working with Docker.

If I am able to figure out what is going on, I will update you.