deploy-single-node.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. set -o xtrace
  3. set -e
  4. if [ -z "$1" ]; then
  5. echo "ERROR: Configuration file not passed"
  6. echo "Please use ./deploy-infra.sh PATH/TO/CONFIG to run this script"
  7. exit 1
  8. else
  9. echo "Using $1 file for config"
  10. source $1
  11. fi
  12. if [ $ACCOUNT_ID == None ]; then
  13. echo "Couldn't find Account ID, please check if AWS Profile $CLI_PROFILE is set"
  14. exit 1
  15. fi
  16. if [ ! -f "$KEY_PATH" ]; then
  17. echo "Key file not found at $KEY_PATH"
  18. exit 1
  19. fi
  20. # # Deploy the CloudFormation template
  21. # echo -e "\n\n=========== Deploying single instance ==========="
  22. # aws cloudformation deploy \
  23. # --region $REGION \
  24. # --profile $CLI_PROFILE \
  25. # --stack-name $NEW_STACK_NAME \
  26. # --template-file single-instance.yml \
  27. # --no-fail-on-empty-changeset \
  28. # --capabilities CAPABILITY_NAMED_IAM \
  29. # --parameter-overrides \
  30. # EC2InstanceType=$DEFAULT_EC2_INSTANCE_TYPE \
  31. # KeyName=$AWS_KEY_PAIR_NAME \
  32. # EC2AMI=$EC2_AMI_ID
  33. # If the deploy succeeded, get the IP, create inventory and configure the created instances
  34. if [ $? -eq 0 ]; then
  35. # Install additional Ansible roles from requirements
  36. # ansible-galaxy install -r requirements.yml
  37. SERVER_IP=$(get_aws_export "PublicIp")
  38. echo -e "New Node Public IP: $SERVER_IP"
  39. echo -e "\n\n=========== Configuring the chain spec file and Pioneer app ==========="
  40. ansible-playbook -i $SERVER_IP, --private-key $KEY_PATH new-node-playbook.yml \
  41. --extra-vars "binary_file=$BINARY_FILE chain_spec_file=$CHAIN_SPEC_FILE"
  42. fi