The following steps will help you prepare a cloud foundry application for the sample you are working on (application-properties, auto-reconfiguration, etc).
These instructions assume you have access to CF and OCP environments and are logged into each.
This demo attempts to simulate a situation where you are migrating a CF app that is bound to an external database. Often, this is done using User Provided Services. Both external and internal services appear the same to a CF app, and both are displayed when running cf services. So, for this demo, we will provision a MySQL database from the CF Marketplace. This will create an internal database, but since a CF app doesn't know the difference between internal or external, this will work for the demo.
Follow these steps to provision a MySQL database:
- Create the MySQL database
cf create-service compose-for-mysql Standard testdb
- Confirm the database was created
cf services
CF applications are configured in code using an App Manifest. The app manifest for this application is manifest.yml. One of the important fields in this file is services, which lists the service that we created, testdb.
In the tutorial folder you are working on (application-properties, auto-reconfiguration, etc), run the following commands to deploy your application:
- Build the code locally to produce a Jar
mvn clean install - Push your CF application
cf push - Confirm your application was deployed successfully
cf apps