This repository was archived by the owner on Jan 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathpre-deploy
More file actions
executable file
·43 lines (37 loc) · 1.35 KB
/
Copy pathpre-deploy
File metadata and controls
executable file
·43 lines (37 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
set -e;
APP="$1"
HOST_DIR="$DOKKU_ROOT/.redis/volume-$APP"
# check if redis is enabled for the app
if [[ -d $HOST_DIR ]]; then
REDIS_APP_IMAGE="redis/$APP"
REDIS_APP_IMAGE_ID=$(docker images | grep "$REDIS_IMAGE" | awk '{print $3}')
# verifies that an app mimage has been mae
if [[ -n $REDIS_APP_IMAGE_ID ]]; then
echo "-----> Checking status of Redis"
REDIS_IMAGE=$(docker images | grep "luxifer/redis " | awk '{print $3}')
if [[ -z $REDIS_IMAGE ]]; then
echo "Redis image not found...Did you run 'dokku plugins-install' ?"
exit 1
fi
echo " Found image redis/$APP"
echo -n " Checking status..."
# since this is in pre-deploy, i don't think we'll run into a situation where the container is already started
# but the postgres guys had it.
# "never say never"
REDIS_APP_IMAGE_CONTAINER_ID=$(docker ps | grep "$REDIS_APP_IMAGE" | awk '{print $1}')
if [[ -n $REDIS_APP_IMAGE_CONTAINER_ID ]]; then
echo "ok."
else
echo "stopped."
VOLUME="$HOST_DIR:/var/lib/redis"
echo -n " Launching $REDIS_APP_IMAGE..."
echo "COMMAND: docker run -v $VOLUME -p 6379 -d $REDIS_APP_IMAGE /bin/start_redis.sh"
ID=$(docker run -v $VOLUME -p 6379 -d $REDIS_APP_IMAGE /bin/start_redis.sh)
sleep 4
dokku redis:link $APP $APP
sleep 1
echo "ok."
fi
fi
fi