mirror of
https://github.com/deviantony/docker-elk.git
synced 2025-12-27 16:20:20 +01:00
Prevents the occasional connection timeout when the tool randomly picks the IP of the ingress interface (usually 10.0.0.x/24) instead of the elk interface (usually 10.0.1.x/24) in Swarm mode.
29 lines
756 B
Plaintext
Executable File
29 lines
756 B
Plaintext
Executable File
#!/usr/bin/expect -f
|
|
|
|
# List of expected users with dummy password
|
|
set user "(elastic|apm_system|kibana_system|logstash_system|beats_system|remote_monitoring_user)"
|
|
set password "testpasswd"
|
|
|
|
# Find elasticsearch container id
|
|
set MODE [lindex $argv 0]
|
|
if { [string match "swarm" $MODE] } {
|
|
set cid [exec docker ps -q -f label=com.docker.swarm.service.name=elk_elasticsearch]
|
|
} else {
|
|
set cid [exec docker ps -q -f label=com.docker.compose.service=elasticsearch]
|
|
}
|
|
|
|
set cmd "docker exec -it $cid bin/elasticsearch-setup-passwords interactive -s -b -u http://localhost:9200"
|
|
|
|
spawn {*}$cmd
|
|
|
|
expect {
|
|
-re "(E|Ree)nter password for \\\[$user\\\]: " {
|
|
send "$password\r"
|
|
exp_continue
|
|
}
|
|
eof
|
|
}
|
|
|
|
lassign [wait] pid spawnid os_error_flag value
|
|
exit $value
|