Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/fryckbos/cop
Browse files Browse the repository at this point in the history
  • Loading branch information
cs-pvh committed May 9, 2017
2 parents 09f8ec5 + b968e25 commit 3d189bf
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 8 deletions.
11 changes: 10 additions & 1 deletion connect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ else
LOG=/var/log/memcached.log
elif [ "$SERVICE" == "rabbitmq" ]; then
LOG= /var/log/rabbitmq/rabbit*.log
elif [ "$SERVICE" == "rum" ]; then
LOG=/var/log/nginx/*.log
else
LOG=/var/log/$SERVICE/current
fi
Expand All @@ -37,4 +39,11 @@ else
fi
fi

docker exec -it coscale_$SERVICE /bin/bash -c "export TERM=xterm && $ACTION"


if [ "$SERVICE" == "postgresql" ] && [ "$1" == "migrate" ]; then
cat $2 | docker exec -i coscale_$SERVICE /bin/bash -c "export TERM=xterm && migrate"
else
docker exec -it coscale_$SERVICE /bin/bash -c "export TERM=xterm && $ACTION"
fi

52 changes: 50 additions & 2 deletions pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,58 @@
source conf.sh
source services.sh

function show_help {
echo "Usage: $0 [--version <version>] [<component>|all|data|coscale]"
}

if [ "$1" == "--help" ]; then
show_help
exit 0
fi

if [ "$1" == "--version" ]; then
VERSION="$2"
shift #move command line arguments to the left
shift #move command line arguments to the left
fi

if [ $# -gt 1 ]; then
show_help
exit 1
fi

NAME=${1:-all}

docker login -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD" -e "$REGISTRY_EMAIL" $REGISTRY

for SERVICE in $DATA_SERVICES $COSCALE_SERVICES $LB_SERVICE; do
IMG=coscale/$SERVICE:$VERSION
if ["$NAME" == "base"]; then
for SERVICE in base python java7 java8 rserve numpy; do
IMG=coscale/$SERVICE:1.0.0
docker pull $REGISTRY/$IMG
docker tag $REGISTRY/$IMG $IMG
done
exit 0
fi

function pull {
SERVICE=$1
IMAGE_VERSION=$2
IMG=coscale/$SERVICE:$IMAGE_VERSION
docker pull $REGISTRY/$IMG
docker tag $REGISTRY/$IMG $IMG
}

# Pull the third party services
for SERVICE in $DATA_SERVICES; do
if [ "$NAME" == "all" ] || [ "$NAME" == "data" ] || [ "$NAME" == "$SERVICE" ]; then
pull $SERVICE $VERSION
fi
done

# Pull the coscale services
for SERVICE in $COSCALE_SERVICES $LB_SERVICE; do
if [ "$NAME" == "all" ] || [ "$NAME" == "coscale" ] || [ "$NAME" == "$SERVICE" ]; then
pull $SERVICE $VERSION
fi
done

13 changes: 10 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ source services.sh

export DNS_SWITCHES=""

if [ "$1" == "--version" ]; then
VERSION="$2"
shift #move command line arguments to the left
shift #move command line arguments to the left
fi

NAME=${1:-all}

if [ "$NAME" == "--help" ]; then
echo "$0 : run all services."
echo "$0 <service> : run a specific service."
echo "$0 coscale : run the CoScale services."
echo "$0 [--version <version>]: run all services."
echo "$0 [--version <version>] <service> : run a specific service."
echo "$0 [--version <version>] coscale : run the CoScale services."
exit 0
fi

Expand Down Expand Up @@ -59,6 +65,7 @@ function run {
-e "RUM_URL=$RUM_URL" \
-e "ENABLE_HTTPS=$ENABLE_HTTPS" \
-e "ANOMALY_EMAIL=$ANOMALY_EMAIL" \
-e "COSCALE_VERSION=$IMAGE_VERSION" \
--name coscale_$SERVICE coscale/$SERVICE:$IMAGE_VERSION
}

Expand Down
4 changes: 2 additions & 2 deletions stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function stop {
SERVICE=$1

echo "Stopping $SERVICE"
docker stop coscale_$SERVICE
docker rm coscale_$SERVICE
docker stop coscale_$SERVICE || echo "(Container not running)"
docker rm coscale_$SERVICE || echo "(Container not present)"
}

# Stop the data services
Expand Down

0 comments on commit 3d189bf

Please sign in to comment.