forked from opensearch-project/alerting
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and add documentation files (opensearch-project#117)
Signed-off-by: Ashish Agrawal <[email protected]>
- Loading branch information
Showing
6 changed files
with
132 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,4 @@ | ||
# Contributing Guidelines | ||
|
||
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional | ||
documentation, we greatly value feedback and contributions from our community. | ||
|
||
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary | ||
information to effectively respond to your bug report or contribution. | ||
|
||
|
||
## Reporting Bugs/Feature Requests | ||
|
||
We welcome you to use the GitHub issue tracker to report bugs or suggest features. | ||
|
||
When filing an issue, please check [existing open](../../issues), or [recently closed](../../issues?q=is%3Aissue+is%3Aclosed), issues to make sure somebody else hasn't already | ||
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: | ||
|
||
* A reproducible test case or series of steps | ||
* The version of our code being used | ||
* Any modifications you've made relevant to the bug | ||
* Anything unusual about your environment or deployment | ||
|
||
|
||
## Contributing via Pull Requests | ||
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: | ||
|
||
1. You are working against the latest source on the *main* branch. | ||
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. | ||
3. You open an issue to discuss any significant work - we would hate for your time to be wasted. | ||
|
||
To send us a pull request, please: | ||
|
||
1. Fork the repository. | ||
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. | ||
3. Ensure local tests pass. | ||
4. Commit to your fork using clear commit messages. | ||
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/). | ||
|
||
|
||
## Finding contributions to work on | ||
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](../../labels/help%20wanted) issues is a great place to start. | ||
|
||
|
||
## Code of Conduct | ||
|
||
This project has adopted an [Open Source Code of Conduct](https://opendistro.github.io/for-elasticsearch/codeofconduct.html). | ||
|
||
|
||
## Security issue notifications | ||
|
||
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. | ||
|
||
## Developer Certificate of Origin | ||
|
||
OpenSearch Alerting 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. | ||
|
||
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. | ||
|
||
The DCO is a declaration attached to every contribution made by every developer. In the commit message of the contribution, the developer simply adds a `Signed-off-by` statement and thereby agrees to the DCO, which you can find below or at [DeveloperCertificate.org](http://developercertificate.org/). | ||
|
||
``` | ||
Developer's Certificate of Origin 1.1 | ||
By making a contribution to this project, I certify that: | ||
(a) The contribution was created in whole or in part by me and I | ||
have the right to submit it under the open source license | ||
indicated in the file; or | ||
(b) The contribution is based upon previous work that, to the | ||
best of my knowledge, is covered under an appropriate open | ||
source license and I have the right under that license to | ||
submit that work with modifications, whether created in whole | ||
or in part by me, under the same open source license (unless | ||
I am permitted to submit under a different license), as | ||
Indicated in the file; or | ||
(c) The contribution was provided directly to me by some other | ||
person who certified (a), (b) or (c) and I have not modified | ||
it. | ||
(d) I understand and agree that this project and the contribution | ||
are public and that a record of the contribution (including | ||
all personal information I submit with it, including my | ||
sign-off) is maintained indefinitely and may be redistributed | ||
consistent with this project or the open source license(s) | ||
involved. | ||
``` | ||
We require that every contribution to OpenSearch Alerting is signed with a Developer Certificate of Origin. Additionally, please use your real name. We do not accept anonymous contributors nor those utilizing pseudonyms. | ||
|
||
Each commit must include a DCO which looks like this | ||
|
||
``` | ||
Signed-off-by: Jane Smith <[email protected]> | ||
``` | ||
You may type this line on your own when writing your commit messages. However, if your user.name and user.email are set in your git configs, you can use `-s` or `– – signoff` to add the `Signed-off-by` line to the end of the commit message. | ||
|
||
## Licensing | ||
|
||
See the [LICENSE](./LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. | ||
## Contributing to this Project | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
- [Developer Guide](#developer-guide) | ||
- [Forking and Cloning](#forking-and-cloning) | ||
- [Install Prerequisites](#install-prerequisites) | ||
- [JDK 14](#jdk-14) | ||
- [Setup](#setup) | ||
- [Build](#build) | ||
- [Building from the command line](#building-from-the-command-line) | ||
- [Run integration tests with Security enabled](#run-integration-tests-with-security-enabled) | ||
- [Building from the IDE](#building-from-the-ide) | ||
- [Debugging](#debugging) | ||
- [Advanced: Launching multi node clusters locally](#advanced-launching-multi-node-clusters-locally) | ||
|
||
## Developer Guide | ||
|
||
### Forking and Cloning | ||
|
||
Fork this repository on GitHub, and clone locally with `git clone`. | ||
|
||
### Install Prerequisites | ||
|
||
#### JDK 14 | ||
|
||
OpenSearch components build using Java 14 at a minimum. This means you must have a JDK 14 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 14 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-14`. | ||
|
||
### Setup | ||
|
||
1. Clone the repository (see [Forking and Cloning](#forking-and-cloning)) | ||
2. Make sure `JAVA_HOME` is pointing to a Java 14 JDK (see [Install Prerequisites](#install-prerequisites)) | ||
3. Launch Intellij IDEA, Choose Import Project and select the settings.gradle file in the root of this package. | ||
|
||
### Build | ||
|
||
This package uses the [Gradle](https://docs.gradle.org/current/userguide/userguide.html) build system. Gradle comes with excellent documentation that should be your first stop when trying to figure out how to operate or modify the build. we also use the 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. Not everything in this package will work the way it's described in the Gradle documentation. If you encounter such a situation, the OpenSearch build tools [source code](https://github.com/opensearch-project/OpenSearch/tree/main/buildSrc/src/main/groovy/org/opensearch/gradle) is your best bet for figuring out what's going on. | ||
|
||
Currently we just put RCF jar in lib as dependency. Plan to publish to Maven and we can import it later. Before publishing to Maven, you can still build this package directly and find source code in RCF Github package. | ||
|
||
#### Building from the command line | ||
|
||
1. `./gradlew build` builds and tests all subprojects. | ||
2. `./gradlew :alerting:run` launches a single node cluster with the alerting plugin installed. | ||
3. `./gradlew :alerting:run -PnumNodes=3` launches a multi-node cluster with the alerting plugin installed. | ||
4. `./gradlew :alerting:integTest` launches a single node cluster with the alerting plugin installed and runs all integ tests. | ||
5. `./gradlew :alerting:integTest -PnumNodes=3` launches a multi-node cluster with the alerting plugin installed and runs all integ tests. | ||
6. `./gradlew :alerting:integTest -Dtests.class="*MonitorRunnerIT"` runs a single integ test class | ||
7. `./gradlew :alerting:integTest -Dtests.method="test execute monitor with dryrun"` runs a single integ test method | ||
(remember to quote the test method name if it contains spaces). | ||
|
||
When launching a cluster using one of the above commands, logs are placed in `alerting/build/testclusters/integTest-0/logs/`. Though the logs are teed to the console, in practices it's best to check the actual log file. | ||
|
||
#### Run integration tests with Security enabled | ||
|
||
1. Setup a local opensearch cluster with security plugin. | ||
|
||
- `./gradlew :alerting:integTestRunner -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=es-integrationtest -Dhttps=true -Dsecurity=true -Duser=admin -Dpassword=admin` | ||
|
||
- `./gradlew :alerting:integTestRunner -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=es-integrationtest -Dhttps=true -Dsecurity=true -Duser=admin -Dpassword=admin --tests "org.opensearch.alerting.MonitorRunnerIT.test execute monitor returns search result"` | ||
|
||
|
||
#### Building from the IDE | ||
|
||
Currently, the only IDE we support is IntelliJ IDEA. It's free, it's open source, it works. The gradle tasks above can also be launched from IntelliJ's Gradle toolbar and the extra parameters can be passed in via the Launch Configurations VM arguments. | ||
|
||
#### 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 :alerting:integTest -Dcluster.debug # to start a cluster and run integ tests | ||
``` | ||
|
||
OR | ||
|
||
``` | ||
./gradlew :alerting: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 :alerting:integTest -Dtest.debug | ||
``` | ||
|
||
The test runner JVM will start suspended and wait for a debugger to attach to `localhost:8000` before running the tests. | ||
|
||
Additionally, it is possible to attach one debugger to the cluster JVM and another debugger to the test runner. First, make sure one debugger is listening on port `5005` and the other is listening on port `8000`. Then, run: | ||
``` | ||
./gradlew :alerting:integTest -Dtest.debug -Dcluster.debug | ||
``` | ||
|
||
### 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 :alerting:run -PnumNodes=<numberOfNodesYouWant>` | ||
|
||
You can also run the integration tests against a multi-node cluster by running `./gradlew :alerting:integTest -PnumNodes=<numberOfNodesYouWant>` | ||
|
||
You can also debug a multi-node cluster, by using a combination of above multi-node and debug steps. | ||
But, you must set up debugger configurations to listen on each port starting from `5005` and increasing by 1 for each node. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.