Deploying Hello World on Cloud Foundry Without Any Coding

The introduction of S/4HANA Cloud SDK makes it even easier to develop cloud applications and integration with back-end SAP and cutting-edge tools and technologies like Hystrix, Docker, and Jenkins.

In this blog, I’m showing you how to deploying a Hello World application on SAP Cloud Foundry without any coding using S/4HANA Cloud SDK.

Prerequisite

Make sure you have a trial account on Cloud Foundry. If not, get one from here.

Make sure your PC has the following installed:

  • JDK
  • Maven
  • Cloud Foundry CLI

On Windows, you can use these commands to install those softwares with Chocolatey:

choco install jdk8
choco install maven
choco install cloudfoundry-cli

Generate Project

Use this command to generate Maven project from Archtype:

mvn archetype:generate -DarchetypeGroupId=com.sap.cloud.s4hana.archetypes -DarchetypeArtifactId=scp-cf-spring -DarchetypeVersion=LATEST

Enter project information as you wish. Here is mine for your example:

groupId: me.chairat.scp.spring.hello
artifactId: hellospring
version: 1.0-SNAPSHOT (Just press ENTER)
package: me.chairat.scp.spring.hello (Just press ENTER)
uniqueHostname: hellospring-chairat

You will get a project folder with a few sub modules. Get into the folder and build it with this command:

mvn clean package

Deploying to Cloud

Time to deploy to the cloud. Use the following set of commands:

cf api https://api.cf.eu10.hana.ondemand.com
cf login
cf push

Your application will be built, deployed, and started automatically in a while. If everything is okay, you should see this message:

Showing health and status for app hellospring in org P1234567890trial_trial / sp
ace dev as xxx@xxx.com...
OK
requested state: started
instances: 1/1
usage: 512M x 1 instances
urls: hellospring-chairat.cfapps.eu10.hana.ondemand.com
last uploaded: Wed Oct 18 14:25:51 UTC 2017
stack: cflinuxfs2
buildpack: sap_java_buildpack
state     since                    cpu      memory           disk
details
#0 running 2017-10-18 09:26:40 PM 167.3% 350.1M of 512M 129.2M of 1G

Go to Cloud Cockpit and click the link to open your application.

Hello World Application on Cloud Foundry
Hello Endpoint

Hola! My next step is to play around with Jenkins.