EinaamAlim
A machine can use separate VMs to each run OpenPLC and have distinct IP addresses, each using port 8080 for the webserver and 502 for Modbus by default.

Consider a machine (virtual or not) that runs OpenPLC Runtime. Is it possible to run multiple instances of OpenPLC Runtime processes on one machine but with multiple ports? In this setting, suppose each PLC runs its own program with its own system independent of the others. In this scenario, we have the same IP, and potentially different ports for the webserver (e.g. 8080, 8081, 8082, etc.) and the Modbus traffic (502, 503, 504, etc.). Is this possible? If so, what conditions/configuration would need to be set to undertake this effort?

Thanks! ☺
Reply 0 0
EinaamAlim

Other relevant forum posts:
https://openplc.discussion.community/post/whether-openplc-support-to-run-multiple-programs-at-the-same-time-9688346
https://openplc.discussion.community/post/communication-with-two-plc-9890497

I think this implementation can be done by having multiple OpenPLC installations in different places, and also edit some code to avoid them each using the same port (8080). Besides this method, does any other approach stand out as obvious or feasible?

Reply 0 0
thiagoralves
The only possible way for now is to do what you said: have multiple OpenPLC installations in different places, and also edit some code to avoid them each using the same port (8080). To change the port OpenPLC is using, just edit the /OpenPLC_v3/webserver/ webserver.py file, at the very end, replace 8080 with whatever you would like. For modbus port, just edit the modbus server configuration on Settings (on the webserver) for each instance of OpenPLC you have running
Reply 0 0
EinaamAlim

Thanks for the reassurance; greatly appreciate it. Do you think the same could be done with ScadaBr (i.e., running multiple tomcat servers on the same machine)? I imagine it would just be changing the server.xml in the directory, though I haven't investigated that fully yet. I am grateful for your insight. 🙂

Other relevant sites:
https://crunchify.com/how-to-run-multiple-tomcat-instances-on-one-server/

Edit:
In the server.xml, 5 ports should change for multiple instances:

Capture3.png 
Capture2.png 

Thanks.
Reply 0 0
thiagoralves
I think that if all you want to do is run different instances in different ports, the best and most straightforward way to do it is by using docker containers. They are much more lightweight than VMs and allow you to create "containers" for each individual instance you want to run.
Reply 1 0
EinaamAlim
The ScadaBr running on multiple tomcat servers was as straightforward as described above. 

I am running into an issue interacting with multiple instances of OpenPLC using different ports. After changing a (separate) instance of the OpenPLC_v3/webserver/webserver.py, I launched the 2nd webserver using OpenPLC_v3/ start_openplc.sh which calls that webserver.py script. I can interact with the 2nd webserver just fine. I cannot go to the 1st webserver to change any webpages; I am met with the login page and upon providing credentials, it will show me the Dashboard, though upon any click, I am redirected back to the login page.
Reply 0 0
Reply