Skip to content

Getting started Development

Patrykb0802 edited this page Jul 17, 2023 · 15 revisions

Links to intallation guide:

Archives (Date: 30.06.2023)

Table of Contents

Current technology stack table:

Technology Version Description
Java 11 Base programic language
Gradle 7.1 Tool for building the application
Tomcat 9.0.41 Servlet server for application
MySQL 5.7 Database server for data persistence
Node.js 14.20.1 JavaScript runtime for New UI
Git 2.17.1 Version control for source code

Tools Installation

Java

    The base project is written in Java. So to start development a new features to Scada-LTS you need to install Java Development Kit (JDK). You can do that easily by downloading the valid version from the jdk.java.net website. Then you only need to extract that file and set-up the PATH variable to /bin directory.

Windows

  • For windows download dedicated Windowsx64.zip version.
  • Extract that file in location where you want to keep your Java binaries
    (for example C:\services\java\jdk-11)
  • Set-up the PATH environment variable to bin directory of your installation location
    (for example C:\services\java\jdk-11\bin)
  • Verify that Java is installed correctly, open your terminal and type java -version

Linux

  • For Linux base systems download Linux_x64.tar.gz
  • Create a directory sudo mkdir /opt/java
  • Extract archive to that directory
    (for example: sudo tar -xzf openjdk-11*.tar.gz -C /opt/java/)
  • Set-up the PATH environment variable to bin directory of you installation location
    (for example nano ~/.bashrc and then add at the bottom of that file this lines and save it)

export JAVA_HOME=/opt/java/jdk-11
export PATH=$JAVA_HOME/bin:$PATH

  • Verify that Java is installed correctly, open your terminal and type java -version

Gradle

    Gradle is a general-purpose build tool that makes taht the build process is very simple. Installation of gradle is well described on their official web page. So follow the tutorial and then verify that gradle is installed:

gradle -v

Support Gradle v6.8.1-v7.1

Tomcat

    Tomcat is an servlet web-application server.

  • Download the Tomcat server from their official distribution page
    (If you want to download a specific version use that link to dist archive)

  • Extract that file to specific location

    • Windows: like in our example to C:\services\tomcat
    • Linux: in the same way as before but to /opt/tomcat
  • Set-up the new environment variable with name: CATALINA_HOME that is a reference to tomcat main directory.
    (That is required to perform Java build operation)

  • Import additional Tomcat server libraries:

    • Add that file to /usr/share/tomcat9/lib/ directory.
    • Add files from that directory to tomcat /usr/share/tomcat9/lib/ libs.
  • Setup the Database connection in $CATALINA_HOME\conf\context.xml file.
    Replace it with that configuration file

    From version 2.6.10 there's change in context.xml to work with Docker Compose, so after coping this file to Tomcat, change line: url="jdbc:mysql://database:3306/scadalts" to url="jdbc:mysql://localhost:3306/scadalts"

MySQL

    MySQL must be matching the provided version. If not there will be a problem with establishing the connection from the Scada-LTS application.

Windows

  • Use dedicated installer
  • Configure default password to "root" user: "root".
  • Create a new database with name: "scadalts".

Linux

There is a know bug that on Ubuntu 20.xx there is a problem with installing the MySQL server. It was solved by using the docker image with that server version.

  • Install mysql-server package
    sudo apt update
    sudo apt install mysql-server-5.7
    
  • Configure MySQL server with defaulr password to "root" user: "root".
    sudo mysql_secure_installation
    
  • Initialize MySQL data directory
    • Versions < 5.7.6 - mysql_install_db
    • Versions >= 5.7.6 - mysqld --initialize
  • Enable MySQL server
    sudo systemctl start mysql
    
  • Create a new database with name: "scadalts".

If there is a problem with MySQL server check the Internet for the solution. This installation process was based on the digitalOcean tutorial so check it for more details.

Node.js

  • Download the Long Term Support (LTS) version of Node.js from official site.
  • Extract that file to specific location
    • Windows: like in our example to C:\services\node
    • Linux: in the same way as before but to /opt/node
  • Add a new entry to PATH that is a reference to Node.js main directory.
    (/opt/node/node-v15/bin:$PATH)
  • Verify that Node.js is installed correctly, open your terminal and type node -v
  • Verify that Node Package Manager (npm) was installed with Node.js correctly.
    Open your terminal and type npm -v

Git

    Linux has installation of git by default. So you don't need to install it, but on Windows you need to download it from official site. The easiest way to install git is to use the installer.

Scada-LTS project initialization

Find a good place on your local drive where to store your Scada-LTS project. And in that place use Git Tool to download it from the GitHub repository.

git clone https://github.com/SCADA-LTS/Scada-LTS.git

Now you should be able to build and run the project using Gradle (support v6.8.1-v7.1). That command will build the Java application from source code and then will try to compile the Frontend apllication with installing all necessary dependencies. Then that two projects will be bundled together into the one Scada-LTS.war file that will be deployed to the Tomcat server.

gradle buildRunDebugDev

When it will be ready you should be able to access to the application at the following address: localhost:8080/ScadaBR.

Integrated Developmnet Environments (IDEs)

It's up to you to choose the IDE that you want to use. But we recommend to use the JetBrains IntelliJ for the base Java application and VisualStudio Code for the Frontend sub-project. But you can use any other IDE that you want.

Quick install - Linux Ubuntu 20.04+

1. Install mysql server/client commandline:

2. Install mysql client: (optional)

sudo dpkg -i dbeaver-ce_22.1.4_amd64.deb

3. Install JDK11:

sudo apt update
sudo apt install openjdk-11-jdk

4. Install Apache Tomcat 9:

tar -x -f apache-tomcat-9.0.53.tar.gz
  • Set CATALINA_HOME in ~/.bashrc :
vim ~/.bashrc
source ~/.bashrc
  • Copy jar lib to CATALINA_HOME/lib from:
https://github.com/SCADA-LTS/Scada-LTS/tree/develop/tomcat/lib
https://github.com/SCADA-LTS/Scada-LTS/raw/develop/WebContent/WEB-INF/lib/mysql-connector-java-5.1.49.jar
  • Copy context.xml file to CATALINA_HOME/conf:
https://github.com/SCADA-LTS/Scada-LTS/blob/develop/docker/config/context.xml

5. Install Git:

sudo apt update
sudo apt install git

6. Install npm:

sudo apt update
sudo apt install npm

7. Install and configure Intellij:

tar -x -f ideaIC-2022.2.tar.gz
  • run:
./ideaIC-2022.2/bin/idea.sh
  • Clone Scada-LTS project;
  • Create remote JVM port 8000, module Scada-LTS as remote-debug;
  • Build, deploy, and run application (mysql server is running, support Gradle v6.8.1-v7.1):
gradle buildRunDebugDev

8. Open application: Open in browser:

http://localhost:8080/ScadaBR
Clone this wiki locally