Skip to content
Merged
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
22 changes: 22 additions & 0 deletions scripts/deploy-prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# src 디렉토리로 이동
cd "$(dirname "$0")/../src" || exit

# 실행 중인 Gunicorn 프로세스 종료
echo "Stopping Gunicorn..."
killall gunicorn 2>/dev/null || echo "No Gunicorn processes found."

# 실행 중인 Celery 워커 프로세스 종료
echo "Stopping Celery workers..."
pkill -f "celery -A celery_worker worker" 2>/dev/null || echo "No Celery worker processes found."

# 새로운 Celery 워커 시작
echo "Starting Celery workers..."
PYTHONPATH=$(pwd) /home/ubuntu/.cache/pypoetry/virtualenvs/tellingme-python-server-p3Rjg27q-py3.12/bin/python -m celery -A celery_worker worker --loglevel=info --concurrency=1 &

# 새로운 Gunicorn 시작
echo "Starting Gunicorn..."
poetry run nohup gunicorn main:app --workers 2 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 >> gunicorn.log 2>&1 &

echo "Services restarted successfully."
2 changes: 1 addition & 1 deletion src/app/v2/answers/models/answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from app.v2.answers.querys.answer_query import (
SELECT_ANSWER_BY_USER_UUID_QUERY,
SELECT_ANSWER_COUNT_BY_USER_UUID_QUERY,
SELECT_MOST_RECENT_ANSWER_BY_USER_UUID_QUERY,
SELECT_ANSWER_COUNT_BY_USER_UUID_QUERY_V2,
SELECT_MOST_RECENT_ANSWER_BY_USER_UUID_QUERY,
)
from app.v2.users.models.user import User
from common.utils.query_executor import QueryExecutor
Expand Down
18 changes: 17 additions & 1 deletion src/app/v2/missions/router.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from fastapi import APIRouter
from typing import Any

from fastapi import APIRouter, Depends

from app.v2.missions.services.mission_service import MissionService
from core.configs.celery_settings import process_mission_in_background

router = APIRouter(prefix="/mission", tags=["Mission"])
Expand All @@ -8,3 +11,16 @@
@router.get("")
async def mission_handler(user_id: str) -> None:
process_mission_in_background.delay(user_id)


@router.get("/direct")
async def mission_handler_direct(
user_id: str,
mission_service: MissionService = Depends(),
) -> dict[str, Any]:
await mission_service.update_mission_progress(user_id=user_id)
return {
"code": 200,
"message": "success",
"data": True,
}
Loading