Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
shankar_gomare
Explorer
In this blog post we will learn to build a highly scalable application using SAP HANA and Docker Swarm cluster. This is first post in this series and more to come.

What will be the end result of our project?

We will able to deploy and scale an application on Docker Swarm cluster, the overall solution architecture would look like below:


Image icons courtesy to draw.io, docker.com, nginx.com

What software components we need for this project?

  • SAP HANA Express

  • HANA Client libraries

  • Docker

  • Opencart

  • Nginx

  • a few tools


How about hardware?

  • Hosts 2 or more

  • RAM 16GB minimum for one host others 4GB+

  • CPU/Cores 4 or more cores per host

  • HDD/SDD > 500GB


You can follow this development in two different ways, keep reading in the blog or watch the below video.



Image icons courtesy to draw.io, docker.com, nginx.com

Since you have chosen to follow here let's get started, first we will clone my git repository which contains all the scripts required for our project.
#hanaexpress_install
git clone https://github.com/sgomare/hanaexpress_install.git

#change directory to hanaexpress_install
cd hanaexpress_install

$list content of the directory
ls

Output
dbHANA.php
deployHanaExpress.sh
docker-ce-install.sh
fix_hana_express_host.sh
hdsql_query.txt
index.json
links.txt
README.md
update_kernel_params.txt

 

I have compiled multiple installation steps into these scripts, however, the installation process might differ in the future, so I have included links.txt file with the original links for installations.

Now we have everything in place, let's install docker container environment by running docker install script.

Note: These scripts are applicable to debian based linux distros for other you need to adjust accordingly.
#run docker installation script
#user requires "SUDO" / "root" privilege for installation
./docker-ce-install.sh

The script will install docker and relevant application packages and at the end system will reboot.

Next, HANA Express installation, if you prefer to follow official documentation please visit hub.docker.com and search for HANA Express(Database Server), The original installation guide is in great details, my script is based on it. so, all credit goes to SAP!

We need to update kernel parameters for HANA Express in /etc/sysctl.conf file, copy content from update_kernel_params.txt except /etc/sysctl.conf line, save file and perform reboot or run the following command.
fs.file-max=20000000
fs.aio-max-nr=262144
vm.memory_failure_early_kill=1
vm.max_map_count=135217728
net.ipv4.ip_local_port_range=40000 60999

#update kernel paramters with following command or reboot
sudo sysctl -p

We need to perform one more activity before we deploy HANA Express container, i.e maintain master password in a file or web URL and pass that as an argument to docker container deploy script.

I tried to follow file approach but it did not work for me, I have included index.json file which contains master password, feel free to update it for your own password choice.

We will use this file through a web URL by running python webserver module. Open another session and change directory to hanaexpress_install and run following command to start webserver.
#run web server in current directory
python3 -m http.server

The container deploy file is using my host so open file and replace "http://hanadockers1.jamb.io" with http://<yourhostip>:8000/index.json.

That's it we are ready to deploy our HANA Express docker container, we will do that by running deploy script.
#deploy HXE container
./deployHanaExpress.sh

This script will launch docker container in detached mode, so we will not see installation log on console, we can follow container log by using following docker command.
#follow container log
docker logs hanaexpress --follow

You will see a last message in installation as "Setup Finished!", meaning our container is up and running HANA Express.

Now, we will install PHP and Apache by running the following command. (we will be using a widely popular open source shopping cart "Opencart")
#install PHP 7.3 and Apache 2 + odbc extension for PHP
sudo apt install php7.3 && sudo apt install php7.3-odbc

Next, we will clone opencart forked for HANA DB from my github repository.
#opencart for HDB
git clone https://github.com/sgomare/opencart.git

We need ODBC driver for HDB, which is available to download on SAP HANA Express page please refere HANA Express installation guide. The opencart expects ODBC drivers under "/var/www/html/hdbclient/libodbcHDB.so" so make sure to copy client library accordingly.

We should have working ODBC connection by now, you can verify that by running dbHANA.php.
#change to install directory
cd hanaexpress_install

#run test
php dbHANA.php

We need two more changes before we lunch opencart installation, we need to adjust apache root directory and directory permissions.
#update document root
nano /etc/apache2/sites-enabled/000-default.conf

#save file CTL+X, Y

#update directory permissions
cd /var/www/html/opencart/upload

#full read/write/execute
sudo chmod 777 -R *

That's it, we are ready to install Opencart, open your favorite browser and lunch opencart installation by calling URL.
http://<yourhostip>;

 

The opencart installation process will prompt for any missing PHP extensions or configurations. We also need to supply HDB credentials along with HDB port as show in below picture.


Once installation is complete we will see installation complete message as show below:


This concludes installation of docker container environment, deployment of HANA Express on Docker and Opencart installation on SAP HANA database.

Finally, we will have a functional opencart on HANA Express.


Image icons courtesy to opencart.com

This was first part of overall solution to deploy opencart on Docker Swarm cluster, if you enjoyed this article, please keep following my profile for new contents.

In next article, we will containerize our opencart for docker swarm deployment.

 

Part 2: https://blogs.sap.com/2021/01/21/deploy-sap-hana-based-applications-on-docker-swarm-cluster/
Labels in this area