Introduction of Cloud Foundry on SAP Cloud Platform enables a lot of possibilities to deploy various applications on the cloud. Jenkins is one of the most asked and some people may struggle to find a place to run it.
In this blog, I’ll show how to deploy Jenkins on Cloud Foundry environment on SAP Cloud Platform.
Go to https://jenkins.io/download/ and download Generic Java Package (war) of the version you prefer.
Deploy Jenkins on Cloud Foundry
Connect to Cloud Foundry using CLI. (See how to download here).
cf api https://api.cf.eu10.hana.ondemand.com
We’re going to deploy Jenkins.war using this special buildpack.
cf push <path_to_jenkins.war> -b https://github.com/Altoros/jenkins-buildpack -m 2G <unique_app_name>
Here is what it looks like for me:
$ cf push -p Downloads/jenkins.war -b https://github.com/Altoros/jenkins-buildpack -m 2G jenkins-chairatCreating app jenkins-chairat in org P1941180417trial_trial / space dev as firstname.lastname@example.org...OKCreating route jenkins-chairat.cfapps.eu10.hana.ondemand.com...OKBinding jenkins-chairat.cfapps.eu10.hana.ondemand.com to jenkins-chairat...OKUploading jenkins-chairat...Uploading app files from: /var/folders/z9/509z92q528g_vyl_l8g72s7w0000gn/T/unzipped-app082759293Uploading 21.6M, 1177 filesDone uploadingOKStarting app jenkins-chairat in org P1941180417trial_trial / space dev as email@example.com...Creating containerSuccessfully created containerDownloading app package...Downloaded app package (69.9M)Staging...cat: /tmp/buildpackdownloads/33bbc852fcb5b983f2ec3eef5d6759f4/VERSION: No such file or directory-------> Buildpack version-----> Extracting JRE./tmp/app/vendor ~-----> Moving jre1.8.0_102 to target folder.~-----> Repacking jenkins.war./tmp/app ~~-----> Building runtime environment.-----> Done.Exit status 0Staging completeUploading droplet, build artifacts cache...Uploading build artifacts cache...Uploading droplet...Uploaded build artifacts cache (131B)Uploaded droplet (207.3M)Stopping instance b61f17b6-70bc-4547-aeae-9e789a2f5279Uploading completeDestroying containerSuccessfully destroyed container0 of 1 instances running, 1 starting0 of 1 instances running, 1 starting1 of 1 instances runningApp startedOKApp jenkins-chairat was started using this command `java -jar jenkins.war --httpPort=$PORT`Showing health and status for app jenkins-chairat in org P1941180417trial_trial / space dev as firstname.lastname@example.org...OKrequested state: startedinstances: 1/1usage: 2G x 1 instancesurls: jenkins-chairat.cfapps.eu10.hana.ondemand.comlast uploaded: Sun Oct 22 03:06:18 UTC 2017stack: cflinuxfs2buildpack: https://github.com/Altoros/jenkins-buildpackstate since cpu memory disk details#0 running 2017-10-22 10:08:12 AM 160.3% 1.1G of 2G 427.7M of 1G
Login to Jenkins
Once the instance is up and running, go to the app’s URL as indicated above.
It will ask you to enter administrator password.
Find your password with this command:
cf logs jenkins-chairat --recent | grep -B 1 -A 2 "following password"
Proceed the installation by installing suggested plugins.
In the last step, create an account and the Jenkins will be ready to use.
cf-example-jenkins - How to deploy Jenkins to a Cloud Foundry based PaaS