Monday 12 August 2019

Develop Simple on HANA Express in AWS Cloud 9 Checkpoint – How to Catch Up/Restart

Develop Simple on HANA Express in AWS Cloud 9
Develop Simple on HANA Express in AWS Cloud 9 Part 2 – The Backend App
Develop Simple on HANA Express in AWS Cloud 9 Part 3 – The Frontend App

Overview


In the past 3 parts of this series, we’ve done a lot of Cloud 9 configuration and coding. As someone whose first job is not that of a technical writer, I know that some steps may not have been clear. I also know as someone who follows along to tutorials, sometimes I just need a ‘fast forward’ or ‘catch up’ button. This will be the point of this part of the series. Or if you happen to massively mess up your progress, this will walk you through quickly getting back up and running as-of Part 3 in the series.

Prerequisites


◈ New AWS Cloud 9 Instance (m4.large (8 GiB RAM + 2 vCPU) recommended) Setup is easy in AWS and takes about 2 or 3 minutes to be up and running.
◈ DockerHub Account (Free) Since SAP makes you log into Docker Hub to pull their HANA Express image, you’ll want to create a free Docker Hub account to do so.

Catch Up Steps


1. Log into Cloud 9 and from a Terminal, type in the following cheat code:

bash <(curl -s https://entmike.github.io/hanadev/quickstart.sh)

2. You will be prompted to provide your Docker username and password, so enter them now. If you are a bit leary/curious of what the contents of quickstart.sh is doing, you can look here to see that nothing nefarious is going on, or run each line manually yourself.https://github.com/entmike/hanadev/blob/master/docs/quickstart.sh

3. Go grab a coffee, sit back, pat yourself on the back for a hard job well done, and watch the console spam go as your backend and frontend app Docker image is built.

Running the Docker Compose Stack


1. From the Terminal, type:

cd hanadev
docker-compose up

The first time you bring the stack up, docker-compose will download the HANA Express Docker image and SQLPad Docker image (unless you’ve pulled them before.) AWS Cloud 9 and DockerHub have a pretty fast Internet pipe and this doesn’t take too long. After the images are pulled, HANA Express will run its initial setup script which takes approximately 5-7 minutes to complete (on an EC2 m4.large instance.) Subsequent startups take right around 1 minute.

2. Once you see the following lines show up, you can continue to the next section.

hxehost_1          |     (Post start) Hook /hana/hooks/post_start/201_hxe_optimize: 7s
hxehost_1          |     (Post start) Hook /hana/hooks/post_start/203_set_hxe_info: 0s
hxehost_1          |     Post start: 271s
hxehost_1          |     Overall: 407s
hxehost_1          | Ready at: Tue May 21 14:32:01 UTC 2019
hxehost_1          | Startup finished!

Make your Application User for backend


While leaving your docker-compose up command running in Terminal, open a second Terminal window, and type:

docker exec hanadev_hxehost_1 /usr/sap/HXE/HDB90/exe/hdbsql -n localhost:39017 -u SYSTEM -p HXEHana1 "CREATE USER APPUSER PASSWORD HXEHana1 NO FORCE_FIRST_PASSWORD_CHANGE;"

Note: Leave the password as HXEHana1 if you are following these steps exactly. This is because the docker-compose .env file has this password set as the same. If you wish, you may modify the hanadev/.env file with a different password and also modify the statement above to match that different password.

Open up Ports


1. At the top-right of your Cloud 9 IDE, locate the Root icon (Looks like a circle with the letter ‘R’) and click Manage EC2 Instance

2. Locate the Security Groups property near the bottom half of the EC2 details and click on the rule starting with aws-cloud9-..... This will take you to the Security group of your Cloud 9 EC2 instance.

3. Click on the Inbound tab and click Edit

4. Add the following ports:

Port Source  Description 
8080  0.0.0.0/0 App (Build)
3333  0.0.0.0/0  Backend (Dev) 
8899 0.0.0.0/0  SQLPad 

Test Run your Stack


There are 2 ways to test your running stack’s apps.

Option 1 – Run in Cloud 9

Click Preview -> Preview Running Application. Cloud 9 IDE will by default look for an app running on port 8080 which our Docker compose stack is set up to expose. You should get a browser panel inside your IDE with a page saying ‘HANA Sandbox’ with your HANA DB system details displayed.

Option 2 – Run via External IP

This option is more flexible, because we can more easily change the ports clearly.

1. Click Share at the top right of your Cloud 9 IDE and copy the Application IP address

2. In a new browser tab, navigate to one of the following URLs where 1.2.3.4 is your Application IP address.

App Example URL
SQLPad  http://1.2.3.4:8899
Our App   http://1.2.3.4:8080 
SAP HANA Study Materials, SAP HANA Certification, SAP HANA Express, SAP HANA Check Point, SAP HANA AWS, SAP HANA Online Exam

Back up and running in under 10 minutes!

No comments:

Post a Comment