Tag Image for Repo push in Script
[aaf/authz.git] / auth / docker / drun.sh
1 #!/bin/bash
2 # Pull in Variables from d.props
3 . ./d.props
4
5 # Only need Cassandra Link Info when initializing the container.
6 if [ ! -e ./cass.props ]; then
7     cp cass.props.init cass.props
8     echo "Edit appropriate Cassandra Link Info into cass.props"
9     exit
10 fi
11
12 . ./cass.props
13
14 if [ "$1" == "" ]; then
15     AAF_COMPONENTS=$(ls -r ../aaf_${VERSION}/bin | grep -v '\.')
16 else
17     AAF_COMPONENTS="$@"
18 fi
19
20 for AAF_COMPONENT in ${AAF_COMPONENTS}; do
21     case "$AAF_COMPONENT" in
22     "service")
23         PORTMAP="8100:8100"
24         LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST"
25         ;;
26     "locate")
27         PORTMAP="8095:8095"
28         LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST"
29         ;;
30     "oauth")
31         PORTMAP="8140:8140"
32         LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST"
33         ;;
34     "gui")
35         PORTMAP="8200:8200"
36         ;;
37     "cm")
38         PORTMAP="8150:8150"
39         LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST"
40         ;;
41     "hello")
42         PORTMAP="8130:8130"
43         ;;
44     "fs")
45         PORTMAP="80:8096"
46         ;;
47     esac
48
49     echo Starting aaf_$AAF_COMPONENT...
50
51     docker run \
52         -d \
53         --name aaf_$AAF_COMPONENT \
54         --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \
55         --add-host="$HOSTNAME:$HOST_IP" \
56         --add-host="aaf.osaaf.org:$HOST_IP" \
57         ${LINKS} \
58         --publish $PORTMAP \
59         --mount 'type=volume,src=aaf_config,dst='$CONF_ROOT_DIR',volume-driver=local' \
60         ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION}
61 done