Skip to content

Commit

Permalink
Updated to wait-for and fixed cond-init.d script
Browse files Browse the repository at this point in the history
  • Loading branch information
funkypenguin committed Jul 21, 2017
1 parent 79c5cd9 commit bdf3aed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ COPY root /
RUN curl -L -s https://github.com/just-containers/s6-overlay/releases/download/v1.19.1.1/s6-overlay-amd64.tar.gz | tar xvzf - -C /

# Add wait-for-it.sh
ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /srv
ADD https://raw.githubusercontent.com/Eficode/wait-for/master/wait-for /srv
RUN chmod 755 /srv/wait-for

# Expose Nginx ports.
EXPOSE 8080
Expand Down
17 changes: 9 additions & 8 deletions root/etc/cont-init.d/98-wait-for-db
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@

#############
# This simply duplicates the logic from ttrss-configure-db.php
ename = 'DB';
eport = 5432;
ename='DB';
eport=5432;

if [ $DB_TYPE = 'pgsql ];
if [ '$DB_TYPE' = 'mysql' ];
then
eport = 5432;
dbhost = DB_PORT_5432_TCP_ADDR
eport=3306;
dbhost=$DB_PORT_3306_TCP_ADDR
else
eport = 3306;
dbhost = DB_PORT_3306_TCP_ADDR
eport=5432;
dbhost=$DB_PORT_5432_TCP_ADDR
fi
#############

# Run wait-for-it.sh to confirm DB comes up before we proceed
/srv/wait-for-it.sh $dbhost:$eport
echo "Waiting for $dbhost:$eport..."
/srv/wait-for $dbhost:$eport -- echo "Done"

0 comments on commit bdf3aed

Please sign in to comment.