X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=docker%2Fmysql%2Fdeploy_with_existing_persistent_storage.sh;fp=docker%2Fmysql%2Fdeploy_with_existing_persistent_storage.sh;h=bd449ecb261099751caf5fb15f0b7e37ab1c8eef;hb=c80adf55823ca40d1b68e4a9186a615c9f9a2952;hp=0000000000000000000000000000000000000000;hpb=bcfe962f40d0ed2697bc3c6bdc56c89f163bb812;p=validation.git diff --git a/docker/mysql/deploy_with_existing_persistent_storage.sh b/docker/mysql/deploy_with_existing_persistent_storage.sh new file mode 100755 index 0000000..bd449ec --- /dev/null +++ b/docker/mysql/deploy_with_existing_persistent_storage.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Copyright (c) 2019 AT&T Intellectual Property. All other rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Use this script if the persistent storage already exists and you want to use its data + +set -ex + +DOCKER_VOLUME_NAME="akraino-validation-mysql" +# Container name +CONTAINER_NAME="akraino-validation-mysql" +# Image data +REGISTRY=akraino +NAME=validation +TAG_PRE=mysql +TAG_VER=latest +MYSQL_HOST_PORT=3307 + +for ARGUMENT in "$@" +do + KEY=$(echo $ARGUMENT | cut -f1 -d=) + VALUE=$(echo $ARGUMENT | cut -f2 -d=) + case "$KEY" in + REGISTRY) REGISTRY=${VALUE} ;; + NAME) NAME=${VALUE} ;; + TAG_VER) TAG_VER=${VALUE} ;; + TAG_PRE) TAG_PRE=${VALUE} ;; + CONTAINER_NAME) CONTAINER_NAME=${VALUE} ;; + MYSQL_HOST_PORT) MYSQL_HOST_PORT=${VALUE} ;; + *) + esac +done + +IMAGE="$REGISTRY"/"$NAME":"$TAG_PRE"-"$TAG_VER" +docker run --detach --name $CONTAINER_NAME --publish $MYSQL_HOST_PORT:3306 -v $DOCKER_VOLUME_NAME:/var/lib/mysql -v "/$(pwd)/mysql.conf:/etc/mysql/conf.d/my.cnf" $IMAGE +sleep 10