Setting Up SCADA LTS
SCADA LTS deployment guide for ALPON X4 with Docker and Sixfab Connect.
This guide provides step-by-step instructions for deploying SCADA LTS on the ALPON X4 micro-edge computer. SCADA LTS is an open-source platform for industrial automation, enabling real-time monitoring and control of devices. By following this guide, you will learn how to configure Modbus (Ethernet/WiFi), build a Docker container, and deploy SCADA LTS on Sixfab Connect.
Prerequisites
Before starting, ensure you have the following:
Basic Knowledge:
- Familiarity with Docker and containerization.
- Understanding of industrial automation concepts (e.g., Modbus, SCADA systems).
Tools:
- Docker CLI installed on your local machine.
- Git CLI (optional, for cloning repositories).
- A text editor like Nano or Vim.
NOTE
Before deploying, please ensure that ports 8080 and 3306 are not in use on your ALPON X4 device, as these ports are required for SCADA LTS and MySQL connections.
If you're using a remote MySQL server, don't forget to configure your authorization settings properly. After making all these changes, rebuild the container.
Additionally, for HiveMQ to be accessible, configure SCADA LTS to use the LAN IP address for communication, ensuring that SCADA LTS can reach HiveMQ as needed.
Deployment Dependencies
1. Deploy HiveMQ
-
Navigate to the Applications tab of your asset and click "+ Deploy".
-
Enter a container name and check "I would like to use my own container path".
-
Fill the "Image name" field with hivemq-container
-
Click "+ Add More" in the Ports section and add the following ports:
From To 30881 8080 31883 1883
-
Click the "Deploy" button to deploy HiveMQ on ALPON X4 successfully.
2. Deploy MySQL
-
Navigate to the Applications tab of your asset and click "+ Deploy".
-
Enter a container name and check "I would like to use my own container path".
-
Fill the "Image name" field with mysql-container
-
Click "+ Add More" in the Environments section and add the following environments:
Key Value MYSQL_ROOT_PASSWORD root MYSQL_DATABASE scadalts MYSQL_USER root MYSQL_PASSWORD root -
Configure MySQL Settings via my.cnf:
To enable log-bin-trust-function-creators, you need to add a custom my.cnf file with the required settings. Follow these steps:- Go to the Sixfab Connect interface and click on the "Open Remote Terminal" button to access the terminal.
- Then, create the my.cnf file in the /tmp/ directory on the device:
nano /tmp/my.cnf
- Inside this file, add the following content:
[mysqld] log-bin-trust-function-creators=1
- Save and exit the editor.
-
Finally, mount this configuration file to the MySQL container. Click "+ Add More" in the Volumes section and configure the following volumes:
Read/Write From To Read/Write /tmp/my.cnf /tmp/my.cnf
-
Enable “Host Network”.
-
Click the "Deploy" button to deploy the MySQL Server on ALPON X4 successfully.
Prepare Dockerfile and Deploy SCADA LTS
To set up SCADA LTS on ALPON X4, we’ll start by creating a Dockerfile to install SCADA LTS and its dependencies.
1. Clone Scada-LTS From GitHub
To build Scada-LTS, we need source code and Dockerfile.
git clone https://github.com/SCADA-LTS/Scada-LTS.git
2. Download Scada-LTS “WAR” File
Go to the Scada-LTS release page, find the latest stable version and download the war file. Then move it to the Scada-LTS folder we cloned in step 1.
3. Edit Dockerfile in Cloned Scada-LTS Folder
Below is a Dockerfile that installs SCADA LTS, prepares a runtime environment, and provides Modbus communication. Update the Dockerfile in the repo we cloned in step 1. and edit it as follows.
FROM tomcat:9.0.86-jre11
COPY tomcat/lib/mysql-connector-java-5.1.49.jar /usr/local/tomcat/lib/mysql-connector-java-5.1.49.jar
COPY tomcat/lib/activation.jar /usr/local/tomcat/lib/activation.jar
COPY tomcat/lib/jaxb-api-2.4.0-b180830.0359.jar /usr/local/tomcat/lib/jaxb-api-2.4.0-b180830.0359.jar
COPY tomcat/lib/jaxb-core-3.0.2.jar /usr/local/tomcat/lib/jaxb-core-3.0.2.jar
COPY tomcat/lib/jaxb-runtime-2.4.0-b180830.0438.jar /usr/local/tomcat/lib/jaxb-runtime-2.4.0-b180830.0438.jar
COPY Scada-LTS.war /usr/local/tomcat/webapps/
RUN apt update;
RUN apt install -y unzip;
RUN apt install -y wait-for-it;
RUN apt clean;
RUN rm -rf /var/lib/apt/lists/*;
RUN ls -l;
RUN cd /usr/local/tomcat/webapps/ && ls -l && mkdir Scada-LTS && unzip Scada-LTS.war -d Scada-LTS;
COPY docker/config/context.xml /usr/local/tomcat/webapps/Scada-LTS/META-INF/context.xml
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/bin/wait-for-it", "--host=database", "--port=3306", "--timeout=30", "--strict", "--", "/usr/local/tomcat/bin/catalina.sh", "run"]
Note: If using a remote database, update only the IP address for database in the entrypoint.sh script.
4. Create entrypoint.sh
Script
entrypoint.sh
ScriptThe following entrypoint.sh script is necessary to ensure that the MySQL database hostname (database
) is recognized by the container. If using a remote database, replace 127.0.0.1
with the IP address of your MySQL server.
Save the script in the same directory as the Dockerfile:
#!/bin/bash
if ! grep -q "127.0.0.1 database" /etc/hosts; then
echo "127.0.0.1 database" >> /etc/hosts
fi
exec "$@"
5. Build and Test the Docker Image Locally
Before deploying on Sixfab Connect, build and test the Docker image on your personal computer:
docker build -t scadalts-container .
docker run --network host -it scadalts-container
The p
flag maps SCADA LTS’s default port (8080) to the host, allowing you to test locally at http://localhost:8080
.
6. Build & Push Sixfab Registry
After testing on your local device, the container needs to be rebuilt according to arm64 architecture in order to run on ALPON X4. Let's do this with the following command.
docker buildx build --platform=linux/arm64 -t scadalts-container .
After build completed successfully, go to Sixfab Connect’s Registry tab and perform the operations shown in sequence by clicking the "+ Add Container" button.
7. Deploy Scada-LTS
-
Go to the Application section of your asset on Sixfab Connect.
-
Click the + Deploy button to configure and deploy the container.
-
In the Deploy Container window, use the following settings:
-
Container Name: Enter the application name (e.g., "scadalts-container").
-
Image: Select the Scada-LTS container image and tag pushed to the Sixfab Registry.
-
Environment: Click "+ Add More" in the environment section and add the following values:
Key Value CATALINA_OPTS -Xmx2G -Xms2G
-
Enable the Host Network option.
-
Click the "+ Deploy" button to deploy the application on your ALPON X4 device. Then, wait ~5 minutes for Scada-LTS to start.
Important Note: If you will use a data transfer via USB, do not forget to enable the “Privileged” option on the deployment screen for ScadaLTS to work correctly.
-
Final Step
After deployment, wait ~5 minutes and retrieve the device's IP address from the device interface. In your web browser, navigate to http://<DEVICE_IP_ADDRESS>:8080 to access the ScadaLTS dashboard. When you reach the ScadaLTS dashbaord, you can successfully make your MODBUS & other settings in Data Source tab.
Updated about 5 hours ago