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.