Skip to content

Commit 697c333

Browse files
committed
feat: add simple auth to elasticsearch example
1 parent db06835 commit 697c333

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

example/simple/docker-compose.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
POSTGRES_DB: "es_cdc_db"
1111
POSTGRES_HOST_AUTH_METHOD: trust
1212
network_mode: "host"
13+
1314
es01:
1415
image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
1516
labels:
@@ -26,7 +27,7 @@ services:
2627
- discovery.type=single-node
2728
- ELASTIC_PASSWORD=es_cdc_es_pass
2829
- bootstrap.memory_lock=true
29-
- xpack.security.enabled=false
30+
- xpack.security.enabled=true
3031
- xpack.security.http.ssl.enabled=false
3132
- xpack.security.transport.ssl.enabled=false
3233
ulimits:
@@ -37,11 +38,12 @@ services:
3738
test:
3839
[
3940
"CMD-SHELL",
40-
"curl -I -o /dev/null http://localhost:9200 -w '%{http_code}' | grep -q '200'",
41+
"curl -u elastic:es_cdc_es_pass -I -o /dev/null http://localhost:9200 -w '%{http_code}' | grep -q '200'",
4142
]
4243
interval: 10s
4344
timeout: 10s
4445
retries: 120
46+
4547
kibana:
4648
depends_on:
4749
es01:
@@ -58,8 +60,8 @@ services:
5860
environment:
5961
- SERVERNAME=kibana
6062
- ELASTICSEARCH_HOSTS=http://es01:9200
61-
- ELASTICSEARCH_USERNAME=kibana_system
62-
- ELASTICSEARCH_PASSWORD=cdc_pass
63+
- ELASTICSEARCH_USERNAME=elastic
64+
- ELASTICSEARCH_PASSWORD=es_cdc_es_pass
6365
healthcheck:
6466
test:
6567
[
@@ -74,6 +76,7 @@ volumes:
7476
postgres_data: null
7577
kibana1_data: null
7678
es01_data: null
79+
7780
networks:
7881
cdc_net:
79-
driver: bridge
82+
driver: bridge

example/simple/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ func main() {
8383
},
8484
},
8585
Elasticsearch: config.Elasticsearch{
86+
Username: "elastic",
87+
Password: "es_cdc_es_pass",
8688
BatchSizeLimit: 10000,
8789
BatchTickerDuration: time.Millisecond * 100,
8890
TableIndexMapping: map[string]string{

0 commit comments

Comments
 (0)