Wednesday, 8 August 2018

Installing SAP NW ABAP into Docker

In the last part of the blog series you learned how to install the SAP Cloud Connector (SAPCC) into Docker running on your own machine. The corresponding YouTube video showed you how easy it is to connect your SAPCC to an SAP Cloud Platform (SAPCP) account. Furthermore, you learned some basics of Docker; not everything, but hopefully enough to serve as a good motivation to dive deeper into containers and Docker. Now we want to continue installing NW ABAP into Docker. The beginning of this blog is a little “chatty”, feel free to scroll down to the technical sections or jump directly to the YouTube video linked below which contains all the details.

Important Hint: Unfortunately, I messed up the YouTube video a little. I seems I accidentally removed the section in the video that should show you how to create the Docker container + call the installation script inside the running Docker container (should actually be right before 5:50 – 6:05). Please refer to the GitHub repo for the documentation or scroll down to the section Create/Start a container with one of the following commands in this blog; following the steps described there! Sorry for the inconvenience, I’ll create a new video whenever NW ABAP 7.52 Trial comes out.

Resources


YouTube: https://www.youtube.com/watch?v=H0GEg8r7P48


What will you have at the end of this blog?

SAP NW ABAP, SAP ABAP Certification, SAP HANA Tutorial and Materials, SAP ABAP Development

We’ve installed the SAP Cloud Connector (SAPCC) into Docker; we created a Docker container called sapcc. In this part of the blog series we want to install the SAP Netweaver ABAP 7.51 SP02 Trial Edition (aka Developer Edition) into Docker; we’ll create a container called nwabap751. So if you’ve followed Part 2 you will have two Docker containers at the end of this blog. However, they won’t know anything about each other, and we’ll fix this in Part 3.

I’ve already mentioned my hardware configuration in the last blog: 2017 MacBook Pro with macOS 10.13.4 (High Sierra), 2 TB SSD, 16 GB RAM, Intel i7 (Kaby Lake 2.9 GHz) – and that works just fine! It works on Win 10 or on some Linux as well. However, I suggest at least 16 GB RAM (I didn’t try with less than 16 GB). 

The setup you see here is useful for having an own local ABAP server that you can use for your own education. However, it’s is not intended for production use. The YouTube video above illustrates the whole process of installing NW ABAP into docker and adds some details and hints (i.e. connecting ABAP in Eclipse) – all in less than 20 minutes. In fact, the installation process itself took only about 10-12 minutes on my machine, believe it or not!

Following this blog will allow you to practice cool ABAP features on your very own NW ABAP, and you have basically full authorization (SAP_ALL); no more struggling because of missing authorizations in case you want to try out some SAP GW features, CDS/BOPF, or maybe you want to try ABAP in Eclipse (AiE) but you still need to activate the adt node in SICF. You can do it all on your own NW ABAP running on your laptop while you’re on a train without any network connection. And the best thing: in the next part of the blog series you’ll see how to connect that very same NW ABAP to the SAPCP to start cloud development – as an ABAP developer!

Why Installing SAP NW ABAP into Docker?


Do you remember the very first time you installed an ABAP system for your own educational purpose? Did you install it on a laptop? Remember Web AS 6.x? What about miniSAP? What OS did you choose? Maybe SUSE Linux, or Win XP, or Win 2000? Where there any different configuration steps depending on the OS you chose? How long did the installation process take? By the way, where did you get the installation files from? And what happened in case you did something wrong and the installation aborted after an hour or later? Did you change the system date to something like 10 years in the future before you started the installation?

I installed my first ABAP system back in 2002 and I got the so called miniSAP (basically a Web AS 6.10 or Web AS 6.20) from CDs attached to Horst Keller’s green ABAP Objects book. In fact, if I’m not mistaken I had to fill out the attached postcard shipped with the book and send it back to SAP in order to receive the CDs. The operating system I used was Win 2000, then Win XP (I think both on Workstations). All I wanted to do was starting with ABAP because someone close to me told me “you can’t do anything wrong learning ABAP”. Later I installed everything on SUSE, Solaris,… Of course, depending on the OS there where different configuration steps I had to take before I could start the installations process. I believe the installation took about 1.5-2.5 hours on the hardware I had at that time. Sometimes the installation failed after let’s say an hour, and I had no clue what exactly was changed on my OS (i.e. registry keys,…). It’s been quite hard to clean up the system after such a mess, and I believe I never made it 100 percent. After the installation went through successfully I started with ABAP using Horst Keller’s book. Ok, I confess at the beginning I spent only 1 day a week, which means after about 12 days of lazily studying ABAP my miniSAP denied working because of it’s 90 days license. After having spent hours and hours finding out a smart hack I gave up, and I simply re-installed my Win 2000 OS from scratch before re-installing minSAP. However, this time I found out a little tweak to avoid the 90 days limit. Things became way easier when I received a license of VMWare Workstation around 2003/2004 allowing me to install a guest OS into a Virtual Machine and then installing miniSAP into my guest OS running on VMWare. Taking the right snapshots at the right time saved me a lot of time! And thanks to the VM, I never had the issue to pollute my own (host) OS. That was brilliant!

Many of the challenges mentioned in my memories above are somewhat solved today, and Docker can help as well. Hardware seems not to be a big issue these days; a laptop with 32 GB RAM, 512+ GB SSD, and with strong processors can be found for less than 1000 € (Germany). You can choose which OS you want out of the box, and that includes Linux as well. All that makes it possible to install the SAP NW ABAP 7.51 SPO2 Trial in less than 15 minutes. It’s not even a problem to install it into a VM running on your laptop – works just fine as well! And where do you get the installation files from? Correct – you simply download the approximately 15 GB (split into about 10 rar files). This one-time download took about 3 hours for me (not so “high speed” internet is very common in Germany).

Using Docker allows you to keep your host system clean of all the mess any installation can cause. After all, installing NW ABAP into Docker means we’re installing a fat monolith into Docker (65 GB after installation incl. OS etc). Although Docker is actually heavily used for MicroServices, installing such a monolith works as well. Compared to a VM, Docker is much more lightweight. Furthermore, it’s free and OpenSource. And don’t forget that Docker is used heavily for DevOps, cloud infrastructures, cloud development, MicroServices, and more… So it could make sense gaining some hands-on experience with Docker, and that’s another reason for using Docker in my blog series. For me as a blogger it has the advantage of using Docker as THE common denominator that works for basically all readers instead of having to describe the process for different VMs. In the end, using a full sized VM is not needed (for this blog). Furthermore, I find it much more comfortable working with Docker and my terminal, and the basics are not so hard. Anyone can do it!

Installing SAP NW ABAP into Docker


I’ve added all the steps to the GitHub repo (and there I’ll keep it all updated). Before you continue make sure you have installed both Docker and git on your machine (already needed in Part 2). Once Docker is installed, start Docker and increase the Disc Image Size in your Docker preferences; this is needed because NW ABAP is huge. Just add about 100 GB to the existing value (that worked for me). You may want to increase the Memory in Docker’s advanced settings as well; I chose 6 GB.

Clone git repo + place the extracted NW ABAP download into sapdownloads

Now open your terminal (maybe GitBash on Win10) and execute:

# clone git repo
git clone https://github.com/nzamani/sap-nw-abap-trial-docker.git

# change into the created folder
cd sap-nw-abap-trial-docker

# create a folder "sapdownloads" (will contain the extracted NW ABAP)
mkdir sapdownloads

Next, download SAP NW ABAP 7.51 Trial from SAP from SAP Store and extract the contents to the folder sapdownloads which we just created.

Build the Docker image

Execute one of the following commands:

# without proxy
docker build -t nwabap:7.51 .

# behind a proxy
docker build --build-arg http_proxy=http://proxy.mycompany.corp:1234 --build-arg https_proxy=http://proxy.mycompany.corp:1234 -t nwabap:7.51 .

In case you are behind a proxy make sure to replace the proxy url before executing the second command from above.

With docker build you’re creating a Docker image derived from my Dockerfile on GitHub. A Docker image serves as some kind of a template from which we can create Docker containers (next step). Our Dockerfile uses OpenSuse as the base image, but I tried with CentOS and Ubuntu as well.

Update: There are a few things you can much better than I did in the Dockerfile. I tried to keep things simple and easy to follow even for Docker beginners, and without any hacks. I received a link via GitHub Issue to the following GitHub repo which uses a really cool Dockerfile: https://github.com/filak-sap/sap-nw-abap-docker. Using that approach allows to have an unattanded docker build together with some other benefits, i.e. using Docker volumes instead of putting the huge NW ABAP files into the Docker image etc. In fact, I’m not even deleting the files after the installation when not needed anymore (poor me). Even starting NW ABAP works the standard docker way with docker start nwabap751.

Create/Start a container with one of the following commands

# map the default SAP ports as they come on localhost (preferred)
docker run -p 8000:8000 -p 44300:44300 -p 3300:3300 -p 3200:3200 -h vhcalnplci --name nwabap751 -it nwabap:7.51 /bin/bash

# "random" ports on localhost are fine for you
docker run -P -h vhcalnplci --name nwabap751 -it nwabap:7.51 /bin/bash
The command above create a Docker container called nwabap751 and set the hostname to vhcalnplc. The option -p and -P tell Docker how exactly to handle the ports. After the commands are executed you will have a created and running container, and you are inside the container via terminal/bash. Please note the Docker container is created with the option -it which means we are not starting the container in detached mode. Instead, we are starting an interactive terminal as PID 1!

Now you have a running Docker container, but NW ABAP is not yet installed. Unfortunately, installing SAP automatically via Dockerfile has some container related constraints (see Part 2 for Docker basics). Thus, we will have to install NW ABAP in the next step.

Start the installation of SAP NW ABAP 7.51 Trial


# start uuid deamon
/usr/sbin/uuidd

# Now execute either this auto install script 
./install.exp

# or the install script shipped by SAP (called by install.exp)
./install.sh

Your installation has been successful if you see the followong message: Installation of NPL successful

Hint: According to the documentation this installation will take about 20-30 minutes, for me it took only 10-12 minutes. However, in 1 out of 10 cases the installation seems to hang for some reason which I can’t explain (I could reproduce that without Docker as well). In such cases you can simply kill your terminal session which will also stop the container. Then simply remove the docker container with docker rm nwabap751 before you execute the same docker run from above again and continue from there…

Stopping NW ABAP and the Docker container


After the installations your SAP is running. Next, stop the system and exit the container:

# switch the user to npladm (created by the sap installation)
su npladm

# stop sap
stopsap

# exit the current user (npladm)
exit
# finally exit the shell which will stop the container
exit

Starting the NW ABAP container and NW ABAP inside the container


Starting everything is quire easy:

# start in interactive mode
docker start -i nwabap751

# start uuid deamon
/usr/sbin/uuidd

# switch user to npladm created by the installation
su npladm

# start nw abap inside the currently running container
startsap
Important Post Installation Steps

There are some small post installation steps needed, especially updating the license (no worries, it’s free). It takes only a few minutes.

Additional Hints and Thoughts


The GitHub repo offer lots of additional details, so does the YouTube video. In the video you’ll see how to connect to NW ABAP via SAPGUI – the SAPGUI is also installed in the video. Furthermore, the video shows you how to test your NW ABAP using the good old ping service.

Feel free to start coding in ABAP on your own NW ABAP and learn new things right now – no matter where you are.

Unfortunately, NW ABAP 7.52 is not yet out as a trial edition (but it’s in the pipeline). I hope this will change soon. I have a few things on my wishlist:

1. NW ABAP 7.52 on HANA (Express)
2. An approach to install patches/notes, i.e. for upgrading to a new SP without having to reinstall the whole NW ABAP from scratch
3. A better CLI allowing me to better containerize NW ABAP (I want to avoid own hacks)
4. More frequent updates of NW ABAP (NW ABAP 7.51 SP02 Trial is from 2016), should appear soon after new non-trial NW ABAP comes out
5. Probably it makes sense having an (almost?) “naked” NW ABAP and a fully configured NW ABAP (“naked” NW ABAP Trial could probably be published way faster, while fully configured NW ABAP could be published later)

I understand that the current idea of a Trial version is to “ship it all with everything preconfigured” (i.e. it even includes the SAP Cloud Connector). I assume that the needed configuration can take quite some effort and time (not even considering dependencies…). However, I’d be happy with a minimum “naked” trial version that I can configure on my own in favor of getting the latest ABAP as soon as possible so that I can try cool new things out right when they come out – and write blogs or convince customers to upgrade. The point is that it typically takes often a year or even more before customers upgrade, and it’s really hard to wait so long. Imagine there are already books out that illustrate some pretty cool ABAP in Eclipse features which require 7.52. Some of us don’t have any chance trying them out because their employers are still running on 7.51 (or even older), and they don’t want or can’t use CAL (SAP Cloud Appliance Library) for several valid reasons. As a Java and web developer I’m used to try things out whenever they come out, be it WildFly, Glassfish, Payara, Tomcat, Angular, Vue, Ploymer,… and OpenUI5 – without any hassles. So, when it comes to ABAP, then I have a dream that one day we’ll get the latest and greatest NW ABAP Trial as soon as it gets out.

No comments:

Post a Comment