--- title: VMware Postgres for VMware Tanzu Application Service 1.0をインストールするメモ tags: ["vSphere", "Cloud Foundry", "Pivotal Cloud Foundry", "Ops Manager", "TAS", "BOSH", "PostgreSQL"] categories: ["Dev", "PaaS", "CloudFoundry", "PCF"] date: 2023-12-12T12:10:36Z updated: 2023-12-12T12:10:36Z --- ``` pivnet download-product-files --product-slug='vmware-postgres-for-tas' --release-version='1.0.0' --product-file-id=1631019 ``` ``` om --env env.yml upload-product --product postgres-1.0.0-build.846.pivotal om --env env.yml stage-product --product-name postgres --product-version 1.0.0-build.846 ``` image * "Enable TLS" * "AZs to deploy postgres instances of this plan" image image image image image ``` $ cf marketplace Getting all service offerings from marketplace in org demo / space demo 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 TIP: Use 'cf marketplace -e SERVICE_OFFERING' to view descriptions of individual plans of a given service offering. ``` ``` cf create-service postgres on-demand-postgres-db attendees-db ``` ``` $ cf service attendees-db Showing info of service attendees-db in org demo / space demo as admin... name: attendees-db guid: 53ffc9d1-0c41-46fe-8e1e-828a06ddffbd type: managed broker: postgres-odb offering: postgres plan: on-demand-postgres-db tags: offering tags: postgres, pivotal, on-demand description: Postgres service to provide on-demand dedicated instances configured as database. documentation: dashboard url: Showing status of last operation: status: create succeeded message: Instance provisioning completed started: 2023-12-08T13:32:16Z updated: 2023-12-08T13:32:16Z Showing bound apps: There are no bound apps for this service instance. Showing sharing info: This service instance is not currently being shared. The "service_instance_sharing" feature flag is disabled for this Cloud Foundry platform. Service instance sharing is disabled for this service offering. Showing upgrade status: There is no upgrade available for this service. ``` ``` cf bind-service attendees attendees-db ``` ``` cf restage attendees ``` ``` cf delete attendees -fr cf delete-service attendees-db -f ``` image ``` git clone https://github.com/categolj/blog-api.git cd blog-api # git checkout ee957ac5ce3a96db766008217e4f3bf0968af540 ./mvnw -V --no-transfer-progress clean package -DskipTests ``` ``` cf create-service postgres on-demand-postgres-db blog-db ``` ``` cf push blog-api -p target/blog-api-5.0.0-SNAPSHOT.jar --no-start -m 768m -b java_buildpack_offline cf set-env blog-api JBP_CONFIG_OPEN_JDK_JRE '{jre: { version: 17.+}}' ``` ``` $ cf service blog-db Showing info of service blog-db in org demo / space demo as admin... name: blog-db guid: 5e4c2f9f-6f3a-46cf-ba1f-9b23798cd602 type: managed broker: postgres-odb offering: postgres plan: on-demand-postgres-db tags: offering tags: postgres, pivotal, on-demand description: Postgres service to provide on-demand dedicated instances configured as database. documentation: dashboard url: Showing status of last operation: status: create succeeded message: Instance provisioning completed started: 2023-12-09T07:47:05Z updated: 2023-12-09T07:47:05Z Showing bound apps: There are no bound apps for this service instance. Showing sharing info: This service instance is not currently being shared. The "service_instance_sharing" feature flag is disabled for this Cloud Foundry platform. Service instance sharing is disabled for this service offering. Showing upgrade status: There is no upgrade available for this service. ``` ``` cf bind-service blog-api blog-db cf start blog-api ``` ``` $ cf app blog-api Showing health and status for app blog-api in org demo / space demo as admin... name: blog-api requested state: started routes: blog-api.apps.10.220.46.42.nip.io last uploaded: Sat 09 Dec 07:52:24 UTC 2023 stack: cflinuxfs4 buildpacks: name version detect output buildpack name java_buildpack_offline v4.63.1-offline-https://github.com/cloudfoundry/java-buildpack#9e247374 java java type: web sidecars: instances: 1/1 memory usage: 768M state since cpu memory disk logging details #0 running 2023-12-09T07:52:48Z 0.7% 310.9M of 768M 217.2M of 1G 0/s of 16K/s type: task sidecars: instances: 0/0 memory usage: 1024M There are no running instances of this process. ``` ``` curl -sk https://blog-api.apps.10.220.46.42.nip.io/entries/template.md > template.md curl -sk -u admin:changeme -XPUT https://blog-api.apps.10.220.46.42.nip.io/entries/1 -H "Content-Type: text/markdown" -d "$(cat template.md)" ``` ``` $ curl -sk https://blog-api.apps.10.220.46.42.nip.io/entries/1 | jq . { "entryId": 1, "frontMatter": { "title": "Welcome to CategolJ!", "categories": [ { "name": "Blog" }, { "name": "Posts" }, { "name": "Templates" } ], "tags": [ { "name": "Hello World" }, { "name": "CategolJ" } ] }, "content": "Welcome\n\n**Hello world**, this is my first Categolj blog post.\n\nI hope you like it!", "created": { "name": "admin", "date": "2023-12-09T07:55:22.471656Z" }, "updated": { "name": "admin", "date": "2023-12-09T07:55:22.471656Z" } } ``` ``` git clone https://github.com/categolj/blog-ui.git cd blog-ui # git checkout 124fc95197c85f40d74ddb4fcaabe2c2982997ea cf push blog-ui -b nodejs_buildpack -m 256m ``` ``` $ cf app blog-ui Showing health and status for app blog-ui in org demo / space demo as admin... name: blog-ui requested state: started routes: blog-ui.apps.10.220.46.42.nip.io last uploaded: Sat 09 Dec 08:11:44 UTC 2023 stack: cflinuxfs4 buildpacks: name version detect output buildpack name nodejs_buildpack 1.8.15 nodejs nodejs type: web sidecars: instances: 1/1 memory usage: 256M state since cpu memory disk logging details #0 running 2023-12-09T08:12:22Z 0.4% 83M of 256M 596.6M of 1G 0/s of 16K/s ``` image