Made shells executable
[yaml_builds.git] / tools / single_step_deploy.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 set -x
19
20 if [ -z "$1" ]
21 then
22   echo "Please pass site name as command line argument"
23   exit -2
24 else
25   export SITE=${SITE:-$1}
26   echo "SITE=$SITE"
27 fi
28
29 source $(dirname $0)/setenv.sh
30 TIMESTAMP=$(date +"%Y%m%d%H%M")
31 echo "TIMESTAMP=$TIMESTAMP"
32
33 echo "Validating the setup and generating the tar file"
34 bash $YAML_BUILDS/tools/1prom-gen.sh $SITE > /var/log/yaml_builds/1prom-gen-$TIMESTAMP.log 2>&1
35 if [ $? -ne 0 ]
36 then
37   echo "Error:Could not generate tar file. So stopping here"
38   exit 1 
39 fi
40
41 echo "Bringing up the genesis node"
42 bash $YAML_BUILDS/tools/2genesis.sh $SITE > /var/log/yaml_builds/2genesis-$TIMESTAMP.log 2>&1
43 if [ $? -ne 0 ]
44 then
45   echo "Error:Could not bringup the genesis nodes. So stopping here"
46   exit 2
47 fi
48
49 echo "Deploying the site"
50 bash $YAML_BUILDS/tools/3deploy_site.sh $SITE > /var/log/yaml_builds/3deploy-$TIMESTAMP.log 2>&1
51 if [ $? -ne 0 ]
52 then
53   echo "Error:Could not deploy the site."
54   exit 3
55 fi
56 echo "We are done."