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