Tcps Connection to Oracle database from Gcp
#####################
GCP
#####################
1) Open Firewall for all scan ip and Vip
2) Use latest version of Oracle Driver . Use following dependency in pom.xml
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdc9<//artifactId>
<version>21.5.0.0</version>
</dependency>
3) The certificate is stored in Gcs bucket and it needs to be fetched programmatically in the microservice .
If we use different bucket we need to upload same to storage bucket and name of certificate in code in property file plus in trust-store password in secret ORADB_EXACC_TRUSTSTORE_PWD
Also add the Jvm trust-store properties and the certificate name in application.yml file
certificateName:
projectId:
storeBucketName :
hhtpProtocols :
enableAlgorithms :
trustStoreType :
trustStore:
trustStorePassword:
Code to fetch certificate from Gcs bucket to //tmp is added to RepositoryConfiguraion class
4) Add Gcp storage dependency
<dependency>
<groupId>com.google.cloud.</groupId>
<artifactId>spring-cloud-gcp-starter-storage</artifactId>
<version>3.1.0</version>
</dependency>
5) Set Jvm system properties for the trust-store for SSL connection in Repository Configuration Class
System.setproperty("java.net.ssl.trustStore",env.getProperty("truststore") ) ;
System.setproperty("java.net.ssl.trustStorePassword",env.getProperty("truststorePassword") ) ;
System.setproperty("java.net.ssl.trustStoreType",env.getProperty("truststoreType") ) ;
System.setproperty("https.protocols",env.getProperty("httpProtocols") ) ;
System.setproperty("jdk.tls.client.protocols",env.getProperty("ClientProtocols") ) ;
System.setproperty("jdk.tls.enableAlgorithims",env.getProperty("enableAlgorithim") ) ;
6) Secret Manager Setup
7) Some projects are using consul service mesh for managing service communication and traffic control . In our case dev GKE cluster is already setup with consul configuration .
For enabling new service to use consul service mesh , setup following at time of deployment
consul.hashicorp.com/connect-inject-status: injected
consul.hashicorp.com/connect-service-port : 9000
8) Context Path setup
For Consul service to service communication , the routes are setup based on context paths for each microservices so we need the context path setup in each microservices in application.yml file
server :
port :
serlet :
context-path :
Comments
Post a Comment