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