Skip to content

Commit

Permalink
fix bugs encountered during demo (#709)
Browse files Browse the repository at this point in the history
Signed-off-by: Mikayla Thompson <thomika@amazon.com>
  • Loading branch information
mikaylathompson committed Jun 10, 2024
1 parent 578729c commit 2c60787
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class CaptureProxyStack extends MigrationServiceCore {
const servicePolicies = props.streamingSourceType === StreamingSourceType.AWS_MSK ? createMSKProducerIAMPolicies(this, this.partition, this.region, this.account, props.stage, props.defaultDeployId) : []

const brokerEndpoints = StringParameter.valueForStringParameter(this, `/migration/${props.stage}/${props.defaultDeployId}/kafkaBrokers`);
const sourceClusterEndpoint = props.customSourceClusterEndpoint ? props.customSourceClusterEndpoint : "https://elasticsearch:9200"
const sourceClusterEndpoint = props.customSourceClusterEndpoint ?? "https://elasticsearch:9200"
let command = `/runJavaWithClasspath.sh org.opensearch.migrations.trafficcapture.proxyserver.CaptureProxy --kafkaConnection ${brokerEndpoints} --destinationUri ${sourceClusterEndpoint} --insecureDestination --listenPort 9200`
command = props.streamingSourceType === StreamingSourceType.AWS_MSK ? command.concat(" --enableMSKAuth") : command
command = props.otelCollectorEnabled ? command.concat(` --otelCollectorEndpoint http://localhost:${OtelCollectorSidecar.OTEL_CONTAINER_PORT}`) : command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface MigrationConsoleProps extends StackPropsExt {
readonly migrationConsoleEnableOSI: boolean,
readonly migrationAPIEnabled?: boolean,
readonly servicesYaml: ServicesYaml,
readonly sourceClusterEndpoint?: string,
}

export class MigrationConsoleStack extends MigrationServiceCore {
Expand Down Expand Up @@ -215,11 +216,13 @@ export class MigrationConsoleStack extends MigrationServiceCore {
"cloudwatch:GetMetricData"
]
})
const sourceClusterEndpoint = props.sourceClusterEndpoint ?? `https://capture-proxy-es.migration.${props.stage}.local:9200`;

// Upload the services.yaml file to Parameter Store
let servicesYaml = props.servicesYaml
servicesYaml.source_cluster = {
'endpoint': `https://capture-proxy-es.migration.${props.stage}.local:9200`,
'endpoint': sourceClusterEndpoint,
// TODO: We're not currently supporting auth here, this may need to be handled on the migration console
'no_auth': ''
}
// Create a new parameter in Parameter Store
Expand All @@ -232,7 +235,7 @@ export class MigrationConsoleStack extends MigrationServiceCore {
const environment: { [key: string]: string; } = {
"MIGRATION_DOMAIN_ENDPOINT": osClusterEndpoint,
// Temporary fix for source domain endpoint until we move to either alb or migration console yaml configuration
"SOURCE_DOMAIN_ENDPOINT": `https://capture-proxy-es.migration.${props.stage}.local:9200`,
"SOURCE_DOMAIN_ENDPOINT": sourceClusterEndpoint,
"MIGRATION_KAFKA_BROKER_ENDPOINTS": brokerEndpoints,
"MIGRATION_STAGE": props.stage,
"MIGRATION_SOLUTION_VERSION": props.migrationsSolutionVersion,
Expand Down Expand Up @@ -281,7 +284,9 @@ export class MigrationConsoleStack extends MigrationServiceCore {
}]
serviceDiscoveryPort = 8000
serviceDiscoveryEnabled = true
imageCommand = ['/bin/sh', '-c', 'python3 /root/console_api/manage.py runserver_plus 0.0.0.0:8000']
imageCommand = ['/bin/sh', '-c',
'/root/loadServicesFromParameterStore.sh && python3 /root/console_api/manage.py runserver_plus 0.0.0.0:8000'
]
}

if (props.migrationConsoleEnableOSI) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ export class StackComposer {
migrationConsoleEnableOSI: migrationConsoleEnableOSI,
migrationAPIEnabled: migrationAPIEnabled,
servicesYaml: servicesYaml,
// The default value is correct if we deploy the capture proxy (e.g. captureProxyServiceEnabled or captureProxyESServiceEnabled),
// but not if the user does it on their own (in which case we use captureProxySourceEndpoint)
sourceClusterEndpoint: !(captureProxyServiceEnabled || captureProxyESServiceEnabled) ? captureProxySourceEndpoint : undefined,
stackName: `OSMigrations-${stage}-${region}-MigrationConsole`,
description: "This stack contains resources for the Migration Console ECS service",
stage: stage,
Expand Down

0 comments on commit 2c60787

Please sign in to comment.