Skip to content

Commit

Permalink
update sanity workflow docs (elastic#1071)
Browse files Browse the repository at this point in the history
  • Loading branch information
gurevichdmitry authored Jun 22, 2023
1 parent 33473ae commit 26fb31b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 33 deletions.
30 changes: 28 additions & 2 deletions deploy/test-environments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ To generate an Elastic Cloud token, you have two options:

Choose the method that is most convenient for you to obtain the Elastic Cloud token required for deployment.


Ensure that the following AWS credentials are defined:

- `AWS_ACCESS_KEY_ID`: Your AWS access key ID.
- `AWS_SECRET_ACCESS_KEY`: Your AWS secret access key.


To successfully deploy the environment, ensure that the following variables are provided as deployment parameters or exported as environment variables:

```bash
Expand All @@ -44,7 +51,7 @@ Please note that the customized image is currently available in the following re

| Variable | Default Value | Comment |
|:-------------:|:-------------:|:------------|
| region | eu-west-3 | AWS EC2 deployment region |
| region | eu-west-1 | AWS EC2 deployment region |



Expand Down Expand Up @@ -72,7 +79,7 @@ terraform init
- Deploy test environment

```bash
terraform apply --auto-approve
terraform apply --auto-approve -var="deployment_name=dev-env"
```

For development purposes, it is possible to deploy each module separately, allowing for focused and independent development and testing. Each module within the project represents a specific component or functionality and can be deployed individually to streamline the development process.
Expand Down Expand Up @@ -101,4 +108,23 @@ terraform apply --auto-approve -target "module.ec_deployment"

```bash
terraform apply --auto-approve -target "module.eks"
```

## Environment Cleanup

To destroy local environment use

``` bash
terraform destroy -var="region=eu-west-1"
```


To destroy the environment provisioned using the Sanity job, follow these steps:

1. [Download](https://s3.console.aws.amazon.com/s3/buckets/tf-state-bucket-test-infra?region=eu-west-3&tab=objects) the Terraform state file to the [test-environments](../test-environments/) folder.
2. Rename the state file, for example, `terraform-sanity.tfstate`.
3. Run the following command:

``` bash
terraform destroy -var="region=eu-west-1" -state terraform-sanity.tfstate
```
56 changes: 25 additions & 31 deletions dev-docs/sanity-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,91 +6,85 @@ This GitHub workflow deploys the environment, saves state and data, performs san

To run the workflow, perform the following steps:

1. Click on the "Actions" tab in Cloudbeat repository.
1. Click on the `Actions` tab in [Cloudbeat](https://github.com/elastic/cloudbeat) repository.

![image](https://github.com/elastic/cloudbeat/assets/99176494/2686668f-7be6-4b55-a37b-e37426c1a0e1)

2. Select the "Sanity Tests" workflow.
1. Select the `Sanity Tests` workflow. If the workflow is not visible, click on `Show more workflows...` link

![image](https://github.com/elastic/cloudbeat/assets/99176494/f2e8ce8f-11f5-483d-b067-b24db3f58114)

3. Click on the "Run workflow" button.
3. Click on the `Run workflow` button.

![image](https://github.com/elastic/cloudbeat/assets/99176494/115fdd53-cff7-406a-bc3d-d65d5199389f)

4. Fill in the required inputs: `deployment_name`, `ec-api-key`, `elk-stack-version`, `ess-region`.

- `deployment_name` (required): Name your environment (Only a-zA-Z0-9 and `-`). For example: `john-8-7-2-June01`.

- `ec-api-key` (required): Elastic Cloud API KEY. Follow the [Cloud API Keys](https://www.elastic.co/guide/en/cloud/current/ec-api-authentication.html) documentation for step-by-step instructions on generating the token.

- `elk-stack-version` (required): The version of Elastic Cloud stack, either a SNAPSHOT or a build candidate (BC) version. The default value is `8.7.2-SNAPSHOT`. You can find the available versions [here](https://artifacts-staging.elastic.co/dra-info/index.html).

- `ess-region` (required): Elastic Cloud deployment region. By default, use the value `gcp-us-west2`, which includes snapshot versions and build candidate (BC) versions. Only specify a different region if there are specific requirements.


![image](https://github.com/elastic/cloudbeat/assets/99176494/06d8144d-13cc-4e13-92fc-19f52ce8206b)

5. Optionally, adjust the other input values as needed.

- `docker-image-override` (optional): To override the default Docker image for build candidate (BC) versions, provide the full image path. For snapshot versions, leave this field empty. The image path should follow this format: `docker.elastic.co/cloud-release/elastic-agent-cloud:8.8.1-9ac7eb02`, where `8.8.1-9ac7eb02` should be replaced with the latest build candidate version.

- `cleanup-env` (optional): Boolean value to indicate if resources should be cleaned up after provision. Default: `false`.

![image](https://github.com/elastic/cloudbeat/assets/99176494/bac5004d-7cbc-4a34-8127-3acd11acc90e)

6. Click on the "Run workflow
6. Click on the `Run workflow`

![image](https://github.com/elastic/cloudbeat/assets/99176494/5e5131ba-264e-4444-8879-aa612d5de778)


### To track the execution of the Sanity flow, follow these steps:

1. Click on the "Sanity tests" to access its details.
1. Click on the `Sanity tests` to access its details.

![image](https://github.com/elastic/cloudbeat/assets/99176494/abe8182d-4229-41bd-8604-ed5202d23574)


2. Click on "Deploy"
2. Click on `Deploy`

![image](https://github.com/elastic/cloudbeat/assets/99176494/230743cf-02ff-40cb-9069-d747b460824c)

3. Once the flow execution is complete, click on the "Summary" button to get the summary report.
3. Once the flow execution is complete, click on the `Summary` button to get the summary report.

![image](https://github.com/elastic/cloudbeat/assets/99176494/7751d919-1605-4d07-9cfd-c98336051e3d)

4. Review Summary details

![image](https://github.com/elastic/cloudbeat/assets/99176494/1b41fba0-0ee5-4d37-b2f8-cdd6f632eadc)


### Environment Login Instructions

To log in to the created environment, please follow these steps:

1. Click on the kibana link.
1. Click on the `kibana` link.

![image](https://github.com/elastic/cloudbeat/assets/99176494/500351cf-6029-4bd5-bc6f-e6e046fbb73d)

2. Select the "Login with Elastic Cloud" option.
2. Select the `Login with Elastic Cloud` option.

![image](https://github.com/elastic/cloudbeat/assets/99176494/c3c1521e-e997-43ce-af76-b00aa0fa353a)

3. Choose the "Google" authentication method.
3. Choose the `Google` authentication method.

![image](https://github.com/elastic/cloudbeat/assets/99176494/f5209ed8-3bd7-420e-a3d1-cffb4c3711c9)

4. On the Elastic Cloud dashboard, click on "Open" next to the provisioned environment.
4. On the Elastic Cloud dashboard, click on `Open` next to the provisioned environment.

![image](https://github.com/elastic/cloudbeat/assets/99176494/b2bcf5f3-d463-4d2c-8073-8ef9183c9ada)


## Inputs

- `deployment_name` (required): Name your environment (Only a-zA-Z0-9 and `-`). For example: `john-8-7-2-June01`.
- `ec-api-key` (required): Elastic Cloud API KEY.
- `elk-stack-version` (required): Elastic Cloud stack SNAPSHOT or BC version. Default: `8.7.2-SNAPSHOT`.
- `ess-region` (required): Elastic Cloud deployment region. Default: `gcp-us-west2`.
- `docker-image-override` (optional): Provide the full Docker image path to override the default image (BC versions only).
- `cleanup-env` (optional): Boolean value to indicate if resources should be cleaned up after provision. Default: `false`.

## Environment Variables

The following environment variables are required:

- `AWS_ACCESS_KEY_ID`: Your AWS access key ID.
- `AWS_SECRET_ACCESS_KEY`: Your AWS secret access key.
- `AWS_REGION`: The AWS region (e.g., `eu-west-1`).
- `TF_VAR_ec_api_key`: Your Elastic Cloud API key.
- `WORKING_DIR`: The working directory for the deployment.
- `FLEET_API_DIR`: The directory for the Fleet API.

## Cleanup

If you want to destroy the provisioned infrastructure, set the `cleanup-env` input to `true` when running the workflow. The cleanup step will be executed at the end.

0 comments on commit 26fb31b

Please sign in to comment.