File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,13 @@ hooks:
3333 post-start :
3434 - exec : " composer install"
3535 - exec : " npm ci"
36- - exec-host : " ddev exec -s elasticsearch /mnt/ddev_config/elasticsearch/elasticsearch-setup.sh"
3736 - exec-host : |
38- if [ -f /tmp/elasticsearch_needs_restart ]; then
39- echo "Restarting Elasticsearch to apply plugin changes..."
40- ddev restart elasticsearch
41- rm /tmp/elasticsearch_needs_restart
37+ # Run the Elasticsearch plugin setup script
38+ ddev exec -s elasticsearch /mnt/ddev_config/elasticsearch/elasticsearch-setup.sh
39+
40+ # Check for the restart marker file
41+ if [ -f .ddev/elasticsearch/restart_needed ]; then
42+ echo "Elasticsearch plugins installed. Restarting elasticsearch container..."
43+ docker restart ddev-${DDEV_SITENAME}-elasticsearch
44+ rm .ddev/elasticsearch/restart_needed
4245 fi
Original file line number Diff line number Diff line change @@ -16,14 +16,23 @@ for plugin in $ELASTICSEARCH_PLUGINS; do
1616
1717 # Install plugin
1818 echo " Installing $plugin plugin..."
19- bin/elasticsearch-plugin install " $plugin " && \
20- chown -R elasticsearch:root " /usr/share/elasticsearch/plugins/$plugin " && \
21- chmod -R 755 " /usr/share/elasticsearch/plugins/$plugin " && \
22- echo " ✓ Plugin $plugin installed successfully" && \
23- needs_restart=true
19+ if bin/elasticsearch-plugin install " $plugin " ; then
20+ chown -R elasticsearch:root " /usr/share/elasticsearch/plugins/$plugin " && \
21+ chmod -R 755 " /usr/share/elasticsearch/plugins/$plugin " && \
22+ echo " ✓ Plugin $plugin installed successfully" && \
23+ needs_restart=true
24+ else
25+ echo " ✗ Failed to install plugin $plugin "
26+ exit 1
27+ fi
2428done
2529
2630# Signal for restart if needed
27- [ " $needs_restart " = true ] && echo " New plugins were installed. Elasticsearch needs to be restarted." && touch /tmp/elasticsearch_needs_restart
31+ if [ " $needs_restart " = true ]; then
32+ echo " New plugins were installed. Elasticsearch needs to be restarted."
33+
34+ # Create a marker file in the mounted config directory (visible to host)
35+ touch /mnt/ddev_config/elasticsearch/restart_needed
36+ fi
2837
2938exit 0
You can’t perform that action at this time.
0 commit comments