Local development installation (quickstart)¶
- https://[ hostname ]/docs/deploy-manage/deploy/self-managed/local-development-installation-quickstart
I extracted the relevant compose stuff from this script
# [ hostname ]
services:
# --- elasticsearch
elasticsearch:
image: elastic/elasticsearch:9.1.5
container_name: elasticsearch
ports:
- [ ip_address ]:9200:9200
environment:
- [ hostname ]=single-node
- [ hostname ]=elasticsearch
- ELASTIC_PASSWORD=password
- [ hostname ]=true
- [ hostname ]=false
- [ hostname ].self_generated.type=trial
- [ hostname ].use_auto_machine_memory_percent=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- elasticsearch:/usr/share/elasticsearch/data
healthcheck:
test: ["CMD-SHELL", "curl --output /dev/null --silent --head --fail -u elastic:password http://elasticsearch:9200"]
interval: 10s
timeout: 10s
retries: 30
ulimits:
memlock:
soft: -1
hard: -1
networks:
logging-net:
kibana:
image: elastic/kibana:9.1.5
container_name: kibana
depends_on:
elasticsearch:
condition: service_healthy
ports:
- [ ip_address ]:5601:5601
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
- ELASTICSEARCH_USERNAME=kibana_system
- ELASTICSEARCH_PASSWORD=[ kibana_system_password ]
- SERVER_PUBLICBASEURL=http://[ ip_address ]:5601
- SERVER_ENCRYPTIONKEY=[ encryption_key ]
- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=[ encryption_key ]
- XPACK_REPORTING_ENCRYPTIONKEY=[ encryption_key ]
- XPACK_SECURITY_ENCRYPTIONKEY=[ encryption_key ]
healthcheck:
test: ["CMD-SHELL", "curl --output /dev/null --silent --head --fail http://localhost:5601/login"]
interval: 10s
timeout: 10s
retries: 60
networks:
logging-net:
kibana_settings:
depends_on:
elasticsearch:
condition: service_healthy
image: elastic/elasticsearch:9.1.5
container_name: kibana-local
restart: "no"
command: >
bash -c '
echo "Setting up kibana_system password";
start_time=$$(date +%s);
timeout=60;
until curl -s -u elastic:password -X POST http://elasticsearch:9200/_security/user/kibana_system/_password
-H "Content-Type: application/json"
-d "{\"password\": \"password\"}" | grep -q "{}"; do
elapsed_time=$$(($$(date +%s) - start_time));
if [ "$$elapsed_time" -ge "$$timeout" ]; then
echo "Error: Kibana system password setup timeout.";
exit 1;
fi;
sleep 2;
done;
echo "Kibana system password setup completed.";
'
networks:
logging-net:
# --- logstash
logstash:
image: elastic/logstash:9.1.5
container_name: logstash
volumes:
- ./[ hostname ]:/usr/share/logstash/pipeline/[ hostname ]:ro
ports:
- "5044:5044" # Beats (Filebeat)
- "5514:5514/udp" # Syslog (OPNsense)
- "5514:5514/tcp" # optional TCP syslog
environment:
- ELASTICSEARCH_HOST=elasticsearch:9200
networks:
- logging-net
# --- filebeat
filebeat:
image: elastic/filebeat:9.1.5
container_name: filebeat
user: root # needed to access /var/lib/containers or /var/lib/docker
restart: unless-stopped
# Mount host and container runtime logs
volumes:
# Filebeat config
- ./[ hostname ]:/usr/share/filebeat/[ hostname ]:ro
# Container logs (Docker or Podman)
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/log:/var/log:ro
- /var/run/[ hostname ]:/var/run/[ hostname ]:ro
# Optional: Send output to stdout instead of Elasticsearch
command: [
"filebeat",
"-e", # log to stderr
"--[ hostname ]=false",
"-c",
"/usr/share/filebeat/[ hostname ]"
]
networks:
- logging-net
networks:
logging-net:
volumes:
elasticsearch:
driver: local
Generate the encryption key¶
Used for these variables
- SERVER_ENCRYPTIONKEY=[ encryption_key ]
- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=[ encryption_key ]
- XPACK_REPORTING_ENCRYPTIONKEY=[ encryption_key ]
- XPACK_SECURITY_ENCRYPTIONKEY=[ encryption_key ]
openssl rand -hex 16
Reset the kibana_system user password¶
docker exec -it elasticsearch bin/elasticsearch-reset-password -u kibana_system