Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running on Gentoo rv64 #3073

Open
moroznah opened this issue Jan 9, 2025 · 3 comments
Open

Running on Gentoo rv64 #3073

moroznah opened this issue Jan 9, 2025 · 3 comments
Labels
community Community Reported Issues

Comments

@moroznah
Copy link

moroznah commented Jan 9, 2025

Describe the bug
Trying to run Scada-LTS natively on Gentoo in a not very ugly way.
End goal is to run on rv64 arch, but i'm unable to launch it even on amd64.
Crashes with: java.lang.NullPointerException: null
Please help

To Reproduce
Easy to reproduce, on a Gentoo system run:

source /etc/profile
emerge dev-java/openjdk:11 tomcat:9
useradd -m -G users,wheel,realtime -s /bin/bash scadalts
/usr/share/tomcat-9/gentoo/tomcat-instance-manager.bash --create --suffix scadalts --user scadalts --group scadalts
cd /var/lib/tomcat-9-scadalts/webapps
wget https://github.com/SCADA-LTS/Scada-LTS/releases/download/v2.7.8/Scada-LTS.war
mkdir /var/lib/tomcat-9-scadalts/lib
cd /var/lib/tomcat-9-scadalts/lib
wget https://github.com/SCADA-LTS/Scada-LTS/raw/refs/heads/develop/tomcat/lib/activation.jar
wget https://github.com/SCADA-LTS/Scada-LTS/raw/refs/heads/develop/tomcat/lib/jaxb-api-2.4.0-b180830.0359.jar
wget https://github.com/SCADA-LTS/Scada-LTS/raw/refs/heads/develop/tomcat/lib/jaxb-core-3.0.2.jar
wget https://github.com/SCADA-LTS/Scada-LTS/raw/refs/heads/develop/tomcat/lib/jaxb-runtime-2.4.0-b180830.0438.jar
wget https://github.com/SCADA-LTS/Scada-LTS/raw/refs/heads/develop/tomcat/lib/mysql-connector-java-5.1.49.jar
ln -s /var/log/tomcat-9-scadalts /var/lib/tomcat-9-scadalts/logs
echo 'TOMCAT_JVM="openjdk-bin-11"' >> /etc/conf.d/tomcat-9-scadalts
echo 'CATALINA_OPTS="-Xmx2G -Xms2G"'  >> /etc/conf.d/tomcat-9-scadalts

#edit for db credentials /var/lib/tomcat-9-scadalts/conf/context.xml
rc-service tomcat-9-scadalts start

Prior to running natively, this db was tested successfully with Scada-LTS amd64 docker image and worked fine.
docker run --name scadalts -v /etc/scadalts/context.xml:/usr/local/tomcat/conf/context.xml scadalts/scadalts

Additional context
Attached non-empty log files:
catalina.2025-01-09.log
flyway.log
localhost.2025-01-09.log
mango.log

@Limraj
Copy link
Collaborator

Limraj commented Jan 9, 2025

Hi @moroznah,

  1. Here is the installer for Linux:
    https://github.com/SCADA-LTS/linux-installer
    However, you may have problems working on this system, we support family systems based on Ubuntu, with basic programs and system tools installed.

  2. In the case of docker, we recommend using docker-compose with the configuration available in the sources:
    https://github.com/SCADA-LTS/Scada-LTS/blob/v2.7.7.3/docker-compose.yml
    This method seems to be the best solution in your case. However, if you want to use our application in production in this way, Docker knowledge is required, including the importance of learning about Volumes, which enable the persistence of container state.
    All images available, we recommend using tag v2.7.7.3 or v2.7.8:
    https://hub.docker.com/r/scadalts/scadalts/tags
    We have prepared docker images for the arm64 architecture, but we do not guarantee that every protocol will work.

  3. We support origin MySQL server, not MariaDB. There are differences between these versions of MySQL server and we cannot guarantee that everything will work on the MariaDB server.

  4. Your problem may be related to the fact that you do not have the CATALINA_HOME system variable set for the Linux user. Even if you run tomcat in the console with the CATALINA_HOME parameter, the application may not work without set CATALINA_HOME for linux user (in .bash_profile or .bashrc in home dir for user), from version 2.8.0 this problem should no longer occur.

  5. We do not recommend using "tomcat installers" because there is no single installation standard and this often causes garbage in the system. We recommend downloading the tomcat zip and manually configuring it (set CATALINA_HOME, create systemd service), or using our linux-installer, or use docker-compose.

Regards,
Kamil Jarmusik

@Limraj Limraj added the community Community Reported Issues label Jan 9, 2025
@moroznah
Copy link
Author

@Limraj
Thanks for answering!

  1. Yes i've seen and tested these scripts on amd64. Dissecting them helped a lot to understand how to run Scada-LTS on non-Debianish distros.

  2. I agree that this is probably best approach, however there is no riscv64 image for docker. Also i doubt it that you are willing to support a riscv64 image now since this arch is not mainstream yet.

  3. To tell you the truth i haven't even tested MySQL. Everything seems to be working fine on MariaDB.

  4. CATALINA_HOME was the problem. I've switched to 2.8.0 and it's running on riscv64! Previously posted Gentoo script does the job. I don't use many connectors, mostly Modbus TCP and HTTP retrievers, these work fine. Will test more soon, mostly energy sector related, such as IEC101.

  5. I agree with you, this is so true for many distros.

If you don't mind, i will post here if will encounter any specific riscv64 issues. At some point this arch is going to be mainstream and many ppl will start swapping arm64 SBCs. Perhaps this will help to do necessary tweaks for a future docker image.
I'm also doing extensive performance testing to get a good comparison of performance on various arches, compile flags and OpenJDK versions (for ex. Eclipse vs natively compiled).

Regards,
Igor

@Limraj
Copy link
Collaborator

Limraj commented Jan 15, 2025

Hi @moroznah,
We are curious about your results and observations with MariaDB and riscv64.

Generally, we are considering switching to the MariaDB server. Because MariaDB and the MySQL server have the same core, most of the syntax issues (even though it is SQL, different server implementations may also have syntactical differences) and implemented mechanisms are common, but there are some differences, e.g. in data types.

Theoretically, our application will work on any architecture for which the JVM has been implemented. However, there may be some issues related to the native code that is used in some libraries. (For example, to support the serial port)

However, remember that version 2.8.0 is not ready for production yet, we rather recommend using this docker and version v2.7.8 or v2.7.7.3 (instead of using the MySQL server image, you can configure the MariaDB server image similarly), or another recommended installation method that I mentioned. While the problem with CATALINA_HOME is simply we set this variable for the user and it should help, except that we do not use the tomcat installer, which probably creates a system user that does not have its own home directory, which may make this configuration difficult.

Regards,
Kamil Jarmusik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community Reported Issues
Projects
None yet
Development

No branches or pull requests

2 participants