How to determine SCS Mirror Service and SCS Service Instance info using github URI
search cancel

How to determine SCS Mirror Service and SCS Service Instance info using github URI

book

Article ID: 297176

calendar_today

Updated On:

Products

Support Only for Spring

Issue/Introduction

This KB is useful for identifying which mirror service and service instance info using specific github URI.

Environment

Product Version: 3.1

Resolution

These are the steps in determining mirror service id and service instance id using specific github URI

1.  Login at Credhub

2. To list all the mirror services info in credhub. Run credhub find -p "/c/p.spring-cloud-services-scs-mirror-service/"

credhub find -p "/c/p.spring-cloud-services-scs-mirror-service/" 
credentials:
- name: /c/p.spring-cloud-services-scs-mirror-service/bcc91442-4c8b-4843-81c3-61a8699b81b9/credentials
  version_created_at: "2023-06-14T02:25:49Z"
- name: /c/p.spring-cloud-services-scs-mirror-service/ae19ed15-1c3f-4062-8589-35987d94df43/credentials
  version_created_at: "2023-06-14T02:13:56Z"
- name: /c/p.spring-cloud-services-scs-mirror-service/90ad2bd4-c1d5-468a-b342-8796252d538e/credentials
  version_created_at: "2023-06-14T02:13:21Z"
- name: /c/p.spring-cloud-services-scs-mirror-service/bb0d4c2d-12ad-4789-824a-8a421c4800f4/credentials
  version_created_at: "2023-06-14T02:13:00Z"
3. then use the path from above to get credentials/config. You need to do this one by one since we don't know which Service Instance has the problematic githbu URI. The github URI can be found under sourceUri 

credhub get -n "/c/p.spring-cloud-services-scs-mirror-service/90ad2bd4-c1d5-468a-b342-8796252d538e/credentials" -j
{
	"id": "7f83429e-15ba-48b5-9078-167878e0d43d",
	"name": "/c/p.spring-cloud-services-scs-mirror-service/90ad2bd4-c1d5-468a-b342-8796252d538e/credentials",
	"type": "json",
	"value": {
		"git": {
			"privateKey": "-----BEGIN RSA PRIVATE KEY-----\n########\n-----END RSA PRIVATE KEY-----\n",
			"sourceUri": "https://github.com/example/test",
			"uri": "ssh://[email protected]:22/var/vcap/store/mirror/9aced4e7599dca4ceb87ef244e04f188/test"
		},
		"refresh_mirrors": {
			"access_token_uri": "https://uaa.XXXXX.XXX:443/oauth/token",
			"client_id": "mirror_client_90ad2bd4-c1d5-468a-b342-8796252d538e",
			"client_secret": "XXXXXXXX",
			"enabled": true,
			"url": "https://scs-mirror-service.XXXXX.XXX/actuator/refreshmirrors/90ad2bd4-c1d5-468a-b342-8796252d538e"
		}
	},
	"metadata": null,
	"version_created_at": "2023-06-14T02:13:21Z"
}


4. Once you are able to identify which mirror. Get the Mirror service GUID in this example its 90ad2bd4-c1d5-468a-b342-8796252d538e
5. SSH into the SCS VM

bosh -d p_spring-cloud-services-xxxx ssh spring-cloud-services/xyzxxx

6. Login to SCS MySQL

sudo mysql --defaults-file=/var/vcap/jobs/pxc-mysql/config/mylogin.cnf

7. select the mirrordb database:

use mirrordb;
8. Get the app guid by specifying mirror service guid taken from Step 4.
mysql> select * from mirror_service_instance where service_instance_id='90ad2bd4-c1d5-468a-b342-8796252d538e';
select * from mirror_service_instance;
+----+--------------------------------------+--------------------------------------+
| id | service_instance_id                  | app_guid                             |
+----+--------------------------------------+--------------------------------------+
| 10 | 90ad2bd4-c1d5-468a-b342-8796252d538e | 832c9771-e4fd-4824-9be0-164540e0f53a |
+----+--------------------------------------+--------------------------------------+


9. Once you get the app_guid in this example the app_guid is  832c9771-e4fd-4824-9be0-164540e0f53a 
The app_guid is also the guid of the backing app of the SCS service instance. You can use this to determine by running the following command

cf curl /v3/apps/832c9771-e4fd-4824-9be0-164540e0f53a  

and look for  spring.cloud.appbroker.service-instance-id
 

"spring.cloud.appbroker.service-instance-id": "84b01fba-d0ad-47fd-b272-203f2080e9c8"


The associate service id on this example is 84b01fba-d0ad-47fd-b272-203f2080e9c8

10. You can use the service-instance-id to various query such as 

cf curl /v3/service_instances/884b01fba-d0ad-47fd-b272-203f2080e9c8