Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
baf93b4
[#1]; fix: cluade code 리뷰 액션 비활성화
anozanami Feb 4, 2026
3ebb013
[#1]; chore: EC2 배포 스크립트에 프로젝트 디렉토리 확인 및 클론 추가
anozanami Feb 4, 2026
455cfa4
[#1]; chore: List 타입으로 excluded_institutions 수정
anozanami Feb 4, 2026
7a3a729
[#1]; chore: EC2에서 .pyc 파일 제거 및 src/config.py 검사 추가
anozanami Feb 4, 2026
59db104
[#1]; chore: EC2 배포 스크립트에서 최신 변경 사항을 가져오고 브랜치 확인 추가
anozanami Feb 4, 2026
b4de7b7
[#1]; chore: Union 타입을 사용하여 타입 힌트를 개선
anozanami Feb 4, 2026
c50ce9a
[#1]; chore: List 타입을 사용하여 타입 힌트를 개선
anozanami Feb 4, 2026
20936d5
[#1]; chore: 타입 힌트를 python 3.8 버전과 호환되도록 수정
anozanami Feb 4, 2026
a6b1e5f
[#1]; chore: 타입 힌트를 Optional로 수정하여 코드 가독성 향상
anozanami Feb 4, 2026
11d54a4
[#1]; chore: pyproject.toml 및 parser.py의 Python 버전을 3.8로 수정
anozanami Feb 4, 2026
9b9be01
[#1]; chore: 타입 힌트 정리 및 불필요한 임포트 제거
anozanami Feb 4, 2026
6a0926e
[#1]; chore: 타입 힌트 수정하여 일관성 유지
anozanami Feb 4, 2026
9ae4bd7
[#1]; chore: 데이터베이스 URL을 PostgreSQL로 변경하고 유효성 검사 추가
anozanami Feb 4, 2026
331ec3c
[#1]; 데이터베이스 비밀 변수 검증 추가 및 DATABASE_URL 구성 수정
anozanami Feb 4, 2026
e0a597f
[#1]; chore: MySQL로 데이터베이스 URL 변경 및 관련 종속성 수정
anozanami Feb 4, 2026
af254ba
[#1]; chore: MySQL DATABASE_URL 구성 수정 및 데이터베이스 이름 변경
anozanami Feb 4, 2026
5a0b7a7
[#1]; chore: cluade code review 워크플[로우 파일 삭제
anozanami Feb 4, 2026
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
29 changes: 0 additions & 29 deletions .github/workflows/claude-issue-comment.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/claude-issue.yml

This file was deleted.

83 changes: 0 additions & 83 deletions .github/workflows/claude-pr.yml

This file was deleted.

40 changes: 15 additions & 25 deletions .github/workflows/demigrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,46 +24,36 @@ jobs:
- name: Deploy to EC2
env:
SSH_KEY: ${{ secrets.EC2_SSH_KEY }}
HOST: ${{ secrets.EC2_STG_HOST }}
DB_URL: ${{ secrets.DB_URL }}
HOST: ${{ secrets.EC2_STG_HOST }} # Assuming STG host is for RDS
DB_URL: ${{ secrets.DB_URL }} # DB_URL secret now holds the DB host
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: |
# Setup SSH
mkdir -p ~/.ssh
ssh-keyscan -H $HOST >> ~/.ssh/known_hosts
echo "$SSH_KEY" > key.pem
chmod 600 key.pem

# Validate DB_URL secret
if [ -z "$DB_URL" ]; then
echo "Error: DB_URL secret is not set or is empty. Please configure the DB_URL secret in your repository settings."
# Validate DB secrets
if [ -z "$DB_URL" ] || [ -z "$DB_USERNAME" ] || [ -z "$DB_PASSWORD" ]; then
echo "Error: One or more DB secrets (DB_URL, DB_USERNAME, DB_PASSWORD) are not set or are empty. Please configure them in your repository settings."
exit 1
fi

# Define project path on EC2
PROJECT_PATH="/home/ubuntu/BeyondU-Data"

# SSH to EC2 and run demigration script
ssh -i key.pem ubuntu@$HOST "
# Navigate to the project directory
cd $PROJECT_PATH

# Pull the latest changes
git pull

# Set up python virtual environment and install dependencies
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Construct the full DATABASE_URL for MySQL

if [ "${{ github.event.inputs.confirm_drop_db }}" != "true" ]; then
# Assuming default MySQL port 3306 and a database named 'beyondu' (or your application DB) on RDS

echo "Database drop not confirmed. Exiting."
FULL_DATABASE_URL="mysql+mysqlconnector://${DB_USERNAME}:${DB_PASSWORD}@${DB_URL}:3306/beyondu"

exit 1

fi

# Run the ETL script with --drop-db to clear all data, passing DATABASE_URL as environment variable
# SSH to EC2 and run demigration script
ssh -i key.pem ubuntu@$HOST "
# ... (inside SSH block) ...

DATABASE_URL="$DB_URL" python scripts/run_etl.py --drop-db
# Run the ETL script with --drop-db to clear all data, passing DATABASE_URL as environment variable
DATABASE_URL=\"$FULL_DATABASE_URL\" python scripts/run_etl.py --drop-db
"
125 changes: 99 additions & 26 deletions .github/workflows/migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,115 @@ jobs:
- name: Deploy to EC2
env:
SSH_KEY: ${{ secrets.EC2_SSH_KEY }}
HOST: ${{ secrets.EC2_STG_HOST }}
DB_URL: ${{ secrets.DB_URL }}
HOST: ${{ secrets.EC2_STG_HOST }} # Assuming STG host is for RDS
DB_URL: ${{ secrets.DB_URL }} # DB_URL secret now holds the DB host
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: |
# Setup SSH
mkdir -p ~/.ssh
ssh-keyscan -H $HOST >> ~/.ssh/known_hosts
echo "$SSH_KEY" > key.pem
chmod 600 key.pem

# Validate DB_URL secret
if [ -z "$DB_URL" ]; then
echo "Error: DB_URL secret is not set or is empty. Please configure the DB_URL secret in your repository settings."
exit 1
fi
# Validate DB secrets

# Define project path on EC2
PROJECT_PATH="/home/ubuntu/BeyondU-Data"
if [ -z "$DB_URL" ] || [ -z "$DB_USERNAME" ] || [ -z "$DB_PASSWORD" ]; then

# SSH to EC2 and run migration script
ssh -i key.pem ubuntu@$HOST "
echo "Error: One or more DB secrets (DB_URL, DB_USERNAME, DB_PASSWORD) are not set or are empty. Please configure them in your repository settings."

# Navigate to the project directory
cd $PROJECT_PATH
exit 1

# Pull the latest changes
git pull
fi



# Set up python virtual environment and install dependencies
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
if [ "${{ github.event.inputs.confirm_migration }}" != "true" ]; then
echo "Database migration not confirmed. Exiting."
exit 1
fi
# Run the ETL script with DATABASE_URL as environment variable
DATABASE_URL="$DB_URL" python scripts/run_etl.py --input data/raw --latest-only --init-db
"
# Define project path on EC2

PROJECT_PATH="/home/ubuntu/BeyondU-Data"



# Construct the full DATABASE_URL for MySQL
# Assuming default MySQL port 3306 and a database named 'beyondu' (or your application DB) on RDS
FULL_DATABASE_URL="mysql+mysqlconnector://${DB_USERNAME}:${DB_PASSWORD}@${DB_URL}:3306/beyondu"



# SSH to EC2 and run migration script

ssh -i key.pem ubuntu@$HOST "

# Check if project directory exists, if not clone it

if [ ! -d \"$PROJECT_PATH\" ]; then

echo \"Cloning repository to $PROJECT_PATH\"

git clone https://github.com/${{ github.repository }}.git \"$PROJECT_PATH\"

fi



# Navigate to the project directory

cd \"$PROJECT_PATH\"



# Pull the latest changes and ensure the correct branch is checked out

git fetch origin

git checkout "${{ github.ref_name }}" # Checkout the branch this workflow is running on

git reset --hard "origin/${{ github.ref_name }}" # Force update to the latest remote commit of the current branch

git clean -fdx # Clean up untracked files and directories, just in case



# Debug: Remove .pyc files and inspect src/config.py on EC2

find src -name "*.pyc" -delete

ls -la src/config.py

cat src/config.py



# Install python3-venv if not already installed (idempotent)

sudo apt-get update && sudo apt-get install -y python3-venv



# Set up python virtual environment and install dependencies

python3 -m venv venv

source venv/bin/activate

pip install -r requirements.txt



if [ \"${{ github.event.inputs.confirm_migration }}\" != \"true\" ]; then

echo \"Database migration not confirmed. Exiting.\"

exit 1

fi



# Run the ETL script with DATABASE_URL as environment variable

DATABASE_URL=\"$FULL_DATABASE_URL\" python scripts/run_etl.py --input data/raw --latest-only --init-db

"


4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ requires-python = ">=3.11"

[tool.ruff]
line-length = 100
target-version = "py311"
target-version = "py38"

[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "UP"]
ignore = ["E501"]

[tool.mypy]
python_version = "3.11"
python_version = "3.8"
strict = true
ignore_missing_imports = true

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ openpyxl>=3.1.0
numpy>=1.24.0

# Database
psycopg2-binary>=2.9.0
mysql-connector-python>=8.0.0
sqlalchemy>=2.0.0
alembic>=1.12.0

Expand Down
3 changes: 2 additions & 1 deletion scripts/run_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import sys
from pathlib import Path
from typing import Dict, List, Optional, Union, Tuple

# Add project root to path
sys.path.insert(0, str(Path(__file__).parent.parent))
Expand All @@ -20,7 +21,7 @@ def process_file(
file_path: Path,
loader: DatabaseLoader,
dry_run: bool = False,
) -> dict[str, int]:
) -> Dict[str, int]:
"""Process a single Excel file through the ETL pipeline."""
logger.info(f"Processing: {file_path.name}")

Expand Down
Loading
Loading