Skip to content

reset infrastructure #17

reset infrastructure

reset infrastructure #17

Workflow file for this run

name: Update Application and Infrastructure
on:
push:
branches:
- prod # Adjust the branch name if needed
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Get AWS credentials from Github Secrets
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Build frontend
run: |
cd frontend && npm install
CI=false npm run build
- name: Copy frontend build to server
run: cp -r frontend/build/ server/frontend/build/
- name: Install Terraform
run: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update && sudo apt-get install terraform
if: matrix.os == 'ubuntu-latest'
- name: Apply Terraform changes
run: |
terraform init
terraform destroy -auto-approve && terraform apply -auto-approve
# terraform apply \
# -auto-approve \
# -replace=aws_ecr_repository.studyoracle_server \
# -replace=aws_ecr_repository.studyoracle_worker \
# -replace=aws_ecs_cluster.studyoracle \
# -replace=aws_ecs_service.studyoracle \
# -replace=aws_ecs_task_definition.studyoracle_worker \
# -replace=aws_ecs_task_definition.studyoracle_server \
# -replace=aws_route53_record.studyoracle
continue-on-error: true
- name: Apply terraform once more (sometimes AutoScaling fails)
run: terraform apply -auto-approve
continue-on-error: true