Skip to content

Instantly share code, notes, and snippets.

@olkeene
Last active February 7, 2018 16:14
Show Gist options
  • Select an option

  • Save olkeene/3bdd6c05ffc688f762bca86e5af723d6 to your computer and use it in GitHub Desktop.

Select an option

Save olkeene/3bdd6c05ffc688f762bca86e5af723d6 to your computer and use it in GitHub Desktop.

Revisions

  1. olkeene revised this gist Feb 4, 2017. 2 changed files with 0 additions and 2 deletions.
    1 change: 0 additions & 1 deletion docker-entrypoint.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    #!/bin/bash

    bundle check || bundle install --jobs 4 --retry 5

    pids=( server.pid realtime_updater.pid )
    1 change: 0 additions & 1 deletion wait-for-mysql.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    #!/bin/bash

    echo "[INFO] Waiting for mysql"

    until mysql -h"$MYSQL_HOST" -P3306 -u"$MYSQL_ROOT_USER" -p"$MYSQL_ROOT_PASSWORD" -e 'show databases;'; do
  2. olkeene created this gist Jan 17, 2017.
    17 changes: 17 additions & 0 deletions docker-entrypoint.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/bin/bash

    bundle check || bundle install --jobs 4 --retry 5

    pids=( server.pid realtime_updater.pid )
    for file in "${pids[@]}"
    do
    path="tmp/pids/$file"
    if [ -f $path ]; then
    rm $path
    fi
    done

    ./bin/wait-for-mysql.sh

    echo "[INFO] Running in app: $@"
    exec "$@"
    10 changes: 10 additions & 0 deletions wait-for-mysql.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/bash

    echo "[INFO] Waiting for mysql"

    until mysql -h"$MYSQL_HOST" -P3306 -u"$MYSQL_ROOT_USER" -p"$MYSQL_ROOT_PASSWORD" -e 'show databases;'; do
    >&2 printf "."
    sleep 1
    done

    echo "[INFO] Mysql ready"