updated templates and scripts for Airship 1.3
[yaml_builds.git] / tools / 3deploy_site.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.        #
4 #                                                                            #
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may    #
6 # not use this file except in compliance with the License.                   #
7 #                                                                            #
8 # You may obtain a copy of the License at                                    #
9 #       http://www.apache.org/licenses/LICENSE-2.0                           #
10 #                                                                            #
11 # Unless required by applicable law or agreed to in writing, software        #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
14 # See the License for the specific language governing permissions and        #
15 # limitations under the License.                                             #
16 ##############################################################################
17
18
19 set -xe
20 LOGDIR="/var/log/akraino"
21 mkdir -p $LOGDIR
22 LOGFILE="$LOGDIR/${1}_$(date +"%Y%m%d%H%M%z")_$(basename $0|cut -d. -f1)"
23 echo "logging to $LOGFILE"
24 exec 1> >(tee -a $LOGFILE)
25 exec 2>&1
26
27 source $(dirname $0)/setenv.sh
28
29 if [ -z "$1" ]
30 then
31   echo "Please pass site name as command line argument"
32   exit -2
33 else
34   SITE=${SITE:-$1}
35   echo "SITE=$SITE"
36 fi
37
38 source $(dirname $0)/env_$SITE.sh
39
40 ssh $GENESIS_HOST << EOF
41   cd /root/akraino
42   bash genesis.sh
43   # Shipyard takes time to really come up and start responding.
44   date
45   sleep 900
46   # Following is a workaround, tested on dell servers.
47   # TODO to be removed when not required.
48   bash update_iptables.sh
49   #bash deploy_site.sh
50 EOF
51
52 exec 2>&-
53 exec 1>&-
54 exit 0
55