Update DCAE Startup Info
[aaf/authz.git] / auth / docker / aaf.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
22 . ./d.props
23
24 DOCKER=${DOCKER:=docker}
25 # if something, may not want CASS attached all the tim
26 #LINKS="--link $CASSANDRA_DOCKER"
27
28 # DOCKER doesn't have DNS out of the box, only links.  
29 # so we add cm_always_ignore_ips in --env
30
31 function run_it() {
32   if [ -n "${DUSER}" ]; then
33     USER_LINE="--user ${DUSER}"
34   fi
35   $DOCKER run $@ \
36     $USER_LINE \
37     -v "aaf_config:$CONF_ROOT_DIR" \
38     -v "aaf_status:/opt/app/aaf/status" \
39     $LINKS \
40     --env aaf_locator_container=docker \
41     --env aaf_locator_container_ns=${NAMESPACE} \
42     --env aaf_locator_fqdn=${HOSTNAME} \
43     --env aaf_locate_url=https://aaf-locate:8095 \
44     --env aaf_locator_public_fqdn=${HOSTNAME} \
45     --env cm_always_ignore_ips=true \
46     --env AAF_ENV=${AAF_ENV} \
47     --env LATITUDE=${LATITUDE} \
48     --env LONGITUDE=${LONGITUDE} \
49     --env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \
50     --env CASSANDRA_USER=${CASSANDRA_USER} \
51     --env CASSANDRA_PASSWORD=${CASSANDRA_PASSWORD} \
52     --env CASSANDRA_PORT=${CASSANDRA_PORT} \
53     --name aaf_config_$USER \
54     $PREFIX${ORG}/${PROJECT}/aaf_config:${VERSION} \
55     bash -c "bash /opt/app/aaf_config/bin/agent.sh $PARAMS"
56 }
57
58 PARAMS=$@
59 case "$1" in 
60   bash)
61     PARAMS="&& cd /opt/app/osaaf/local && exec bash"
62     run_it -it --rm  
63     ;;
64   taillog)
65     run_it -it --rm 
66     ;;
67   *)
68     run_it --rm 
69     ;;
70 esac
71