changed to unmaintained
[aaf/authz.git] / auth / auth-cass / docker / drun.sh
1 #!/bin/bash
2 #########
3 #  ============LICENSE_START====================================================
4 #  org.onap.aaf
5 #  ===========================================================================
6 #  Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
7 #  ===========================================================================
8 #  Licensed under the Apache License, Version 2.0 (the "License");
9 #  you may not use this file except in compliance with the License.
10 #  You may obtain a copy of the License at
11 #
12 #       http://www.apache.org/licenses/LICENSE-2.0
13 #
14 #  Unless required by applicable law or agreed to in writing, software
15 #  distributed under the License is distributed on an "AS IS" BASIS,
16 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 #  See the License for the specific language governing permissions and
18 #  limitations under the License.
19 #  ============LICENSE_END====================================================
20 #
21 # Pull in AAF Env Variables from AAF install
22 if [ -e ../../docker/d.props ]; then
23   . ../../docker/d.props
24 fi
25 DOCKER=${DOCKER:-docker}
26 if [ "$DOCKER" = "podman" ]; then
27   PODNAME=aaf-cass.onap
28   if $(podman pod exists $PODNAME); then
29      echo "Using existing 'podman' pod $PODNAME"
30      POD="--pod $PODNAME "
31   else
32      echo "Create new 'podman' pod $PODNAME"
33      # Note: Cassandra needs "infra" to work
34      #  Keep in separate pod
35      #podman pod create --infra=true -n $PODNAME --publish 9042:9042
36      podman pod create --infra=false -n $PODNAME 
37      #POD="--pod new:$PODNAME "
38      POD="--pod $PODNAME "
39      PUBLISH='--publish 9042:9042 '
40   fi
41 else
42   PUBLISH='--publish 9042:9042 '
43 fi
44
45 if [ "$($DOCKER volume ls | grep aaf_cass_data)" = "" ]; then
46   $DOCKER volume create aaf_cass_data
47   echo "Created Cassandra Volume aaf_cass_data"
48 fi
49
50 # Optional mount instead of v
51 #    --mount 'type=volume,src=aaf_cass_data,dst=/var/lib/cassandra,volume-driver=local' \
52 if [ "`$DOCKER ps -a | grep aaf-cass`" == "" ]; then
53   echo "starting Cass from 'run'"
54   # NOTE: These HEAP Sizes are minimal. Not set for full organizations.
55   #  --user ${USER} \
56   $DOCKER run \
57     --name aaf-cass \
58     -e HEAP_NEWSIZE=512M \
59     -e MAX_HEAP_SIZE=1024M \
60     -e CASSANDRA_DC=dc1 \
61     -e CASSANDRA_CLUSTER_NAME=osaaf \
62     -v "aaf_cass_data:/var/lib/cassandra" \
63     -v "aaf_status:/opt/app/aaf/status" \
64     ${POD} \
65     $PUBLISH \
66     -d ${PREFIX}${ORG}/${PROJECT}/aaf_cass:${VERSION} "onap"
67 else 
68   $DOCKER start aaf-cass
69 fi