In a previous post, I demonstrated how to deploy an app to the Tanzu Platform and bind a PostgreSQL database using a Kubernetes runtime. This concept originally comes from Cloud Foundry, so let’s take a look at how it’s done on that platform.
Install & configure the Postgres tile
The first step is to add the Postgres tile to Ops Manager, enabling us to provision and consume PostgreSQL databases within the Cloud Foundry platform. The tile can be downloaded from the Broadcom Support Portal.
Once downloaded, we need to upload, configure, and deploy the tile using Operations Manager (Ops Manager).
One mandatory configuration step is specifying the services network. In my simple setup, all Cloud Foundry components run within a single network. However, in a typical production environment, you would separate concerns across multiple networks:
-
Infrastructure network – used by Ops Manager and the BOSH Director
-
CF deployment segment – used by components like Gorouters, Diego Cells, and Cloud Controllers
-
Services segment – dedicated to add-on tiles, such as the PostgreSQL tile
My setup looks like this:
The next step is to define an on-demand service plan. The specific configuration will depend on your requirements. You’ll need to specify an availability zone (AZ) where the service instances will be deployed—az01 in my case.
Once the tile is configured, proceed to Review Pending Changes and apply the updates, selecting only the BOSH Director and the VMware Postgres for Tanzu Application Service tile.
Now we’re ready to cf push an app that is going to use a Postgres database!
Deploy the app – create & bind a database
I’m using the Explore Inclusion app, which I also showcased at VMware Explore last year (at that time, it was running on Kubernetes). Feel free to update the route in the manifest.yml file to suit your needs.
You can simply deploy the app using cf push, by default 3 AIs (containers) will be deployed and are available. cf apps will show the route to your app, you can access it in the browser.
Let’s now create and bind a Postgres database. First list available services:
cf marketplace
Will come back with:
Getting all service offerings from marketplace in org viktorious / space space01 as admin... offering plans description broker app-autoscaler standard Scales bound applications in response to load app-autoscaler postgres on-demand-postgres-db Postgres service to provide on-demand dedicated instances configured as database. postgres-odb
We’re going to use the postgres offering here.
cf create-service postgres on-demand-postgres-db psql01
We’re creating a Postgres database called psql01, using the on-demand-postgres-db plan.
Use
cf services
to check the actual status of the service. Wait until the service reports “create succeeded”.
Now bind the app to the service
cf bind-service explore-inclusion psql01
And restage the application
cf restage explore-inclusion
Run
cf services
To check if the app is bound to the database.
You can check the app and validate it’s connected to the database.
That’s it, we have deployed an app to CF and bound the app to a Postgres database. I hope this was useful!