Skip to content

Commit 23ff177

Browse files
authored
Install go, tools, and dependencies for Copilot (elastic#1209)
* Install go, tools, and dependencies for Copilot * Setup Terraform and ES Stack * Top level? * Nope * Fixup elastic-agent docker image
1 parent 5105462 commit 23ff177

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
jobs:
15+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
16+
copilot-setup-steps:
17+
runs-on: ubuntu-latest
18+
19+
# Set the permissions to the lowest permissions possible needed for your steps.
20+
# Copilot will be given its own token for its operations.
21+
permissions:
22+
# 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.
23+
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+
services:
35+
elasticsearch:
36+
image: docker.elastic.co/elasticsearch/elasticsearch:9.0.3
37+
env:
38+
discovery.type: single-node
39+
xpack.security.enabled: true
40+
xpack.security.authc.api_key.enabled: true
41+
xpack.security.authc.token.enabled: true
42+
xpack.watcher.enabled: true
43+
xpack.license.self_generated.type: trial
44+
repositories.url.allowed_urls: https://example.com/*
45+
path.repo: /tmp
46+
ELASTIC_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
47+
ports:
48+
- 9200:9200
49+
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
50+
kibana:
51+
image: docker.elastic.co/kibana/kibana:9.0.3
52+
env:
53+
SERVER_NAME: kibana
54+
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
55+
ELASTICSEARCH_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }}
56+
ELASTICSEARCH_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }}
57+
XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d
58+
# LOGGING_ROOT_LEVEL: debug
59+
ports:
60+
- 5601:5601
61+
options: --health-cmd="curl http://localhost:5601/api/status" --health-interval=10s --health-timeout=5s --health-retries=10
62+
fleet:
63+
image: docker.elastic.co/elastic-agent/elastic-agent:9.0.3
64+
env:
65+
SERVER_NAME: fleet
66+
FLEET_ENROLL: "1"
67+
FLEET_URL: https://fleet:8220
68+
FLEET_INSECURE: "true"
69+
FLEET_SERVER_ENABLE: "1"
70+
FLEET_SERVER_POLICY_ID: fleet-server
71+
FLEET_SERVER_ELASTICSEARCH_HOST: http://elasticsearch:9200
72+
FLEET_SERVER_ELASTICSEARCH_INSECURE: "true"
73+
FLEET_SERVER_INSECURE_HTTP: "true"
74+
KIBANA_HOST: http://kibana:5601
75+
KIBANA_FLEET_SETUP: "1"
76+
KIBANA_FLEET_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
77+
ports:
78+
- 8220:8220
79+
options: --restart="unless-stopped"
80+
81+
steps:
82+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
83+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
84+
with:
85+
go-version-file: 'go.mod'
86+
cache: true
87+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
88+
with:
89+
terraform_wrapper: false
90+
91+
- name: Get dependencies
92+
run: make setup
93+
94+
- name: Setup Kibana user
95+
run: make set-kibana-password
96+
env:
97+
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
98+
KIBANA_SYSTEM_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }}
99+
KIBANA_SYSTEM_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }}
100+
101+
- id: get-api-key
102+
name: Get ES API key
103+
run: |-
104+
echo "apikey=$(make create-es-api-key | jq -r .encoded)" >> "$GITHUB_OUTPUT"
105+
env:
106+
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
107+
108+
- id: setup-fleet
109+
name: Setup Fleet
110+
run: |-
111+
make setup-kibana-fleet
112+
env:
113+
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
114+
FLEET_NAME: "fleet"

0 commit comments

Comments
 (0)