Skip to content

Commit

Permalink
fix: Update AWS pipeline (#28)
Browse files Browse the repository at this point in the history
update circleci pipeline to deploy frontend to S3 bucket and backend via eb CLI. frontend/build and server/dist should be persisted via workspace
  • Loading branch information
tristenwallace authored May 2, 2024
1 parent 0e01dc2 commit a7a33fa
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,42 @@ jobs:
command: |
npm run build-server
echo "Backend built successfully."
- persist_to_workspace:
root: .
paths:
- frontend/build
- server/dist

deploy:
docker:
- image: "cimg/base:stable"
steps:
- node/install:
node-version: '20.12'
- eb/setup
- aws-cli/setup
- checkout
- aws-cli/setup
- eb/setup
- attach_workspace:
at: .
- run:
name: Deploy App
name: Set Up AWS Credentials
command: |
# Setting up AWS credentials
echo "Setting up AWS credentials..."
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set default.region us-east-2
# Deploying Frontend to S3
aws configure set default.region $AWS_DEFAULT_REGION
- run:
name: Deploy Frontend to S3
command: |
echo "Deploying Frontend to S3..."
aws s3 sync frontend/build s3://employee-polling-app --delete
# Deploying Backend to Elastic Beanstalk
echo "Deploying Backend to Elastic Beanstalk..."
aws s3 sync frontend/build s3://$BUCKET_NAME --delete
- run:
name: Deploy Backend to Elastic Beanstalk
command: |
cd server
eb deploy Employee-polling-app-env
eb init $EB_APP_NAME -r $AWS_DEFAULT_REGION -p node.js
echo "Deploying Backend to Elastic Beanstalk..."
eb deploy $EB_ENV
echo "Deployment completed."
workflows:
Expand Down

0 comments on commit a7a33fa

Please sign in to comment.