0
votes

Database service is running in specific org and space. Two apps are bound to this DB service.

To apply liquibase change from Jenkins to DB service, we need JDBC connection between Jenkins and bosh instance.

Jenkins is outside PCF

How to retrieve IP address of Database service host?

1
If you read the various docs you'll see that the credentials are passed via VCAP_SERVICES - you can look at this in the console. But your platform may not allow direct access from external IPs, and the service may provide its own management console, so YMMV. Also this isn't the same as the IP of the bosh instance. The easiest way to apply migrations, in my experience, is to have your app do it on startup. - jonrsharpe
@jonrsharpe any techstack in java that can do this job? Flyway or liquibase do it at buildtime - overexchange
I've done it using Spring Boot with both Flyway and Liquibase, with any migrations being made when the app starts. That way it happens automagically when you cf push a version of your app with additional migrations in. - jonrsharpe
@jonrsharpe can you share the reference to a documentation that does at start of app? Using liquibase... any article wpuy help me. - overexchange
I shouldn't have to Google "spring boot liquibase" for you, but here we are: docs.spring.io/spring-boot/docs/current/reference/html/… - jonrsharpe

1 Answers

1
votes

How to retrieve IP address of Database service host?

Load the hostname from VCAP_SERVICES and then resolve it. You can use jq to read VCAP_SERVICES and pull out the hostname. You can then use dig <hostname> or host <hostname> to resolve the hostname. Then you have the IP.

If you're trying to access a service from outside CF, make sure that you have network and firewall access to said service. Network access is often restricted/blocked outside of the CF environment.

Hope that helps!