changed to unmaintained
[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 [ "$DOCKER" = "podman" ]; then
26   PODNAME=${PODNAME:-$HOSTNAME}
27   if $(podman pod exists $PODNAME); then
28      echo "Using existing 'podman' pod $PODNAME"
29      LINKS="--pod $PODNAME "
30   #else
31      #echo "Create new 'podman' pod $PODNAME"
32      #podman pod create --infra=true -n $PODNAME --publish 8100:8100
33   fi
34   LINKS="--pod $PODNAME "
35 fi
36
37 # DOCKER doesn't have DNS out of the box, only links.  
38 # so we add cm_always_ignore_ips in --env
39
40 function run_it() {
41   if [ -n "${DUSER}" ]; then
42     USER_LINE="--user ${DUSER}"
43   fi
44   $DOCKER run $@ \
45     $USER_LINE \
46     -v "aaf_config:$CONF_ROOT_DIR" \
47     -v "aaf_status:/opt/app/aaf/status" \
48     $LINKS \
49     --env aaf_locator_container=docker \
50     --env aaf_locator_container_ns=${NAMESPACE} \
51     --env aaf_locator_fqdn=${HOSTNAME} \
52     --env aaf_locate_url=https://aaf-locate:8095 \
53     --env aaf_locator_public_fqdn=${HOSTNAME} \
54     --env cm_always_ignore_ips=true \
55     --env AAF_ENV=${AAF_ENV} \
56     --env LATITUDE=${LATITUDE} \
57     --env LONGITUDE=${LONGITUDE} \
58     --env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \
59     --env CASSANDRA_USER=${CASSANDRA_USER} \
60     --env CASSANDRA_PASSWORD=${CASSANDRA_PASSWORD} \
61     --env CASSANDRA_PORT=${CASSANDRA_PORT} \
62     --name aaf_config_$USER \
63     $PREFIX${ORG}/${PROJECT}/aaf_config:${VERSION} \
64     bash -c "bash /opt/app/aaf_config/bin/agent.sh $PARAMS"
65 }
66
67 PARAMS=$@
68 case "$1" in 
69   bash)
70     PARAMS="&& cd /opt/app/osaaf/local && exec bash"
71     run_it -it --rm  
72     ;;
73   taillog)
74     run_it -it --rm 
75     ;;
76   *)
77     run_it --rm 
78     ;;
79 esac
80