It’s so much easy to deploy your spring boot app on pivotal web service.
You’ve to follow some steps.
First add two dependecy on your pom.xml file.
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-spring-service-connector</artifactId> <version>1.0.0.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-cloudfoundry-connector</artifactId> <version>1.0.0.RELEASE</version> </dependency>
Now package your app using this maven command
$ mvn clean package -Dmaven.test.skip=true
Here we passed arguments -Dmaven.test.skip=true not to test app when packaging.
This command will package your app into a jar file. Now push that file in cloudfoundary web service. But before you proceed you need to install cloud foundary CLI (cf CLI) and login with your email and password.
$ cf login -a api.run.pivotal.io
Okay now push your app
$ cf push appname -p target/appname-0.0.1-SNAPSHOT.jar
This will create an app on pivotal console. But will fail at first. Don’t worry. The reason is you didn’t specify/change your database credentials on application.properties file. Since I don’t know how to create app on pivotal console yet, so I pushed first to create app. That was dumb, I know.
To get database credential, login to pivotal console with your email and password, to to your app->click on Service tab and choose a database. for this tutorial I choose cleardb mysql database.
After adding database click view credentials to get database host, username, password and other credentials. Use this credentials on application.properties, package your app and push it to using previous command. You’ll see your app running after a while.
Well that was easy right? you can scale your app from pivotal console.
2 thoughts on “Deploy Spring Boot app on Pivotal Web Service (cloud foundry PaaS)”
[…] Deploy Spring Boot app on Pivotal Web Service (cloud foundry PaaS) […]
Thanks for helping me to achieve new suggestions about computers. I also possess the belief that one of the best ways to maintain your laptop computer in excellent condition is by using a hard plastic case, or perhaps shell, which fits over the top of the computer. These kinds of protective gear tend to be model unique since they are made to fit perfectly across the natural covering. You can buy all of them directly from the owner, or via third party sources if they are intended for your notebook, however not all laptop will have a shell on the market. Yet again, thanks for your ideas.