Browse Source

Add checks for local configuration

Anuj Bansal 3 years ago
parent
commit
1d0ffcb0ee
2 changed files with 13 additions and 1 deletions
  1. 1 1
      devops/infrastructure/bash-config.cfg
  2. 12 0
      devops/infrastructure/deploy-infra.sh

+ 1 - 1
devops/infrastructure/bash-config.cfg

@@ -1,7 +1,7 @@
 STACK_NAME=joystream-node
 REGION=us-east-1
 CLI_PROFILE=joystream-user
-KEY_PATH="~/Joystream/joystream-key.pem"
+KEY_PATH="/Users/myuser/Joystream/joystream-key.pem"
 AWS_KEY_PAIR_NAME="joystream-key"
 BRANCH_NAME=sumer
 LOCAL_CODE_PATH="~/Joystream/joystream"

+ 12 - 0
devops/infrastructure/deploy-infra.sh

@@ -1,11 +1,23 @@
 #!/bin/bash
 
+set -e
+
 source bash-config.cfg
 
 ACCOUNT_ID=$(aws sts get-caller-identity --profile $CLI_PROFILE --query Account --output text)
 
 NEW_STACK_NAME="${STACK_NAME}-${ACCOUNT_ID}"
 
+if [ $ACCOUNT_ID == None ]; then
+    echo "Couldn't find Account ID, please check if AWS Profile $CLI_PROFILE is set"
+    exit 1
+fi
+
+if [ ! -f "$KEY_PATH" ]; then
+    echo "Key file not found at $KEY_PATH"
+    exit 1
+fi
+
 # Deploy the CloudFormation template
 echo -e "\n\n=========== Deploying main.yml ==========="
 aws cloudformation deploy \