Skip to content

Commit

Permalink
Do not start postgresql if volume file does not exist
Browse files Browse the repository at this point in the history
Now this hook try to start postgresql in all applications, even those that do not use.
As a result, initd daemon failures when try to up postgresql container in which it is not present.

Closes Kloadut#38
  • Loading branch information
josegonzalez committed Sep 24, 2015
1 parent a84e92d commit bcce093
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pre-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ set -e;
APP="$1"

PG_APP_IMAGE="postgresql/$APP"
PG_VOLUME_PATH="$DOKKU_ROOT/.postgresql/volume_$APP"

# Check if an existing DB volume exists
PG_APP_IMAGE_ID=$(docker images | grep "$PG_APP_IMAGE" | awk '{print $3}')
if [[ -n $PG_APP_IMAGE_ID ]]; then
if [[ -n $PG_APP_IMAGE_ID ]] && [[ -f $PG_VOLUME_PATH ]]; then
echo "-----> Checking status of PostgreSQL"

# Check if DB container is installed
Expand All @@ -26,7 +27,7 @@ if [[ -n $PG_APP_IMAGE_ID ]]; then
else
echo "stopped."

PG_VOLUME="`cat $DOKKU_ROOT/.postgresql/volume_$APP`:/opt/postgresql"
PG_VOLUME="`cat $PG_VOLUME_PATH`:/opt/postgresql"

echo -n " Launching $PG_APP_IMAGE... "
echo "COMMAND: docker run -v $PG_VOLUME -p 5432 -d $PG_APP_IMAGE /usr/bin/start_pgsql.sh $DB_PASSWORD"
Expand Down

0 comments on commit bcce093

Please sign in to comment.