prevent updater from failing repeatedly on first startup while app volume is not ready

remotes/origin/pgsql-count-bits-12
Andrew Dolgov 5 years ago
parent 400fd5c1aa
commit fa73a498a3

@ -9,6 +9,7 @@ RUN apk add --no-cache php7 php7-fpm \
git postgresql-client sudo git postgresql-client sudo
ADD startup.sh / ADD startup.sh /
ADD updater.sh /
ADD index.php / ADD index.php /
RUN sed -i.bak 's/^listen = 127.0.0.1:9000/listen = 9000/' /etc/php7/php-fpm.d/www.conf RUN sed -i.bak 's/^listen = 127.0.0.1:9000/listen = 9000/' /etc/php7/php-fpm.d/www.conf

@ -0,0 +1,15 @@
#!/bin/sh -ex
while ! pg_isready -h $DB_HOST -U $DB_USER; do
echo waiting until $DB_HOST is ready...
sleep 3
done
DST_DIR=/var/www/html/tt-rss
while [ ! -s $DST_DIR/config.php ]; do
echo waiting for $DST_DIR/config.php...
sleep 3
done
exec /usr/bin/php /var/www/html/tt-rss/update_daemon2.php

@ -43,12 +43,21 @@ services:
- OWNER_UID=${OWNER_UID} - OWNER_UID=${OWNER_UID}
- OWNER_GID=${OWNER_GID} - OWNER_GID=${OWNER_GID}
restart: unless-stopped restart: unless-stopped
environment:
- DB_TYPE=pgsql
- DB_HOST=db
- DB_NAME=${POSTGRES_USER}
- DB_USER=${POSTGRES_USER}
- DB_PASS=${POSTGRES_PASSWORD}
- OWNER_UID=${OWNER_UID}
- OWNER_GID=${OWNER_GID}
- SELF_URL_PATH=${SELF_URL_PATH}
volumes: volumes:
- app:/var/www/html - app:/var/www/html
depends_on: depends_on:
- app - app
user: app user: app
command: "php /var/www/html/tt-rss/update_daemon2.php" command: /updater.sh
web: web:
build: ./web build: ./web

Loading…
Cancel
Save