fix: sync docker-compose.yml es init to docker-compose-debug.yml (#627)

This commit is contained in:
wuxingzhong 2025-08-07 11:17:57 +08:00 committed by GitHub
parent 45e5b6ed26
commit c3e0e7045a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 4 deletions

View File

@ -28,7 +28,7 @@ fe:
@echo "Building frontend..." @echo "Building frontend..."
@bash $(BUILD_FE_SCRIPT) @bash $(BUILD_FE_SCRIPT)
server: env setup_es_index server: env
@if [ ! -d "$(STATIC_DIR)" ]; then \ @if [ ! -d "$(STATIC_DIR)" ]; then \
echo "Static directory '$(STATIC_DIR)' not found, building frontend..."; \ echo "Static directory '$(STATIC_DIR)' not found, building frontend..."; \
$(MAKE) fe; \ $(MAKE) fe; \

View File

@ -200,11 +200,13 @@ services:
- ./data/bitnami/elasticsearch:/bitnami/elasticsearch/data - ./data/bitnami/elasticsearch:/bitnami/elasticsearch/data
- ./volumes/elasticsearch/elasticsearch.yml:/opt/bitnami/elasticsearch/config/my_elasticsearch.yml - ./volumes/elasticsearch/elasticsearch.yml:/opt/bitnami/elasticsearch/config/my_elasticsearch.yml
- ./volumes/elasticsearch/analysis-smartcn.zip:/opt/bitnami/elasticsearch/analysis-smartcn.zip:rw,Z - ./volumes/elasticsearch/analysis-smartcn.zip:/opt/bitnami/elasticsearch/analysis-smartcn.zip:rw,Z
- ./volumes/elasticsearch/setup_es.sh:/setup_es.sh
- ./volumes/elasticsearch/es_index_schema:/es_index_schemas
healthcheck: healthcheck:
test: test:
[ [
'CMD-SHELL', 'CMD-SHELL',
'curl -f http://localhost:9200 && [ -f /tmp/es_plugins_ready ]', 'curl -f http://localhost:9200 && [ -f /tmp/es_plugins_ready ] && [ -f /tmp/es_init_complete ]',
] ]
interval: 5s interval: 5s
timeout: 10s timeout: 10s
@ -212,7 +214,7 @@ services:
start_period: 10s start_period: 10s
networks: networks:
- coze-network - coze-network
# Install smartcn analyzer plugin # Install smartcn analyzer plugin and initialize ES
command: > command: >
bash -c " bash -c "
/opt/bitnami/scripts/elasticsearch/setup.sh /opt/bitnami/scripts/elasticsearch/setup.sh
@ -244,9 +246,27 @@ services:
touch /tmp/es_plugins_ready; touch /tmp/es_plugins_ready;
echo 'Plugin installation successful, marker file created'; echo 'Plugin installation successful, marker file created';
# Start initialization script in background
(
echo 'Waiting for Elasticsearch to be ready...'
until curl -s -f http://localhost:9200/_cat/health >/dev/null 2>&1; do
echo 'Elasticsearch not ready, waiting...'
sleep 2
done
echo 'Elasticsearch is ready!'
# Run ES initialization script
echo 'Running Elasticsearch initialization...'
sed 's/\r$$//' /setup_es.sh > /setup_es_fixed.sh
chmod +x /setup_es_fixed.sh
/setup_es_fixed.sh --index-dir /es_index_schemas
# Create marker file indicating initialization completion
touch /tmp/es_init_complete
echo 'Elasticsearch initialization completed successfully!'
) &
# Start Elasticsearch # Start Elasticsearch
exec /opt/bitnami/scripts/elasticsearch/entrypoint.sh /opt/bitnami/scripts/elasticsearch/run.sh exec /opt/bitnami/scripts/elasticsearch/entrypoint.sh /opt/bitnami/scripts/elasticsearch/run.sh
echo -e "⏳ Adjusting Elasticsearch disk watermark settings..." echo -e "⏳ Adjusting Elasticsearch disk watermark settings..."
" "