Skip to content

Commit b0fdf41

Browse files
authored
Merge pull request #363 from jhu-idc/tm--replace-s6-drupal-status-with-docker-healthcheck
Tm replace s6 drupal status with docker healthcheck
2 parents 389cbe6 + d28777c commit b0fdf41

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,7 @@ RUN \
3838
COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress --prefer-dist && \
3939
composer clearcache
4040

41+
HEALTHCHECK --start-period=3m --retries=10 --timeout=5s --interval=15s CMD curl -o /dev/null -s -H "Host:$( echo $DRUPAL_DEFAULT_SITE_URL | sed s,^.*/,, )" http://localhost:80/ || exit 1
42+
4143
# /init process must be run as root:
4244
USER root

codebase/config/sync/field.storage.node.field_alternative_title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ field_name: field_alternative_title
1515
entity_type: node
1616
type: language_value_pair
1717
settings:
18-
max_length: '500'
18+
max_length: '5000'
1919
is_ascii: false
2020
case_sensitive: false
2121
target_type: taxonomy_term

idc.Makefile

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,33 @@ start:
182182
.SILENT: _docker-up-and-wait
183183
_docker-up-and-wait:
184184
docker-compose up -d
185-
sleep 5
185+
containerId="" ; \
186+
while [ -z "$$containerId" ] ; do \
187+
echo "(still) waiting for Drupal container to appear" ; \
188+
sleep 2; \
189+
containerId=$$( docker-compose ps -q drupal ) ; \
190+
done && echo "containerId='$$containerId'"
191+
# composer config can move forward since container is available:
186192
if [ "${GH_TOKEN}" ]; then \
187193
echo "Installing github token"; \
188-
docker-compose exec -T drupal bash -lc "composer config -g github-oauth.github.com ${GH_TOKEN}" && echo '' ; \
189-
fi;
190-
docker-compose exec -T drupal /bin/sh -c "while true ; do echo \"Waiting for Drupal to start ...\" ; if [ -d \"/var/run/s6/services/nginx\" ] ; then s6-svwait -u /var/run/s6/services/nginx && exit 0 ; else sleep 5 ; fi done"
194+
docker-compose exec -T drupal bash -lc "composer config -g github-oauth.github.com ${GH_TOKEN}" ; \
195+
else \
196+
echo "No github token provided" ; \
197+
fi
198+
# new block:
199+
containerId=$$( docker-compose ps -q drupal ) ; \
200+
echo "Drupal container ID: '$$containerId'" ; \
201+
containerName=$$(docker inspect -f '{{.Name}}' $$(docker-compose ps -q drupal) | cut -c2-) ; \
202+
echo "Looking into run-state of found-container '$$containerName'" ; \
203+
if [ -n "$$containerName" ] ; then \
204+
runState="" ; \
205+
while [ "true" != "$$runState" ] ; do \
206+
sleep 5 ; \
207+
runState=$$(docker inspect -f {{.State.Running}} "$$containerName") ; \
208+
echo "Waiting for Drupal to start ... current state: $$runState" ; \
209+
done && \
210+
echo Drupal is ready. ; \
211+
fi
191212

192213
# Static drupal image, with codebase baked in. This image
193214
# is tagged based on the current git hash/tag. If the image is not present

0 commit comments

Comments
 (0)