matrx-software / matrx

Human-Agent Teaming Rapid Experimentation Software
https://www.matrx-software.com
MIT License
10 stars 3 forks source link

How to run MATRX from Virtual Machine? #283

Closed rsverhagen94 closed 3 years ago

rsverhagen94 commented 3 years ago

What is your question? I am trying to run MATRX from a Virtual Machine, using a port that's open for the world. From the Virtual Machine I run the main.py file of my github repository. Then, the idea is that participants can access http://aimanexp.ewi.tudelft.nl:3000/ to start the world. However, it seems that the world is not properly loading (see pictures below).

Screenshot from 2021-05-03 20-18-16 Screenshot from 2021-05-03 20-12-21

However, when I clone my github repo locally and conduct the exact same steps, I do get the world at displayed below:

Screenshot from 2021-05-03 20-16-01

My question is whether you are familiar with this issue, and have some suggestions I can try?

To what is your question related?

jwaa commented 3 years ago

Thanks for the question! It looks like a visualization issue to me. Perhaps a failing connection between The MATRX API and webclient. Could you check the console log of your browser and copy them here? It may contain some information on failing http requests.

@thaije Any ideas from your side?

rsverhagen94 commented 3 years ago

Thanks for the question! It looks like a visualization issue to me. Perhaps a failing connection between The MATRX API and webclient. Could you check the console log of your browser and copy them here? It may contain some information on failing http requests.

@thaije Any ideas from your side?

Hi Jasper, thanks for the quick reply! Below the console log:

Screenshot from 2021-05-03 22-01-48

jwaa commented 3 years ago

Thanks for the screenshot! It looks the connection works but that there is an error in generating the grid. @thaije this is your deparment. Any clue what the error could be (and the solution to it)?

@rsverhagen94 could you help us out by posting your browser version and VM version?

thaije commented 3 years ago

@rsverhagen94 thanks for your question. We are currently working on getting a similar setup working, however in our case running MATRX from a Docker container with kubernetes and auto-restart etc. See here for how you could run MATRX in docker: https://github.com/matrx-software/MATRX_online

As for the problem in your case, I think you only have port 3000 open (used to connect to the visualizer, hence why that works), but not port 3001 (on which the MATRX API is accessible). So how it works is that he user connects to the visualization server at port 3000, and is served the javascript that is the frontend. The frontend runs locally in your browser, and tries to connect to the MATRX API server at port 3001. This is also an external request, as the javascript is not running in the VM. So that is why port 3001 also needs to be opened up to external traffic on your VM. The API and frontend are different ports, as you could also be running a Unity frontend on some server for example that connects with your MATRX world running on another server.

The error you get is probably the frontend that tries to connect with the MATRX API at port 3001, fails, and then proceeds to try and parse an empty state, giving the null error. So the issue would be most likely fixed by opening port 3001 as well for your VM.

I'm interested in your usecase though. It sounds like you want to use it for online experiments, which is something we also are looking into supporting for MATRX in general. Do you have any ideas about how to make sure only 1 participant at a time or at specific times is doing the experiment? And for restarting and saving data etc?

rsverhagen94 commented 3 years ago

Thanks for the screenshot! It looks the connection works but that there is an error in generating the grid. @thaije this is your deparment. Any clue what the error could be (and the solution to it)?

@rsverhagen94 could you help us out by posting your browser version and VM version?

Not sure if still needed but browser version Google Chrome Version 90.0.4430.93 (Official Build) (64-bit) and VM Ubuntu 20.04.02 LTS (GNU/Linux 5.4.0-72-generic x86_64).

rsverhagen94 commented 3 years ago

@rsverhagen94 thanks for your question. We are currently working on getting a similar setup working, however in our case running MATRX from a Docker container with kubernetes and auto-restart etc. See here for how you could run MATRX in docker: https://github.com/matrx-software/MATRX_online

As for the problem in your case, I think you only have port 3000 open (used to connect to the visualizer, hence why that works), but not port 3001 (on which the MATRX API is accessible). So how it works is that he user connects to the visualization server at port 3000, and is served the javascript that is the frontend. The frontend runs locally in your browser, and tries to connect to the MATRX API server at port 3001. This is also an external request, as the javascript is not running in the VM. So that is why port 3001 also needs to be opened up to external traffic on your VM. The API and frontend are different ports, as you could also be running a Unity frontend on some server for example that connects with your MATRX world running on another server.

The error you get is probably the frontend that tries to connect with the MATRX API at port 3001, fails, and then proceeds to try and parse an empty state, giving the null error. So the issue would be most likely fixed by opening port 3001 as well for your VM.

I'm interested in your usecase though. It sounds like you want to use it for online experiments, which is something we also are looking into supporting for MATRX in general. Do you have any ideas about how to make sure only 1 participant at a time or at specific times is doing the experiment? And for restarting and saving data etc?

Thank you for the quick reply! The application for opening port 3001 is pending, I will update you when I have more news.

Regarding our use case, we indeed intend to use it for online experiments. For now, the general idea is to work with fixed time slots for participants carrying out the experiments, but while being in contact with the experiment leader in case things go wrong and a restart is required. Data will be saved on the virtual machine, and making sure only 1 participant at a time is doing the experiment is still something I have to discuss with the technical support of our research group. Let me know if you have some additional remarks or questions regarding our use case. For now, it is still rather general but the next few weeks things should become more concrete. I can keep you posted about these developments of course.

thaije commented 3 years ago

Yes please keep me posted! :) Hopefully it solves the problem. I'm also very interested in how the whole setup works out for the your online experiments and any problems and/or solutions you come across for your usecase. If we have some relevant updates with regard to this topic I'll let you know as well.

rsverhagen94 commented 3 years ago

Yes please keep me posted! :) Hopefully it solves the problem. I'm also very interested in how the whole setup works out for the your online experiments and any problems and/or solutions you come across for your usecase. If we have some relevant updates with regard to this topic I'll let you know as well.

We opened port 3001 and as you expected the problem is solved now. Thanks for the help and I will keep you guys posted about the rest of the developments.

thaije commented 3 years ago

@rsverhagen94 Good to hear! I'll mark this issue as solved, but please do post any updates you have here. Thanks!