Skip to content

Commit

Permalink
Standardizing Files
Browse files Browse the repository at this point in the history
Signed-off-by: Aditya Jindal <[email protected]>
  • Loading branch information
Aditya Jindal committed Mar 28, 2022
1 parent bc4369a commit 0c4023f
Show file tree
Hide file tree
Showing 14 changed files with 160 additions and 114 deletions.
11 changes: 7 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
OpenSearch is a community project that is built and maintained by people just like **you**.
[This document](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md) explains how you can contribute to this and related projects.

# Contributing Guidelines

Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
Expand All @@ -21,7 +24,7 @@ reported the issue. Please try to include as much information as you can. Detail

## Developer Certificate of Origin

OpenSearch is an open source product released under the Apache 2.0 license (see either [the Apache site](https://www.apache.org/licenses/LICENSE-2.0) or the [LICENSE file](./LICENSE)). The Apache 2.0 license allows you to freely use, modify, distribute, and sell your own products that include Apache 2.0 licensed software.
OpenSearch is an open source product released under the Apache 2.0 license (see either [the Apache site](https://www.apache.org/licenses/LICENSE-2.0) or the [LICENSE file](./LICENSE.txt)). The Apache 2.0 license allows you to freely use, modify, distribute, and sell your own products that include Apache 2.0 licensed software.

We respect intellectual property rights of others and we want to make sure all incoming contributions are correctly attributed and licensed. A Developer Certificate of Origin (DCO) is a lightweight mechanism to do that.

Expand Down Expand Up @@ -80,8 +83,8 @@ To send us a pull request, please:
5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
GitHub provides additional document on [forking a repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and
[creating a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).


## Finding contributions to work on
Expand All @@ -100,6 +103,6 @@ If you discover a potential security issue in this project we ask that you notif

## Licensing

See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
See the [LICENSE](LICENSE.txt) file for our project's licensing. We will ask you to confirm the licensing of your contribution.

We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
125 changes: 125 additions & 0 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Notifications plugin for OpenSearch

## Overview
Notifications plugin for OpenSearch enables other plugins to send notifications via Email, Slack, Amazon Chime, Custom web-hook etc channels

## Highlights

1. Supports sending email with attachment (PDF, PNG, CSV, etc).
1. Supports sending multipart email with Text and HTML body with full Embedded HTML support.
1. Supports cross-plugin calls to send notifications (without re-implementing).
1. Supports tracking the number of email sent from this plugin and throttling based on it.

## Documentation

Please see our [documentation](https://opendistro.github.io/for-elasticsearch-docs/).

## Setup

1. Check out this package from version control.
1. Launch Intellij IDEA, choose **Import Project**, and select the `settings.gradle` file in the root of this package.
1. To build from the command line, set `JAVA_HOME` to point to a JDK >= 14 before running `./gradlew`.

### Setup email notification using localhost email relay/server

1. Run local email server on the machine where OpenSearch is running. e.g. for Mac, run command `sudo postfix start`
1. Verify that local email server does not require any authentication (Make sure server is listening on local port only)
1. Update the `notification.yml` configuration file according to your setup

### Setup Amazon SES and SDK

While using Amazon SES as email channel for sending mail, use below procedure for SES setup and configure environment.

1. [Setup Amazon SES account](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sign-up-for-aws.html)
1. [Verify Email address](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses-procedure.html)
1. [Create IAM role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-role-ec2) with [Allowing Access to Email-Sending Actions Only](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/control-user-access.html) `Action` required are `SendEmail` and `SendRawEmail`.
1. While using command line [configure AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) [Refer Best practices](https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html)
1. [Use Amazon EC2 IAM role to grant permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html) while using EC2

## Build

This project uses following tools

1. [Gradle](https://docs.gradle.org/current/userguide/userguide.html) build system. Gradle comes with an excellent documentation that should be your first stop when trying to figure out how to operate or modify the build.
1. OpenSearch build tools for Gradle. These tools are idiosyncratic and don't always follow the conventions and instructions for building regular Java code using Gradle. If you encounter such a situation, the OpenSearch build tools is your best bet for figuring out what's going on.

### Building from the command line

1. `./gradlew build` builds and tests project.
1. `./gradlew run` launches a single node cluster with the `notifications` plugin installed.
1. `./gradlew run -PnumNodes=3` launches a multi-node cluster (3 nodes) with the `notifications` plugin installed.
1. `./gradlew integTest` launches a single node cluster with the `notifications` plugin installed and runs all integ tests.
1. `./gradlew integTest -PnumNodes=3` launches a multi-node cluster with the `notifications` plugin installed and runs all integ tests.
1. `./gradlew integTest -Dtests.class="*RunnerIT"` runs a single integ test class
1. `./gradlew integTest -Dtests.method="test execute * with dryrun"` runs a single integ test method
(remember to quote the test method name if it contains spaces).

When launching a cluster using above commands, logs are placed in `notifications/build/testclusters/integTest-0/logs/`.

#### Run integration tests with Security enabled

1. Setup a local OpenSearch cluster with security plugin.
- `./gradlew build`
- `./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=opensearch-integrationtest -Dhttps=true -Duser=admin -Dpassword=admin`
- `./gradlew integTestRunner -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=opensearch-integrationtest -Dhttps=true -Duser=admin -Dpassword=admin --tests "<test name>"`

### Debugging

Sometimes it's useful to attach a debugger to either the OpenSearch cluster, or the integ tests to see what's going on. When running unit tests, hit **Debug** from the IDE's gutter to debug the tests.
You must start your debugger to listen for remote JVM before running the below commands.

To debug code running in an actual server, run:

```
./gradlew integTest -Dopensearch.debug # to start a cluster and run integ tests
```

OR

```
./gradlew run --debug-jvm # to just start a cluster that can be debugged
```

The OpenSearch server JVM will launch suspended and wait for a debugger to attach to `localhost:5005` before starting the OpenSearch server.
The IDE needs to listen for the remote JVM. If using Intellij you must set your debug-configuration to "Listen to remote JVM" and make sure "Auto Restart" is checked.
You must start your debugger to listen for remote JVM before running the commands.

To debug code running in an integ test (which exercises the server from a separate JVM), run:

```
./gradlew -Dtest.debug integTest
```

The test runner JVM will start suspended and wait for a debugger to attach to `localhost:5005` before running the tests.


### Advanced: Launching multi-node clusters locally

Sometimes you need to launch a cluster with more than one OpenSearch server process.

You can do this by running `./gradlew run -PnumNodes=<numberOfNodesYouWant>`

You can also run the integration tests against a multi-node cluster by running `./gradlew integTest -PnumNodes=<numberOfNodesYouWant>`

You can also debug a multi-node cluster, by using a combination of above multi-node and debug steps.
You must set up debugger configurations to listen on each port starting from `5005` and increasing by 1 for each node.

## Code of Conduct

See [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for more information.

## Security

See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.

## License

This project is licensed under the Apache-2.0 License. See [LICENSE](LICENSE.txt) for more information.

## Notice

See [NOTICE](NOTICE.txt) for more information.

## Copyright

Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details.
File renamed without changes.
2 changes: 0 additions & 2 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Notifications Maintainers

## Maintainers
| Maintainer | GitHub ID | Affiliation |
|------------------------|---------------------------------------------------|-------------|
Expand Down
File renamed without changes.
126 changes: 21 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,128 +1,44 @@
[![codecov](https://codecov.io/gh/opensearch-project/notifications/branch/develop/graph/badge.svg?token=NYBFN3EFE4)](https://codecov.io/gh/opensearch-project/notifications)
[![Chat](https://img.shields.io/badge/chat-on%20forums-blue)](https://discuss.opendistrocommunity.dev)
![PRs welcome!](https://img.shields.io/badge/PRs-welcome!-success)

<img src="https://opensearch.org/assets/brand/SVG/Logo/opensearch_logo_default.svg" height="64px"/>

# Notifications plugin for OpenSearch
- [OpenSearch Notifications](#opensearch-notifications)
- [Highlights](#highlights)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Security](#security)
- [License](#license)
- [Copyright](#copyright)

## Overview
Notifications plugin for OpenSearch enables other plugins to send notifications via Email, Slack, Amazon Chime, Custom web-hook etc channels

## Highlights

1. Supports sending email with attachment (PDF, PNG, CSV, etc).
1. Supports sending multipart email with Text and HTML body with full Embedded HTML support.
1. Supports cross-plugin calls to send notifications (without re-implementing).
1. Supports tracking the number of email sent from this plugin and throttling based on it.
# OpenSearch Notifications

## Documentation

Please see our [documentation](https://opendistro.github.io/for-elasticsearch-docs/).

## Setup

1. Check out this package from version control.
1. Launch Intellij IDEA, choose **Import Project**, and select the `settings.gradle` file in the root of this package.
1. To build from the command line, set `JAVA_HOME` to point to a JDK >= 14 before running `./gradlew`.

### Setup email notification using localhost email relay/server

1. Run local email server on the machine where OpenSearch is running. e.g. for Mac, run command `sudo postfix start`
1. Verify that local email server does not require any authentication (Make sure server is listening on local port only)
1. Update the `notification.yml` configuration file according to your setup

### Setup Amazon SES and SDK

While using Amazon SES as email channel for sending mail, use below procedure for SES setup and configure environment.

1. [Setup Amazon SES account](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sign-up-for-aws.html)
1. [Verify Email address](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses-procedure.html)
1. [Create IAM role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-role-ec2) with [Allowing Access to Email-Sending Actions Only](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/control-user-access.html) `Action` required are `SendEmail` and `SendRawEmail`.
1. While using command line [configure AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) [Refer Best practices](https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html)
1. [Use Amazon EC2 IAM role to grant permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html) while using EC2

## Build

This project uses following tools

1. [Gradle](https://docs.gradle.org/current/userguide/userguide.html) build system. Gradle comes with an excellent documentation that should be your first stop when trying to figure out how to operate or modify the build.
1. OpenSearch build tools for Gradle. These tools are idiosyncratic and don't always follow the conventions and instructions for building regular Java code using Gradle. If you encounter such a situation, the OpenSearch build tools is your best bet for figuring out what's going on.

### Building from the command line

1. `./gradlew build` builds and tests project.
1. `./gradlew run` launches a single node cluster with the `notifications` plugin installed.
1. `./gradlew run -PnumNodes=3` launches a multi-node cluster (3 nodes) with the `notifications` plugin installed.
1. `./gradlew integTest` launches a single node cluster with the `notifications` plugin installed and runs all integ tests.
1. `./gradlew integTest -PnumNodes=3` launches a multi-node cluster with the `notifications` plugin installed and runs all integ tests.
1. `./gradlew integTest -Dtests.class="*RunnerIT"` runs a single integ test class
1. `./gradlew integTest -Dtests.method="test execute * with dryrun"` runs a single integ test method
(remember to quote the test method name if it contains spaces).

When launching a cluster using above commands, logs are placed in `notifications/build/testclusters/integTest-0/logs/`.

#### Run integration tests with Security enabled
#### TODO: Create Documentation
Please see our [documentation](https://opensearch.org/docs/latest/).

1. Setup a local ODFE cluster with security plugin.
- `./gradlew build`
- `./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=opensearch-integrationtest -Dhttps=true -Duser=admin -Dpassword=admin`
- `./gradlew integTestRunner -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=opensearch-integrationtest -Dhttps=true -Duser=admin -Dpassword=admin --tests "<test name>"`
## Contributing

### Debugging

Sometimes it's useful to attach a debugger to either the OpenSearch cluster, or the integ tests to see what's going on. When running unit tests, hit **Debug** from the IDE's gutter to debug the tests.
You must start your debugger to listen for remote JVM before running the below commands.

To debug code running in an actual server, run:

```
./gradlew integTest -Dopensearch.debug # to start a cluster and run integ tests
```

OR

```
./gradlew run --debug-jvm # to just start a cluster that can be debugged
```

The OpenSearch server JVM will launch suspended and wait for a debugger to attach to `localhost:5005` before starting the OpenSearch server.
The IDE needs to listen for the remote JVM. If using Intellij you must set your debug-configuration to "Listen to remote JVM" and make sure "Auto Restart" is checked.
You must start your debugger to listen for remote JVM before running the commands.

To debug code running in an integ test (which exercises the server from a separate JVM), run:

```
./gradlew -Dtest.debug integTest
```

The test runner JVM will start suspended and wait for a debugger to attach to `localhost:5005` before running the tests.


### Advanced: Launching multi-node clusters locally

Sometimes you need to launch a cluster with more than one OpenSearch server process.

You can do this by running `./gradlew run -PnumNodes=<numberOfNodesYouWant>`

You can also run the integration tests against a multi-node cluster by running `./gradlew integTest -PnumNodes=<numberOfNodesYouWant>`

You can also debug a multi-node cluster, by using a combination of above multi-node and debug steps.
You must set up debugger configurations to listen on each port starting from `5005` and increasing by 1 for each node.
See [developer guide](DEVELOPER_GUIDE.md) and [how to contribute to this project](CONTRIBUTING.md).

## Code of Conduct

See [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for more information.
This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq), or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Security

See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public GitHub issue.

## License

This project is licensed under the Apache-2.0 License. See [LICENSE](LICENSE) for more information.
This project is licensed under the [Apache v2.0 License](LICENSE.txt).

## Notice
## Copyright

See [NOTICE](NOTICE) for more information.
Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.

## Copyright

Copyright OpenSearch Contributors. See [NOTICE](NOTICE) for details.
1 change: 1 addition & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project follows the [OpenSearch release process](https://github.com/opensearch-project/.github/blob/main/RELEASING.md).
3 changes: 3 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Reporting a Vulnerability

If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to [email protected]. Please do **not** create a public GitHub issue.
2 changes: 1 addition & 1 deletion dashboards-notifications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ This code is licensed under the Apache 2.0 License.

## Copyright

Copyright OpenSearch Contributors. See [NOTICE](../NOTICE) for details.
Copyright OpenSearch Contributors. See [NOTICE](../NOTICE.txt) for details.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions notifications/core-spi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ apply plugin: 'org.jetbrains.kotlin.plugin.allopen'

ext {
projectSubstitutions = [:]
licenseFile = rootProject.file('LICENSE')
noticeFile = rootProject.file('NOTICE')
licenseFile = rootProject.file('LICENSE.txt')
noticeFile = rootProject.file('NOTICE.txt')
}

task sourcesJar(type: Jar) {
Expand Down

0 comments on commit 0c4023f

Please sign in to comment.