So stellen Sie eine Verbindung zu DocumentDB mit TLS aus der Java -Anwendung in ECS -Container her

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: So stellen Sie eine Verbindung zu DocumentDB mit TLS aus der Java -Anwendung in ECS -Container her

by Anonymous » 14 Feb 2025, 14:04

Ich versuche, einen auf ECS Fargate gehosteten Microcks -Container auszuführen. Es erfordert eine MongoDB (DocumentDB), um API -Mock -Definitionen in zu speichern. -Bundle.pem -Datei und speichern Sie sie im Java -Keystore, aber ich erhalte immer noch den Fehler, dass sie keinen gültigen Zertifizierungspfad für angeforderte Ziele finden kann. Init Container (gibt es für diese Aufgabe ein kleineres Bild?): < /p>

Code: Select all

const initContainer = taskDefinition.addContainer('init-container', {
image: ecs.ContainerImage.fromRegistry('openjdk:17-alpine'),
essential: false,
command: [
'sh', '-c',
`
mkdir -p /tmp/certs && \
wget https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem -O /tmp/certs/global-bundle.pem && \
ls -la /tmp/certs/ && \
keytool -import -noprompt -alias "docdb-cert" -file /tmp/certs/global-bundle.pem \
-keystore /tmp/certs/truststore.jks -storepass changeit && \
keytool -list -keystore /tmp/certs/truststore.jks -storepass changeit
`
]
});
< /code>
Und dann ist dies meine ECS -Aufgabendefinition: < /p>
const microcksContainer = taskDefinition.addContainer(
'microcks-container',
{
image: ecs.ContainerImage.fromRegistry('quay.io/microcks/microcks'), //quay.io images maintained directly by microcks team
containerName: 'microcks',
logging: ecs.LogDrivers.awsLogs({
streamPrefix: 'microcks',
logRetention: logs.RetentionDays.ONE_WEEK,
}),
secrets: {
DOCDB_PASSWORD: ecs.Secret.fromSecretsManager(docdbAdminSecret, 'password'),
},
startTimeout: Duration.seconds(180),
environment: {
SPRING_PROFILES_ACTIVE: 'dev',
SPRING_DATA_MONGODB_URI: `mongodb://docdbadmin:$DOCDB_PASSWORD@${docdbCluster.clusterEndpoint.hostname}:27017/?tls=true&retryWrites=false`,
SPRING_DATA_MONGODB_DATABASE: 'microcks',
JAVA_OPTIONS: "-Djavax.net.ssl.trustStore=/tmp/certs/truststore.jks -Djavax.net.ssl.trustStorePassword=changeit",
MONGODB_TLS: 'true',
MONGODB_TLS_ALLOW_INVALID_HOSTNAMES: 'true',
},
},
);
< /code>
Stellen Sie den Treuhandspeicher falsch an? DocumentDB ohne das TLS -Zertifikat im Java -Schlüsselspeicher zu speichern, aber es hat auch nicht funktioniert.
Ich habe versucht, die Zeichenfolge zu verwenden: 
Spring_Data_Mongodb_uri: Mongodb: // docdbadmin: $ docdb_password @$ {docdbcluster.clusterendpoint.hostname}: 27017/? tls = true & tlscafile =/tmp/certs/global-bundle.pem & retrywrites = false 
,

Top