How to run multiple instanced of Dragonfly

To connect multiple cameras to Dragonfly you need to run multiple instances of the Dragonfly Java App. Dragonfly is already designed such that it is possible to start multiple instances on the same machine. Every instance acts as a web-server, so as long as the web-server port is different on each instance, you can run as many instances as required. Of course, the computing power available on the machine is also a limit. 

There are at present 2 options:

OPTION 1 – Using Docker

It is quite straightforward to run multiple instances. You have simply to start multiple containers with a different port number. More information about the setup on Docker inside this page. However, it should be noted that:

  • The hardware requirements to run multiple instances of Dragonfly on the same machine are pretty high. For good performances, at least 2 cores and 8 GB or memory per instance are recommended. A standard laptop may struggle a lot to run multiple instances of Dragonfly at once.
  • If you want to pursue this option please be aware that it is very tricky, and sometime not possible, to configure Docker in order to access USB cameras (while there are not problems accessing IP cameras).

OPTION 2 – Replicating the installation folder

It is possible to run multiple instances also duplicating the Dragonfly installation folder. If you’d like to run Dragonfly twice, just run the Dragonfly Java Application from 2 different Dragonfly folders. Here too, it is required that the instances use different ports numbers. This can easily be changed from:

  • the Dragonfly Java Application Configuration tab.
  • or directly inside the dragonfly2.properties file.

Practically speaking these are the steps to create a replica:

  1. Terminate any running instance of the Dragonfly Java App (using the Terminate button under the Configuration tab).
  2. Access the folder dragonfly_linux/
  3. Make a copy of the dragonfly_linux/application/ directory and rename the copy into dragonfly_linux/application_2/
  4. Access the folder application_2/data/config and open the dragonfly2.properties file.
    • Set the WEBSERVER_PORT parameter to 5002
    • Save the file!
  5. Open the start.sh file under dragonfly_linux/application_2:
    • Rename the directory string from application to application_2
    • Change the port from 5000 to 5002
    • Save the file!
  6. Open the start_headlesss.sh file under dragonfly_linux/application_2:
    • rename the directory string from application to application_2
    • Save the file!
  7. Move into the dragonfly_linux/application_2 folder and launch the Dragonfly Java App using this string:
    • java -jar dfja-1.5-dist.jar
  8. Proceed with the configuration of the new instance (calibration file name, cam to be used…).