-
Notifications
You must be signed in to change notification settings - Fork 54
Weekly environment - Vanilla POC #746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
aa43057
8163f42
212965d
061b309
4bb7688
050aeb7
d6b9978
b06001e
e615ee6
cf80da8
bfc4c0a
4c18e6d
5a78456
e3ad992
fc81e64
18fd270
7c324e6
bfe4eb3
f781ffb
2b6346a
6c18d50
48050c6
2e63a33
ae06992
52b55ac
9adc67c
a14ad1d
1006b22
d0b9bc7
d71688f
4ab1da7
e821839
93ef663
1c0e323
b4ebb27
7c85402
8f99aee
7987fcc
fa40cdf
8e5e4ae
af3a2a5
39e9f59
394bb47
0ce7e07
6674a35
c94464f
3d784c1
52e28a1
cef93c4
9b0896e
fcf35f2
15ef7ad
bdf3bdc
f70e055
5ae401a
c35f22e
18d7eb3
b940661
f1ec376
5181f79
65e6f67
9127534
72f8423
8aef1c1
b8c2ef2
6de42c4
ebfc4d8
0d09ab8
5335de3
b31d585
4067dcd
2a846af
ea9e924
441c80d
e93adcd
02019bb
090edfa
727477b
3bfe72c
3ba1564
427bea3
e93b6a5
e3f5ec6
590c2c5
b55ce48
850dee5
0008f61
2f09957
3e5a3da
a4170e8
fe66278
a2efb02
dfe71ea
ed4ea56
008f3e3
74c9a40
592bfd1
819615d
b727e5d
d02a1ba
65a8a33
0426cd7
2c64595
e726da8
7694167
2f337e7
b46b90e
eab79a4
8a18f5c
fac6d42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| name: Weekly environment deployment | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| environment: | ||
| description: 'Environment to deploy' | ||
| type: choice | ||
| options: | ||
| - weekly environment | ||
| logLevel: | ||
| description: 'Log level' | ||
| required: true | ||
| default: 'INFO' | ||
| type: choice | ||
| options: | ||
| - TRACE | ||
| - DEBUG | ||
| - INFO | ||
| - WARN | ||
| - ERROR | ||
|
|
||
| env: | ||
| WORKING_DIR: deploy/weekly-environment | ||
| SCRIPTS_DIR: deploy/weekly-environment/scripts/benchmarks/kspm_vanilla | ||
| TF_VAR_ec_api_key: ${{ secrets.WEEKLY_ENVIRONMENT_EC_API_KEY }} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Who is the user behind this key?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently its my user, we have two tickets related:
|
||
| TF_VAR_environment: ${{ github.event.inputs.logLevel }} | ||
| TF_LOG: ${{ github.event.inputs.logLevel }} | ||
| TF_VAR_stack_version: 8.6.1 | ||
|
|
||
| jobs: | ||
| terraform: | ||
| name: Deploy KSPM cloud environment | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ${{ env.WORKING_DIR }} | ||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Init Hermit | ||
| run: ./bin/hermit env -r >> $GITHUB_ENV | ||
| working-directory: ./ | ||
|
|
||
| - name: Terraform Init | ||
| run: terraform init -no-color | ||
|
|
||
| - name: Terraform Validate | ||
| run: terraform validate -no-color | ||
|
|
||
| - name: Deploy Elastic Cloud | ||
| run: terraform apply --auto-approve | ||
|
|
||
| - name: Set terraform output as env variable | ||
| run: | | ||
| echo "KIBANA_URL=$(terraform output kibana_url)" >> $GITHUB_ENV | ||
|
|
||
| - name: Set sensitive terraform output as env variable | ||
| run: | | ||
| export ELASTICSEARCH_USERNAME=$(terraform output elasticsearch_username) | ||
| echo "::add-mask::$ELASTICSEARCH_USERNAME" | ||
| echo "ELASTICSEARCH_USERNAME=$ELASTICSEARCH_USERNAME" >> $GITHUB_ENV | ||
|
|
||
| export ELASTICSEARCH_PASSWORD=$(terraform output elasticsearch_password) | ||
| echo "::add-mask::$ELASTICSEARCH_PASSWORD" | ||
| echo "ELASTICSEARCH_PASSWORD=$ELASTICSEARCH_PASSWORD" >> $GITHUB_ENV | ||
|
|
||
| - name: Install KSPM vanilla integration | ||
| working-directory: ${{ env.SCRIPTS_DIR }} | ||
| run: | | ||
| ./install-kspm-vanilla-integration.sh ${{ env.KIBANA_URL }} ${{ env.ELASTICSEARCH_PASSWORD }} | ||
|
|
||
| - name: Deploy agent on EC2 | ||
| working-directory: ${{ env.SCRIPTS_DIR }} | ||
| run: | | ||
| echo -e "${{ secrets.WEEKLY_ENVIRONMENT_EC2_PRIVATE_KEY }}" > weekly-key.pem | ||
| chmod 600 weekly-key.pem | ||
| # Copy the manifest file to the EC2 instance | ||
| scp -o StrictHostKeyChecking=no -v -i weekly-key.pem manifest.yaml "ubuntu@${{ secrets.WEEKLY_ENVIRONMENT_EC2_PUBLIC_IP }}:~/." | ||
| # Apply the manifest file | ||
| ssh -o StrictHostKeyChecking=no -v -i weekly-key.pem "ubuntu@${{ secrets.WEEKLY_ENVIRONMENT_EC2_PUBLIC_IP }}" "kubectl apply -f manifest.yaml" | ||
|
|
||
| # Once https://github.com/slackapi/slack-github-action/issues/84 will be resolved we can push the payload to a different file | ||
| - name: Send custom JSON data to Slack workflow | ||
| uses: slackapi/slack-github-action@v1.23.0 | ||
| with: | ||
| payload: | | ||
| { | ||
| "text": "A new deployment job has been triggered", | ||
| "attachments": [ | ||
| { | ||
| "color": "#36a64f", | ||
| "fields": [ | ||
| { | ||
| "title": "Environment", | ||
| "value": "${{ github.event.inputs.environment }}", | ||
| "short": true | ||
| }, | ||
| { | ||
| "title": "Log level", | ||
| "value": "${{ github.event.inputs.logLevel }}", | ||
| "short": true | ||
| }, | ||
| { | ||
| "title": "Kibana URL", | ||
| "value": ${{ env.KIBANA_URL }}, | ||
| "short": false | ||
| }, | ||
| { | ||
| "title": "ElasticSearch username", | ||
| "value": ${{ env.ELASTICSEARCH_USERNAME }}, | ||
| "short": false | ||
| }, | ||
| { | ||
| "title": "ElasticSearch password", | ||
| "value": ${{ env.ELASTICSEARCH_PASSWORD }}, | ||
| "short": false | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| resource "helm_release" "nginx_ingress" { | ||
| chart = "nginx-ingress-controller" | ||
| name = "nginx-ingress-controller" | ||
| chart = "nginx-ingress-controller" | ||
| name = "nginx-ingress-controller" | ||
|
|
||
| repository = "https://charts.bitnami.com/bitnami" | ||
| timeout = 600 | ||
| namespace = var.namespace | ||
| timeout = 600 | ||
| namespace = var.namespace | ||
|
|
||
| set { | ||
| name = "service.type" | ||
| value = "ClusterIP" | ||
| } | ||
|
|
||
| set { | ||
| name = "replicaCount" | ||
| name = "replicaCount" | ||
| value = var.replica_count | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| variable "namespace" { | ||
| type = string | ||
| type = string | ||
| default = "default" | ||
| } | ||
|
|
||
| variable "replica_count" { | ||
| type = string | ||
| type = string | ||
| default = "2" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| provider "ec" { | ||
| apikey = var.ec_api_key | ||
| } | ||
|
|
||
| module "ec_deployment" { | ||
| source = "github.com/elastic/apm-server/testing/infra/terraform/modules/ec_deployment" | ||
|
|
||
| region = var.ess_region | ||
| stack_version = var.stack_version | ||
|
|
||
| deployment_template = var.deployment_template | ||
| deployment_name_prefix = "${var.deployment_name_prefix}-${formatdate("MMM DD, YYYY", timestamp())}" | ||
|
|
||
| integrations_server = true | ||
|
|
||
| elasticsearch_size = var.elasticsearch_size | ||
| elasticsearch_zone_count = var.elasticsearch_zone_count | ||
|
|
||
| docker_image = var.docker_image_override | ||
| docker_image_tag_override = { | ||
| "elasticsearch" : "", | ||
| "kibana" : "", | ||
| "apm" : "" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| output "elasticsearch_url" { | ||
| value = module.ec_deployment.elasticsearch_url | ||
| description = "The secure Elasticsearch URL" | ||
| } | ||
|
|
||
| output "elasticsearch_username" { | ||
| value = module.ec_deployment.elasticsearch_username | ||
| description = "The Elasticsearch username" | ||
| sensitive = true | ||
| } | ||
|
|
||
| output "elasticsearch_password" { | ||
| value = module.ec_deployment.elasticsearch_password | ||
| description = "The Elasticsearch password" | ||
| sensitive = true | ||
| } | ||
|
|
||
| output "kibana_url" { | ||
| value = module.ec_deployment.kibana_url | ||
| description = "The secure Kibana URL" | ||
| } | ||
|
|
||
| output "admin_console_url" { | ||
| value = module.ec_deployment.admin_console_url | ||
| description = "The admin console URL" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "weekly-environment-vanilla-policy", | ||
| "namespace": "default", | ||
| "monitoring_enabled": [ | ||
| "logs", | ||
| "metrics" | ||
| ] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets have it atm only on the weekly env dir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind changing it, but why we wouldn't want it to run on the entire solution?
The CI passes, and it will keep all the terraform in format.