Skip to content

Commit

Permalink
Merge branch 'main' into backport/backport-21-to-1.x
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Singh <rishabhksingh@gmail.com>
  • Loading branch information
rishabh6788 committed Oct 24, 2023
2 parents 4e68443 + 07ca896 commit d1c064e
Show file tree
Hide file tree
Showing 13 changed files with 847 additions and 155 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Backport
on:
pull_request_target:
types:
- closed
- labeled

jobs:
backport:
name: Backport
runs-on: ubuntu-latest
# Only react to merged PRs for security reasons.
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: >
github.event.pull_request.merged
&& (
github.event.action == 'closed'
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport')
)
)
permissions:
contents: write
pull-requests: write
steps:
- name: GitHub App token
id: github_app_token
uses: tibdex/github-app-token@v1.5.0
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780

- name: Backport
uses: VachaShah/backport@v2.1.0
with:
github_token: ${{ steps.github_app_token.outputs.token }}
head_template: backport/backport-<%= number %>-to-<%= base %>
16 changes: 16 additions & 0 deletions .github/workflows/delete-backport-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Delete merged branch of the backport PRs
on:
pull_request:
types:
- closed

jobs:
delete-branch:
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref,'backport/')
steps:
- name: Delete merged branch
uses: SvanBoxel/delete-merged-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*.d.ts
node_modules
cdk.context.json
.DS_Store
lib/.DS_Store

# CDK asset staging directory
.cdk.staging
Expand Down
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [Required context parameters](#required-context-parameters)
- [Interacting with OpenSearch cluster](#interacting-with-opensearch-cluster)
- [Restricting Server Access](#restricting-server-access)
- [Enable Remote Store Feature](#enable-remote-store-feature)
- [Check Logs](#check-logs)
- [Access EC2 Instances](#access-ec2-instances)
- [Port Mapping](#port-mapping)
Expand Down Expand Up @@ -58,6 +59,7 @@ In order to deploy both the stacks the user needs to provide a set of required a
| account (Optional) | string | User provided aws account |
| dataNodeStorage (Optional) | string | User provided ebs block storage size, defaults to 100Gb |
| mlNodeStorage (Optional) | string | User provided ebs block storage size, defaults to 100Gb |

* Before starting this step, ensure that your AWS CLI is correctly configured with access credentials.
* Also ensure that you're running these commands in the current directory

Expand All @@ -71,7 +73,7 @@ npm install
* You need to provide all the required context parameters in the command

```
cdk bootstrap aws://<aws-account-number>/<aws-region> --context securityDisabled=true \
cdk bootstrap aws://<aws-account-number>/<aws-region> --context securityDisabled=false \
--context minDistribution=false --context distributionUrl='https://artifacts.opensearch.org/releases/bundle/opensearch/2.3.0/opensearch-2.3.0-linux-x64.tar.gz' \
--context cpuArch='x64' --context singleNodeCluster=false --context dataNodeCount=3 \
--context dashboardsUrl='https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.3.0/opensearch-dashboards-2.3.0-linux-x64.tar.gz' \
Expand All @@ -80,7 +82,7 @@ cdk bootstrap aws://<aws-account-number>/<aws-region> --context securityDisabled
* Now you are ready to synthesize the CloudFormation templates:

```
cdk synth "* " --context securityDisabled=true \
cdk synth "* " --context securityDisabled=false \
--context minDistribution=false --context distributionUrl='https://artifacts.opensearch.org/releases/bundle/opensearch/2.3.0/opensearch-2.3.0-linux-x64.tar.gz' \
--context cpuArch='x64' --context singleNodeCluster=false --context dataNodeCount=3 \
--context dashboardsUrl='https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.3.0/opensearch-dashboards-2.3.0-linux-x64.tar.gz' \
Expand All @@ -92,7 +94,7 @@ cdk synth "* " --context securityDisabled=true \
Please note that as of now we only support instances backed by Amazon Linux-2 amis.

```
cdk deploy "*" --context securityDisabled=true \
cdk deploy "*" --context securityDisabled=false \
--context minDistribution=false --context distributionUrl='https://artifacts.opensearch.org/releases/bundle/opensearch/2.3.0/opensearch-2.3.0-linux-x64.tar.gz' \
--context cpuArch='x64' --context singleNodeCluster=false --context dataNodeCount=3 \
--context dashboardsUrl='https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.3.0/opensearch-dashboards-2.3.0-linux-x64.tar.gz' \
Expand Down Expand Up @@ -124,6 +126,19 @@ Below values are allowed:
| prefixList | Prefix List id (eg: ab-12345) |
| securityGroupId | A security group ID (eg: sg-123456789) |

### Enable Remote Store Feature

`Remote Store` feature provides an option to store indexed data in a remote durable data store. To enable this feature the user needs to register a snapshot repository (S3 or File System) which is used to store the index data.
Apart from passing `enableRemoteStore` flag as `true` the user needs to be provide additional settings to `opensearch.yml`, the settings are:
```
1. opensearch.experimental.feature.remote_store.enabled: 'true'
2. cluster.remote_store.enabled: 'true'
3. opensearch.experimental.feature.segment_replication_experimental.enabled: 'true'
4. cluster.indices.replication.strategy: SEGMENT
```
The above-mentioned settings need to be passed using `additionalConfig` parameter.
Please note the `experimental` settings are only applicable till the feature is under development and will be removed when the feature becomes GA.

## Check logs

The opensearch logs are available in cloudwatch logs log-group `opensearchLogGroup/opensearch.log` in the same region your stack is deployed.
Expand Down
4 changes: 3 additions & 1 deletion bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import { App } from 'aws-cdk-lib';
import { OsClusterEntrypoint } from '../lib/os-cluster-entrypoint';

const app = new App();
const region = app.node.tryGetContext('region') ?? process.env.CDK_DEFAULT_REGION;
const account = app.node.tryGetContext('account') ?? process.env.CDK_DEFAULT_ACCOUNT;

new OsClusterEntrypoint(app, {
env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },
env: { account, region },
});
2 changes: 1 addition & 1 deletion lib/cloudwatch/cloudwatch-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ compatible open source license. */
import { InitFile, InitFileOptions } from 'aws-cdk-lib/aws-ec2';
import { CloudwatchAgentSection } from './agent-section';
import { CloudwatchLogsSection } from './logs-section';
import { CloudwatchMetricsSection } from "./metrics-section";
import { CloudwatchMetricsSection } from './metrics-section';

export interface CloudwatchAgentConfig {
agent: CloudwatchAgentSection,
Expand Down
Loading

0 comments on commit d1c064e

Please sign in to comment.