Skip to content

Commit 3faae66

Browse files
committed
Setup Terraform and ES Stack
1 parent 9f7c282 commit 3faae66

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/copilot-setup-steps.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,95 @@ jobs:
2121
permissions:
2222
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
2323
contents: read
24+
env:
25+
ELASTICSEARCH_ENDPOINTS: "http://localhost:9200"
26+
ELASTICSEARCH_USERNAME: "elastic"
27+
ELASTICSEARCH_PASSWORD: password
28+
KIBANA_ENDPOINT: "http://localhost:5601"
29+
KIBANA_USERNAME: "elastic"
30+
KIBANA_PASSWORD: password
31+
KIBANA_SYSTEM_USERNAME: kibana_system
32+
KIBANA_SYSTEM_PASSWORD: password
33+
TF_ACC: "1"
34+
STACK_VERSION: 9.0.3
35+
services:
36+
elasticsearch:
37+
image: docker.elastic.co/elasticsearch/elasticsearch:${{ env.STACK_VERSION }}
38+
env:
39+
discovery.type: single-node
40+
xpack.security.enabled: true
41+
xpack.security.authc.api_key.enabled: true
42+
xpack.security.authc.token.enabled: true
43+
xpack.watcher.enabled: true
44+
xpack.license.self_generated.type: trial
45+
repositories.url.allowed_urls: https://example.com/*
46+
path.repo: /tmp
47+
ELASTIC_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
48+
ports:
49+
- 9200:9200
50+
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
51+
kibana:
52+
image: docker.elastic.co/kibana/kibana:${{ env.STACK_VERSION }}
53+
env:
54+
SERVER_NAME: kibana
55+
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
56+
ELASTICSEARCH_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }}
57+
ELASTICSEARCH_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }}
58+
XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d
59+
# LOGGING_ROOT_LEVEL: debug
60+
ports:
61+
- 5601:5601
62+
options: --health-cmd="curl http://localhost:5601/api/status" --health-interval=10s --health-timeout=5s --health-retries=10
63+
fleet:
64+
image: docker.elastic.co/beats/elastic-agent:${{ env.STACK_VERSION }}
65+
env:
66+
SERVER_NAME: fleet
67+
FLEET_ENROLL: "1"
68+
FLEET_URL: https://fleet:8220
69+
FLEET_INSECURE: "true"
70+
FLEET_SERVER_ENABLE: "1"
71+
FLEET_SERVER_POLICY_ID: fleet-server
72+
FLEET_SERVER_ELASTICSEARCH_HOST: http://elasticsearch:9200
73+
FLEET_SERVER_ELASTICSEARCH_INSECURE: "true"
74+
FLEET_SERVER_INSECURE_HTTP: "true"
75+
KIBANA_HOST: http://kibana:5601
76+
KIBANA_FLEET_SETUP: "1"
77+
KIBANA_FLEET_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
78+
ports:
79+
- 8220:8220
80+
options: --restart="unless-stopped"
2481

2582
steps:
2683
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
2784
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
2885
with:
2986
go-version-file: 'go.mod'
3087
cache: true
88+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
89+
with:
90+
terraform_wrapper: false
3191

3292
- name: Get dependencies
3393
run: make setup
94+
95+
- name: Setup Kibana user
96+
run: make set-kibana-password
97+
env:
98+
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
99+
KIBANA_SYSTEM_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }}
100+
KIBANA_SYSTEM_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }}
101+
102+
- id: get-api-key
103+
name: Get ES API key
104+
run: |-
105+
echo "apikey=$(make create-es-api-key | jq -r .encoded)" >> "$GITHUB_OUTPUT"
106+
env:
107+
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
108+
109+
- id: setup-fleet
110+
name: Setup Fleet
111+
run: |-
112+
make setup-kibana-fleet
113+
env:
114+
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
115+
FLEET_NAME: "fleet"

0 commit comments

Comments
 (0)