Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions usecase/solar-political-influence-analyzer/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 루트 레벨 환경 변수 (선택)
AWS_REGION=ap-northeast-2
AWS_ACCOUNT_ID=your_aws_account_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Deploy AI Engine to ECS

on:
push:
branches:
- main
paths:
- 'src/ai-engine/**'
- '.github/workflows/deploy-backend.yml'

env:
AWS_REGION: ap-northeast-2
ECR_REPOSITORY: ups-t3-ai-engine
ECS_CLUSTER: ups-t3-cluster
ECS_SERVICE: ups-t3-service
CONTAINER_NAME: ups-t3-container

jobs:
deploy:
name: Deploy AI Engine
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
cd src/ai-engine
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT

- name: Update ECS service
run: |
aws ecs update-service \
--cluster ${{ env.ECS_CLUSTER }} \
--service ${{ env.ECS_SERVICE }} \
--force-new-deployment \
--region ${{ env.AWS_REGION }}

- name: Wait for service stability
run: |
aws ecs wait services-stable \
--cluster ${{ env.ECS_CLUSTER }} \
--services ${{ env.ECS_SERVICE }} \
--region ${{ env.AWS_REGION }}

- name: Deployment success
run: |
echo "✅ AI Engine deployed successfully!"
echo "Image: ${{ steps.build-image.outputs.image }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy Frontend to S3 and CloudFront

on:
push:
branches:
- main
paths:
- 'src/frontend/**'
- '.github/workflows/deploy-frontend.yml'

env:
AWS_REGION: ap-northeast-2
S3_BUCKET: ups-t3-frontend-1763878138
CLOUDFRONT_DISTRIBUTION_ID: E1RLDWF8ZOYKW1

jobs:
deploy:
name: Deploy Frontend
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: src/frontend/package-lock.json

- name: Install dependencies
run: |
cd src/frontend
npm ci --legacy-peer-deps

- name: Build application
env:
NEXT_PUBLIC_API_URL: https://d31ad140yvex7c.cloudfront.net
run: |
cd src/frontend
npm run build

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Deploy to S3
run: |
cd src/frontend
aws s3 sync out/ s3://${{ env.S3_BUCKET }} --delete --region ${{ env.AWS_REGION }}

- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ env.CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"

- name: Deployment success
run: |
echo "✅ Frontend deployed successfully!"
echo "URL: https://d31ad140yvex7c.cloudfront.net"
87 changes: 87 additions & 0 deletions usecase/solar-political-influence-analyzer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual Environment
venv/
env/
ENV/

# Environment Variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# React Build
/frontend/build/
/frontend/.env.local
/frontend/.env.development.local
/frontend/.env.test.local
/frontend/.env.production.local

# Testing
.coverage
htmlcov/
.pytest_cache/
.tox/

# Database
*.db
*.sqlite3

# Temporary files
*.tmp
*.temp

# API Keys (보안)
**/config/secrets.py
**/config/keys.py
Loading