-
Notifications
You must be signed in to change notification settings - Fork 296
Getting started Development ‐ Windows
Technology | Version | Description |
---|---|---|
Java | 11 | Base programic language |
Gradle | 7.6.3 | Tool for building the application |
Tomcat | 9.0.75 | Servlet server for application |
MySQL Server | 8.0.33 | Database server for data persistence |
MySQL Client | DBeaver 23.1.2 or newer |
Database client |
Node.js | 22.9.0 | JavaScript runtime for New UI |
Git | 2.17.1 | Version control for source code |
Windows | 10/11 | Operating system (Must be updated to latest version ) |
1. Scada-LTS ↑↑↑
1.1 Installation ↑↑↑
To install Scada-LTS go to the windows-installer website and follow the instructions in the README.
1.2 Configuration ↑↑↑
Tomcat - Configuration ↑↑↑
To add enviroment variables in Windows operating system:
-
(WIN 11) Type in bottom search bar "Edit the system enviroment variables", press Enter and window should pop up.
(WIN 10) On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. -
Select Enviroment Variables... from the bottom of the window.
NOTE: Do steps below only if you don't see CATALINA_HOME variable in the bottom list.
-
Press New... at the bottom of the window.
For CATALINA_HOME it should look like this:
NOTE: Remember to use your own paths, for Catalina it's path to tomcat folder inside Scada-LTS installation location.
-
Locate context.xml file. Default path is: C:\Program Files\Scada-LTS\tomcat\conf.
-
Open it with any available text editor.
-
Delete whole
<Resource>
block. File should look similar to image below:
- Save file and you are done. This should help with database information mismatch.
After installing Scada on Windows you should have 4 icons on desktop. One of the is service manager. To turn on manual start up:
-
Launch Scada-LTS service manager
-
Go to general tab and select manual from Startup type: droplist.
- Now you shouldn't have problem with launching and controlling Tomcat from IntelliJ level.
jSerialComm - Configuration ↑↑↑
Scada-LTS installer automatically installs jSerialComm.jar to your project. This .jar file will automatically select and load the correct native jSerialComm library for your platform and architecture.
In case of any problems with this library we refer to official sources and their Troubleshoot section.
2. Database ↑↑↑
2.1 MySQL Client ↑↑↑
Installation ↑↑↑
Download Windows DBeaver Installer, run it and wait for it to finish. To launch it use desktop icon.
Configuration ↑↑↑
NOTE: Before configurating DBeaver make sure that your MySQL Server is turned on.
- In top left corner of DBeaver window click on icon to add "New database connection".
- Select MySQL and press 'Next' button.
- Set port 3308 and click on 'Finish'. If the drivers have not been installed before, the program will suggest downloading and installing, click ok:
- If you have set password for root, you have to enable allowPublicKeyRetrieval in Connection Settings window in Driver properties tab.
- Press Test connection button on the bottom left corner of the window. If everything is set up correctly the following window should pop up.
2.2 MySQL Server - Configuration ↑↑↑
- In DBeaver at left side in Database Navigator tab right-click on scadalts and select Set as default.
- In tool bar located on top press dropdown arrow next to SQL and select New SQL script, script window should appear on the right.
-
Copy two lines from below to script execution window and press Execute SQL script icon ()
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; FLUSH PRIVILEGES;
- After these steps password for root should be set.
-
Navigate to your Scada-LTS installation location, head to mysql folder (Default path:
C:\Program Files\Scada-LTS\mysql
) and edit my.ini file with any text editor. -
Change
port=XXXX
toport=3306
-
This will help with running application correctly in IntelliJ software.
Scada installer should have created two icons on your desktop called Start/Stop MySQL Community Server 8.0. In order to restart your MySQL server:
-
Run Stop MySQL Community Server 8.0 as administrator.
-
And than run Start MySQL Community Server 8.0 as administrator.
This should apply all changes you have made to MySQL server.
3. IntelliJ ↑↑↑
-
Download desired version of IntelliJ here, run it and wait for installation to finish.
-
After installation is completed, on welcome screen select "Create New Project" and select "Get from VCS".
-
Choose repository URL and use Git Version Control. Paste the URL of the Scada-LTS project from below and click "Clone" button.
https://github.com/SCADA-LTS/Scada-LTS.git
If there is a privilege dialog, click "Trust this project" button to load the gradle configuration.
Gradle will load the dependencies and prepare project for development. (It may take a while)
-
After everything loads, in Project tab, go to gradle > wrapper > gradle-wrapper.properties and change version of your gradle to 7.1.
-
Make sure to change your indent settings to be same as on Github repository, so code will be clean and easy to read. First, locate a indent configuration button in bottom right corner of your IDE.
Tabs and Indents window should pop up, make sure to uncheck "Use tab character", your configuration should look like this:
3.1 Node.js ↑↑↑
To install Node.js on Windows:
-
Download Node.js v14.20.1 intaller from this website: https://nodejs.org/dist/v14.20.1/node-v14.20.1-x64.msi
-
Launch installer, choose install location.
-
When this window appears remember to choose "Will be installed on local hard drive" on Add to PATH.
- Proceed until installation is finished.
3.2 Troubleshoot ↑↑↑
-
In IntelliJ project in top left corner, go to File > Settings.
-
Type Gradle in search bar.
- In the Gradle JVM dropdown list select correct version of JDK and press OK.
e.g.:
-
In IntelliJ, in Project bar right-click on Scada-LTS and select Open Module Settings.
-
In Project Structure window on left side select Project.
- Select correct version of SDK from dropdown list marked on image above and press OK.
-
Go to Scada-LTS folder location. (Default path: C:\Program Files)
-
Right click on Scada-LTS folder and select Properties.
-
Go to Security tab and press Edit....
If you don't see the user you want to grant access to on the list Group or user names:, you can add it by following instructons below:
-
In the Edt... menu press Add...
-
In the Enter the object names to select area type your user's name and press Check Names and press Ok.
-
-
Select from the Group or user names: list, the user to whom you want to grant access.
-
In Permissions for username tab mark Modify, Read & Execute, List Folder Contents, Read, Write in Allow column, than press Apply and OK.
- Wait for the window, that is executing granting access to disapear and you are done.
If you are getting some file encoding errors e.g.: unmappable character (0x98) for encoding windows-1250
here is quick solution:
- In IntelliJ, go to Help > Edit Custom VM Options...
- Add following line to file that just showed up:
-Dfile.encoding=UTF-8
After editing your .vmoptions file, it should look like this:
- Restart your IntelliJ to apply the changes
4. Docker Compose [↑↑↑]↑↑↑
4.1 Installation ↑↑↑
-
Go to https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe and download Docker Desktop Installer
-
Launch installer.
-
Mark "Use WSL 2 instead of Hyper-V (recommended)" checkbox, otherwise you might have problems with virtualization.
NOTE: If you don't see the checkbox and you are having trouble launching Docker, go to Troubleshoot section below.
-
Wait until insallation is finished and restart your PC.
4.2 Launching ↑↑↑
-
Download docker-compose.yml file to desired folder.
-
Right click on the folder where your docker-compose.yml file is and press Open in Windows Terminal and run:
docker-compose up database
- In second terminal and same location:
docker-compose up scadalts
NOTE: You have to wait for
docker-compose up database
to finish, otherwise errors may appear.
After setup is finished you should be able to access Scada-LTS via web browser by typing localhost:8080/Scada-LTS
URL in search bar.
4.3 Troubleshoot ↑↑↑
Most common problem with Docker is disabled Virtualization, to turn it on you have to make sure that your processor supports virtualization and turn it on in BIOS settings.
For Intel Processors virtualization technology in BIOS should be called:
- Virtualization Technology (VT-x)
or - Intel Virtualization Technology (Intel VT)
For AMD Processors virtualization technology in BIOS should be called:
- AMD Virtualization (AMD-V)
or - AMD SVM (Secure Virtual Machine)
To check where exactly to look for such setting in BIOS check check documentation of your motherboard/laptop manufacturer.
NOTE: For basic intructions how to enable virtualization you can try visiting this website and follow the instructions.
If your docker doesn't work after first executing its instructions, you can try enabling and disabling certain Windows features.
- Windows 10 - Enabling features from image below might help with virtualization errors.
If there is "Hyper-V" feature on your list, disable it.
To enter Windows features window type in bottom search bar "Turn Windows features on or off" and press enter.
5. Tips for developers ↑↑↑
Building the application ↑↑↑
To build the application on your own environment you can use Gradle.We provide example scripts that can be used inside Scada-LTS project to perform specific operations. Commands with their explanations are listed below.
5.1 Gradle Tasks ↑↑↑
To run Gradle Task you have to use gradle version 7 or similar with Java version 11. It should also work on other versions but you have to change the targetVersion in build.gradle file.
Command | Explanation |
---|---|
gradle war |
Build Scada-LTS war file |
gradle run |
Launch Tomcat instance |
gradle runDebug |
Launch Tomcat instance in debug mode, ability to plug debugger into the Tomcat port and use it |
gradle buildRunDebug |
Build and start production version of Scada-LTS application min tasks (recommended) |
gradle buildRunDebugProd |
Build and start production version of Scada-LTS application |
gradle buildRunDebugDev |
Build and start developer version of Scada-LTS application |
gradle buildRunDebugProdTestUi |
Build and start production version of Scada-LTS application with Test UI |
gradle buildRunDebugDevTestUi |
Build and start developer version of Scada-LTS application with Test UI |
gradle test |
Launch Backend Unit Tests |
gradle scadalts-ui::testUi |
Launch Frontend Unit Tests |
Logging JVM parameters ↑↑↑
If you want to see what parameters is your JVM using you can add these three lines of code to build.gradle file:
Process ipProcess = new Runtime().exec("jps -lvm");
int exitValue = ipProcess.waitFor();
println "JAVA__:" + ipProcess.getText()
5.2 Error: Address already in use - terminating OpenJDK processes ↑↑↑
This error occurs when you try to start new instance of Scada-LTS while other Java virtual machine is still working. This error occurs only in Widnows and there is easy fix for it:
-
Open task manager (You can use this key combination: Ctrl+shift+esc)
-
Look for OpenJDK processes and terminate them. Example:
- After that, you should be able to launch Scada-LTS with no error.
5.3 IntelliJ plugins ↑↑↑
-
In any IntelliJ project go to: File > Settings > Plugins and select Marketplace.
-
In search bar type Sonarlint an press Install next to it.
-
IntelliJ will ask you to restart it.
-
After restart your plugin is set and ready to go.
6. SeroUtils library license ↑↑↑
Matthew Lohbihler [email protected] has granted us permission to use the SeroUtils.jar library for ScadaLTS team. ScadaLTS team can use the code seroUtils without limitation.
Fragement with the correspondence of Grzegorz Bylica and Matthew Lohbihler:
"(...) The good news is that you may hereby and without limitation use the seroUtils code as you like. (...)"