Skip to content

Commit

Permalink
Adding changes to deployment of EC2
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Elhaiek committed Mar 13, 2024
1 parent 194d71f commit 9beecf2
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: "us-east-1"

- name: Setup SSH Key
run: |
SSH_KEY_PATH=$(mktemp)
echo "${{ secrets.SSH_PRIVATE_KEY }}" > "$SSH_KEY_PATH"
chmod 600 "$SSH_KEY_PATH"
echo "SSH_KEY_PATH=${SSH_KEY_PATH}" >> $GITHUB_ENV
# - name: Setup SSH Key
# run: |
# SSH_KEY_PATH=$(mktemp)
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > "$SSH_KEY_PATH"
# chmod 600 "$SSH_KEY_PATH"
# echo "SSH_KEY_PATH=${SSH_KEY_PATH}" >> $GITHUB_ENV

- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
Expand Down Expand Up @@ -53,23 +53,18 @@ jobs:
run: terraform apply -auto-approve tfplan
working-directory: terraform

# New Step: List Terraform Outputs After Apply
- name: List Terraform Outputs After Apply
run: terraform output
working-directory: terraform

- name: Set EC2_INSTANCE_IP environment variable
run: |
set -x
EC2_INSTANCE_IP=$(terraform output -raw ec2_instance_public_ip)
echo "EC2_INSTANCE_IP=$EC2_INSTANCE_IP" >> $GITHUB_ENV
# - name: Set EC2_INSTANCE_IP environment variable
# run: |
# set -x
# EC2_INSTANCE_IP=$(terraform output -raw ec2_instance_public_ip)
# echo "EC2_INSTANCE_IP=$EC2_INSTANCE_IP" >> $GITHUB_ENV

- name: Transfer create-milvus.sh to EC2 instance
run: |
scp -o StrictHostKeyChecking=no -i $SSH_KEY_PATH ./create-milvus.sh ubuntu@${{ env.EC2_INSTANCE_IP }}:/tmp/create-milvus.sh
working-directory: terraform
# - name: Transfer create-milvus.sh to EC2 instance
# run: |
# scp -o StrictHostKeyChecking=no -i $SSH_KEY_PATH ./create-milvus.sh ubuntu@${{ env.EC2_INSTANCE_IP }}:/tmp/create-milvus.sh
# working-directory: terraform

- name: Execute create-milvus.sh on EC2 instance
run: |
ssh -o StrictHostKeyChecking=no -i $SSH_KEY_PATH ubuntu@${{ env.EC2_INSTANCE_IP }} "bash /tmp/create-milvus.sh"
# - name: Execute create-milvus.sh on EC2 instance
# run: |
# ssh -o StrictHostKeyChecking=no -i $SSH_KEY_PATH ubuntu@${{ env.EC2_INSTANCE_IP }} "bash /tmp/create-milvus.sh"

0 comments on commit 9beecf2

Please sign in to comment.