| Instances can be created from cloud foundry or from Kyma. They are only be accessible from the environment they have been provisioned. To expose the instance to the outside world, consider hosting in Kyma or Cloud Foundry a middleware to handle a web protocol such as open layer. |

Cloud Foundry API url in the SAP BTP cockpit
cf login --sso -a https://api.cf.eu10.hana.ondemand.com
cf create-service postgresql-db development pgdemo -c '{"engine_version":"14"}'cf service pgdemo
[...]
Showing status of last operation:
status: create in progress
[...]
status: create succeededguid=$(cf service pgdemo --guid)
cf create-service-key pgdemo access_postgis_key
cf service-key pgdemo access_postgis_key \
| tail -n +2 \
| jq > access_postgis_key.json
dbname=$(jq -r '.credentials.dbname' access_postgis_key.json)
pghost=$(jq -r '.credentials.hostname' access_postgis_key.json)
pgport=$(jq -r '.credentials.port' access_postgis_key.json)
pguser=$(jq -r '.credentials.username' access_postgis_key.json)
pgpass=$(jq -r '.credentials.password' access_postgis_key.json)
baseurl=https://api-backing-services.eu10.data.services.cloud.sap
token=$(cf oauth-token)
curl -X PUT \
-H 'content-type: application/json' \
-H "Authorization: ${token}" \
-d "{\"database\":\"${dbname}\"}" \
"${baseurl}/v1/postgresql-db/instances/${guid}/extensions/postgis"
{"status":"succeeded"}
mkdir dummydir
cd dummydir
touch onefile
cf push ssh_pgdemo -b staticfile_buildpack -m 64m
cf enable-ssh ssh_pgdemo
cf restart ssh_pgdemo
cf ssh -L 63306:$pghost:$pgport ssh_pgdemo
ogr2ogr -f PostgreSQL \
PG:"dbname='${dbname}' host='localhost' port='63306' user='${pguser}' password='${pgpass}'" \
/vsicurl_streaming/https://download.geofabrik.de/europe/andorra-latest.osm.pbf
0...10...20...30...40...50...60...70...80...90...100 - done.
cat <<EOF | kubectl apply -n your_namespace -f -
pipe heredoc> apiVersion: v1
kind: Pod
metadata:
name: pgclient
spec:
volumes:
- name: pgcreds
secret:
secretName: pgauthdata
containers:
- name: pgclient
image: postgres:14-bullseye
command: ["/bin/sh"]
args: ["-c", "while true; do echo hello; sleep 10;done"]
volumeMounts:
- name: pgcreds
mountPath: /tmp/pgcreds
> EOF
pod/pgclient created
kubectl exec -n your_namespace -ti pgclient -- /bin/bash
root@pgclient:/# psql -h $(</tmp/pgcreds/host) -p $(</tmp/pgcreds/port) "dbname='$(</tmp/pgcreds/database)' user=$(</tmp/pgcreds/user) password='$(</tmp/pgcreds/password)'"
psql (14.10 (Debian 14.10-1.pgdg110+1), server 13.11) SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
<your_dbname>=> select * from pg_tables limit 3;
schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers | rowsecurity
------------+-------------------------+------------+------------+------------+----------+-------------+-------------
pg_catalog | pg_statistic | rdsadmin | | t | f | f | f
pg_catalog | pg_type | rdsadmin | | t | f | f | f
public | langchain_pg_collection | dbo | | t | f | t | f
(3 rows)
<your_dbname>=> exit
root@pgclient:/# exit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 45 | |
| 21 | |
| 18 | |
| 18 | |
| 18 | |
| 18 | |
| 17 | |
| 17 | |
| 16 | |
| 15 |