Merge branch 'harpoon-nami'

This commit is contained in:
Sameer Naik 2016-09-07 10:44:44 +05:30
commit 4ff35207cb
3 changed files with 34 additions and 15 deletions

View File

@ -1,4 +1,4 @@
FROM gcr.io/stacksmith-images/ubuntu:14.04-r8
FROM gcr.io/stacksmith-images/ubuntu:14.04-r9
MAINTAINER Bitnami <containers@bitnami.com>
ENV BITNAMI_IMAGE_VERSION=3.2.0-r2 \
@ -10,7 +10,7 @@ ENV PATH=/opt/bitnami/$BITNAMI_APP_NAME/sbin:/opt/bitnami/$BITNAMI_APP_NAME/bin:
COPY rootfs/ /
ENTRYPOINT ["/app-entrypoint.sh"]
CMD ["harpoon", "start", "--foreground", "redis"]
CMD ["nami", "start", "--foreground", "redis"]
VOLUME ["/bitnami/$BITNAMI_APP_NAME"]

View File

@ -1,17 +1,29 @@
#!/bin/bash
set -e
#!/bin/bash -e
if [[ "$1" == "harpoon" && "$2" == "start" ]]; then
status=`harpoon inspect $BITNAMI_APP_NAME`
if [[ "$status" == *'"lifecycle": "unpacked"'* ]]; then
harpoon initialize $BITNAMI_APP_NAME \
${REDIS_PASSWORD:+--password $REDIS_PASSWORD} \
${REDIS_REPLICATION_MODE:+--replicationMode $REDIS_REPLICATION_MODE} \
${REDIS_MASTER_HOST:+--masterHost $REDIS_MASTER_HOST} \
${REDIS_MASTER_PORT:+--masterPort $REDIS_MASTER_PORT} \
${REDIS_MASTER_PASSWORD:+--masterPassword $REDIS_MASTER_PASSWORD}
fi
chown $BITNAMI_APP_USER: /bitnami/$BITNAMI_APP_NAME || true
function initialize {
# Package can be "installed" or "unpacked"
status=`nami inspect $1`
if [[ "$status" == *'"lifecycle": "unpacked"'* ]]; then
# Clean up inputs
inputs=""
if [[ -f /$1-inputs.json ]]; then
inputs=--inputs-file=/$1-inputs.json
fi
nami initialize $1 $inputs
fi
}
# Set default values
export REDIS_PASSWORD=${REDIS_PASSWORD:-}
export REDIS_REPLICATION_MODE=${REDIS_REPLICATION_MODE:-}
export REDIS_MASTER_HOST=${REDIS_MASTER_HOST:-}
export REDIS_MASTER_PORT=${REDIS_MASTER_PORT:-6379}
export REDIS_MASTER_PASSWORD=${REDIS_MASTER_PASSWORD:-}
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/init.sh" ]]; then
initialize redis
chown -R :$BITNAMI_APP_USER /bitnami/redis || true
echo "Starting application ..."
fi
exec /entrypoint.sh "$@"

View File

@ -0,0 +1,7 @@
{
"password": "{{$global.env.REDIS_PASSWORD}}",
"replicationMode": "{{$global.env.REDIS_REPLICATION_MODE}}",
"masterHost": "{{$global.env.REDIS_MASTER_HOST}}",
"masterPort": "{{$global.env.REDIS_MASTER_PORT}}",
"masterPassword": "{{$global.env.REDIS_MASTER_PASSWORD}}"
}