As a software engineer specializing in Java development, particularly in SAP Hybris commerce, I am also learning IoT development as a hobby.
Recently, I migrated Home Assistant to new 4GB RAM-equipped TV box. This upgrade has significantly improved the friendliness of Java development due to the ARM architecture of the CPU (where JVM can run on) and importantly it is running on Linux Debian!!!
So I decided to reload Debian without installing Home Assistant and tried to install Hybris. Technically, I managed to run a SAP commerce product (a fancy platform) on the cheap entertainment system(US$25) - it is kind of you are owning a Rolls Royce but park it in a motel garage. That means this experiment should be considered as a hobby, to see how much my work can survive in different habitats. We have seen that all enterprise server-side software is hosted on x86(32 and 64) CPU architecture. On the other hand, coding on ARM computers (such as Apple Silicon, Microsoft SQx...) has been progressing relatively slowly.
To start Hybris on this tv box, application server would take 30 mins to be up from minimal extensions setup. Of course we cannot expect it to run as fast as a real computer because it is originally designed to run Android TV system, surviving from 5V power without any heat fan. But please SAP, it would be great if you can collborate with an ARM chip manufacturer to make your own SOC design. I can imagine that one day a ray of 10 tv boxes sitting on the desk can be run as well as SAP commerce cloud CCV2 development enviroments. They would not be as expensive as Azure cloud, wouldn't occupy much space, would work silently, and could be easily scaled up by adding real and cheap devices.
If you are owning a Tanix W2 (or any X905W2) with 4GB of RAM you are having same hardware specs I have done setting up. In this experiment I use this Amlogic SOC chip + Debian distribution from devmfc https://github.com/devmfc/debian-on-amlogic - please visit their git repo to check out yourself if more details needed.
For your convenience, I'll recap essential information:
System needs to have:
- RAM is at least 4GB: Hybris itself needs at least 2GB to run. Linux requires 1GB to maintain its processes. Moreover, GPU would take few hundred MB even though headless mode is being used.
- Has ethernet port: Most of tv boxes are not running with wifi on Linux because of driver compatibility. From above conditions we can choose the below SOCs:
High-end | Medium | Cheap | |
---|---|---|---|
Gen 2 | S922X | X905X2 | X905W2 |
Gen 3 | X905X3 | ||
Gen 4 | X905X4 |
Afaik, if your tv box is one of the brands below, you probably can go ahead:
- H96
- X96
- Tanix
- Beelink
- X88
- T96
- Magicsee
- A95X
If your tvbox hardware does not meet hardware specs from devfmc to install Debian you can search on Armbian (ARM with deBIAN) forum, they have plenty of posts sharing about Amlogic + Rockchip + Allwinner installed Debian and other Linux distribution. As long as you can install Linux, have 2GB RAM spare you can install SAP Hybris on the device.
- Rockchip https://www.armbian.com/soc/rockchip/
- Allwinnner https://www.armbian.com/soc/allwinner/
- Amlogic https://www.armbian.com/soc/amlogic/
You might wonder why Armbian has such a huge community, but I chose the devmfc git repo for installation. Actually all repos are good but devfmc is offering lightweight package which is more than enough for my setup.
Get your installation ready from devfmc or Armbian. From my experience, I would like to bring up some important points:
- Installing on SDcard or USB drive should be better than internal storage (eMMC) because you do not need to erase Android on the tvbox - your setup can be plug and play whenever you want. However, running on external storages means sacrificing the performance.
- Choosing right external storage is also very important because SoC have some kernel limitations. I also shared 1 topic to help others choose right accessories devmfc/debian-on-amlogic#48
- To boot externally, you have to enter recovery mode. Some devices hide the reset button in the output jack. My Tanix W2 has that button inside the 3.5 video/audio plug.
WinSCP or any SFTP software if you are using Windows. MacOS or Linux we can use scp command to transfer the file.
I used CXCOMCL221100U_19-70007431.zip which is release 2211 patch 19. However if you have any 2105 or above it should be fine because we are going to install JDK 17. Due to licensing policy I can not share with you the zip file.
It is not neccessarily to get my files. You could have your own definitions.
- https://github.com/ductm208/hybris-on-tvbox/blob/main/localextensions.xml
- https://github.com/ductm208/hybris-on-tvbox/blob/main/local.properties
- Install Putty if you are on Windows.
You have to know the ip to access SSH tunnel, there are few ways to achieve that:
- In some devices, they will show the ip-temperature-time intervally. Since my client is 192.168.1.21 I know 220 abbreviates for tv box 192.168.1.220
- Or you can plug HDMI to any screen to get the ip - make sure this port plugged before tv box is powered.
- Or epon router admin page to check allocated ips. Some router is showing as tvbox in hostname. (Image below from Google)
Access using root, terminal will show you SSH password prompt screen.
Default password is tvbox, terminal will bring you to root access as below.
Right up the dashboard we can see that 3GB could be used to manage our application.
Before install any software you have to update + upgrade repo (5mins eta):
# apt-get update
# apt-get upgrade
If you are the *nix family users (Unix, Linux, MacOS) you might not require to follow exactly my instructions below. However there is a wrapper issue would be occured when you try to start hybris server. If this happens, please search for the wrapper hacks section.
At SSH using root account, enter:
# apt install openjdk-17-jdk
If thing goes well
# java -version
You can use root to bypass creating hybris user. I just want to share the best practice of not to use root account to run application to avoid security vulnebilities
Run command as root to create hybris user
# useradd -m hybris
Run set password
# passwd hybris
Let assume that password is Hybris123
If you run command below you will see /home/hybris created
Open another terminal from client, try to access with hybris/Hybris123 to make sure you can access SSH:
$ ssh [email protected]
If you can use scp command from your client, I placed Hybris package zip in Downloads
ductran@DucTran:~$ scp ~/Downloads/CXCOMCL221100U_19-70007431.ZIP [email protected]:/home/hybris
scp will ask password and then copy the file from your client and place into tv box as in /home/hybris/
You can use any FTP file uploader, url would be sftp:https://[email protected]
Switch back to terminal window accessed with hybris account and type:
hybris@tvbox:~$ ls /home/hybris
Ideally file should be up here
Now we need to create /home/hybris/hybrisapp folder
hybris@tvbox:~$ mkdir /home/hybris/hybrisapp
Unzip the file by command (2 mins eta):
hybris@tvbox:~$ unzip CXCOMCL221100U_19-70007431.ZIP -d hybrisapp
Run this command, "README, SIGNATURE.SMF..." should be located in hybris app
hybris@tvbox:~$ ls /home/hybris/hybrisapp
Now we can do all stuffs as normal SAP Hybris commerce consultants do except small hack from wrapper. HYBRIS_HOME is /home/hybris/hybrisapp/hybris
Set ant environment values
hybris@tvbox:~/hybrisapp/hybris/bin/platform$ . ./setantenv.sh
Run ant clean all as usual
hybris@tvbox:~/hybrisapp/hybris/bin/platform$ ant clean all
It will ask to create config folder, just enter to create develop profile
It would take few minutes to create all stuffs but we need only config folder, ant build would be performed again later. As soon as config folder created you can terminate the command by Ctrl + C.
Now you need to replace newly created local.properties and localextensions.xml. Those files are nothing special, they contains minimal setup.
On *nix you just run from client
ductran@DucTran:~$ scp ~/Downloads/local.properties [email protected]:/home/hybris/hybrisapp/hybris/config
ductran@DucTran:~$ scp ~/Downloads/localextensions.xml [email protected]:/home/hybris/hybrisapp/hybris/config
On Windows, just drop 2 files to /home/hybris/hybrisapp/hybris/config
Run ant clean all again, my tv box took 24 minutes to finish building
hybris@tvbox:~/hybrisapp/hybris/bin/platform$ ant clean all
Now you can run ant initialize and make some โ ๐, it would take 1-2hrs to complete - actually not bad because my Thinkpad P1 which installed Ubuntu takes 10 minutes for the same task
hybris@tvbox:~/hybrisapp/hybris/bin/platform$ ant initialize
Now this is time to bring the wrapper hack, if you try to run
hybris@tvbox:~/hybrisapp/hybris/bin/platform$ ./hybrisserver.sh debug
you would get something like this
It seems hybrisserver.sh is trying to find the wrapper for aarch64 but this architecture profile is not there.
Type the command below we will see: The wrappers for Linux are around for different CPU architectures but none of them is aarch64
hybris@tvbox:~/hybrisapp/hybris/bin/platform$ ls /home/hybris/hybrisapp/hybris/bin/platform/tomcat/bin | grep wrapper
In fact, aarch64 is arm-64. We need to help the script route to arm-64 by making the symbolic link. At /home/hybris/hybrisapp/hybris/bin/platform/tomcat/bin type:
hybris@tvbox:~/hybrisapp/hybris/bin/platform/tomcat/bin$ ln -s wrapper-linux-arm-64 wrapper-linux-aarch64-
Be careful, wrapper-linux-aarch64- is ending with hyphen (-).. Check again with different command.
hybris@tvbox:~/hybrisapp/hybris/bin/platform/tomcat/bin$ ls -l | grep wrapper
You will see the symbolic link created and it is actually wrapper-linux-arm-64
Now you definitely can run hybris server normally.
It will show aarch64 is taken, and takes around 30 minutes to start.
You can check the storefront from the url: https://192.168.1.220:9002/yacceleratorstorefront/?site=electronics
And backoffice too: https://192.168.1.220:9002/backoffice
Surprisingly, once server is ready the platform will run well, not slow as I thought.