Skip to content

Commit

Permalink
Add state repository and remove explicit add repo for remote store in…
Browse files Browse the repository at this point in the history
…dexes

Signed-off-by: Ashish Singh <ssashish@amazon.com>
  • Loading branch information
ashking94 committed Sep 8, 2023
1 parent de2874c commit 1708a07
Showing 1 changed file with 6 additions and 29 deletions.
35 changes: 6 additions & 29 deletions lib/infra/infra-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,12 @@ export class InfraStack extends Stack {
cwd: '/home/ec2-user',
ignoreErrors: false,
}));

// eslint-disable-next-line max-len
cfnInitConfig.push(InitCommand.shellCommand(`set -ex;cd opensearch; echo "node.attr.remote_store.state.repository: ${scope.stackName}-repo" >> config/opensearch.yml`, {
cwd: '/home/ec2-user',
ignoreErrors: false,
}));
}
}

Expand Down Expand Up @@ -585,35 +591,6 @@ export class InfraStack extends Stack {
}));
}

if (props.enableRemoteStore) {
// Snapshot creation call should be done from one node to avoid any race condition, using seed node.
if (nodeType === 'seed-manager' || nodeType === 'seed-data') {
if (props.securityDisabled) {
// eslint-disable-next-line max-len
cfnInitConfig.push(InitCommand.shellCommand(`set -ex; sleep 60; curl -XPUT "http://localhost:9200/_snapshot/${scope.stackName}-repo" -H 'Content-Type: application/json' -d'
{
"type": "s3",
"settings": {
"bucket": "${scope.stackName}",
"region": "${scope.region}",
"base_path": "remote-store"
}
}'`));
} else {
// eslint-disable-next-line max-len
cfnInitConfig.push(InitCommand.shellCommand(`set -ex; sleep 60; curl -XPUT "https://localhost:9200/_snapshot/${scope.stackName}-repo" -ku admin:admin -H 'Content-Type: application/json' -d'
{
"type": "s3",
"settings": {
"bucket": "${scope.stackName}",
"region": "${scope.region}",
"base_path": "remote-store"
}
}'`));
}
}
}

// If OSD Url is present
if (props.dashboardsUrl !== 'undefined') {
cfnInitConfig.push(InitCommand.shellCommand(`set -ex;mkdir opensearch-dashboards; curl -L ${props.dashboardsUrl} -o opensearch-dashboards.tar.gz;`
Expand Down

0 comments on commit 1708a07

Please sign in to comment.