Skip to content

Commit

Permalink
update docker entrypoint.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Bulat Saifullin <bulat@saifullin.ru>
  • Loading branch information
BulatSaif committed Apr 2, 2020
1 parent b3550fe commit 008db16
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docker/release/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ WORKDIR /opt/iroha_data
COPY entrypoint.sh wait-for-it.sh /
RUN chmod +x /entrypoint.sh /wait-for-it.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/sbin/init"]
CMD ["irohad"]
30 changes: 20 additions & 10 deletions docker/release/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
#!/usr/bin/env bash
set -e

echo key=$KEY
echo $PWD
if [ -n "$IROHA_POSTGRES_HOST" ]; then
echo "NOTE: IROHA_POSTGRES_HOST should match 'host' option in config file"
PG_PORT=${IROHA_POSTGRES_PORT:-5432}
/wait-for-it.sh -h $IROHA_POSTGRES_HOST -p $PG_PORT -t 30 -- true
else
echo "WARNING: IROHA_POSTGRES_HOST is not defined.
Do not wait for Postgres to become ready. Iroha may fail to start up"
# if first arg looks like a flag, assume we want to run irohad server
if [ "${1:0:1}" = '-' ]; then
set -- irohad "$@"
fi
irohad --genesis_block genesis.block --config config.docker --keypair_name $KEY

if [ "$1" = 'irohad' ]; then
echo key=$KEY
echo $PWD
if [ -n "$IROHA_POSTGRES_HOST" ]; then
echo "NOTE: IROHA_POSTGRES_HOST should match 'host' option in config file"
PG_PORT=${IROHA_POSTGRES_PORT:-5432}
/wait-for-it.sh -h $IROHA_POSTGRES_HOST -p $PG_PORT -t 30 -- true
else
echo "WARNING: IROHA_POSTGRES_HOST is not defined.
Do not wait for Postgres to become ready. Iroha may fail to start up"
fi
exec "$@" --genesis_block genesis.block --config config.docker --keypair_name $KEY
fi

exec "$@"

0 comments on commit 008db16

Please sign in to comment.