Skip to content

add logfire #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2025
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
8 changes: 8 additions & 0 deletions deploy_prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ PID_FILE="/home/pk/pk.pid"
LOG_DIR="/home/pk/logs"

cd ~/
source .env
cd python.or.kr

# SHA 환경변수가 없으면 현재 git 커밋의 SHA 값을 가져와서 설정
if [ -z "${SHA}" ]; then
export SHA=$(git rev-parse HEAD)
echo "SHA 환경변수가 없어서 현재 git SHA로 설정: ${SHA}"
fi

# shutdown exist gunicorn
if [ -f ${PID_FILE} ]; then
PID=$(cat $PID_FILE)
Expand Down
8 changes: 8 additions & 0 deletions pythonkr_backend/pythonkr_backend/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from pathlib import Path
import os
import logfire

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
Expand Down Expand Up @@ -170,3 +171,10 @@
BAKERY_VIEWS = (
"wagtailbakery.views.AllPublishedPagesView",
)



# setup logfire

logfire.configure(environment='base', service_name="web")
logfire.instrument_django()
7 changes: 6 additions & 1 deletion pythonkr_backend/pythonkr_backend/settings/localtesting.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path
import os
import logfire

from .base import *

Expand All @@ -25,4 +26,8 @@
# bakery

BAKERY_MULTISITE = True
BUILD_DIR = os.path.join("/app/bakery_static", "build")
BUILD_DIR = os.path.join("/app/bakery_static", "build")

# setup logfire
logfire.configure(environment='localtest')
logfire.instrument_django()
13 changes: 12 additions & 1 deletion pythonkr_backend/pythonkr_backend/settings/prod.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path
import os
import logfire

from .base import *

Expand All @@ -22,4 +23,14 @@
# bakery

BAKERY_MULTISITE = True
BUILD_DIR = os.path.join("/home/pk/bakery_static", "build")
BUILD_DIR = os.path.join("/home/pk/bakery_static", "build")


# service_version
sha_service_version = os.environ.get("SHA")

# logfire settings
logfire.configure(environment='prod', service_name="web", service_version=sha_service_version)
logfire.instrument_system_metrics()
logfire.instrument_django()
logfire.instrument_psycopg('psycopg')
Loading