Skip to content

Commit 34cb90f

Browse files
authored
Merge pull request #19 from darjeeling/trans_article
add logfire
2 parents 9f0260d + 3eb583f commit 34cb90f

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

deploy_prod.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ PID_FILE="/home/pk/pk.pid"
44
LOG_DIR="/home/pk/logs"
55

66
cd ~/
7+
source .env
78
cd python.or.kr
9+
10+
# SHA 환경변수가 없으면 현재 git 커밋의 SHA 값을 가져와서 설정
11+
if [ -z "${SHA}" ]; then
12+
export SHA=$(git rev-parse HEAD)
13+
echo "SHA 환경변수가 없어서 현재 git SHA로 설정: ${SHA}"
14+
fi
15+
816
# shutdown exist gunicorn
917
if [ -f ${PID_FILE} ]; then
1018
PID=$(cat $PID_FILE)

pythonkr_backend/pythonkr_backend/settings/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from pathlib import Path
1414
import os
15+
import logfire
1516

1617
# Build paths inside the project like this: BASE_DIR / 'subdir'.
1718
BASE_DIR = Path(__file__).resolve().parent.parent.parent
@@ -170,3 +171,10 @@
170171
BAKERY_VIEWS = (
171172
"wagtailbakery.views.AllPublishedPagesView",
172173
)
174+
175+
176+
177+
# setup logfire
178+
179+
logfire.configure(environment='base', service_name="web")
180+
logfire.instrument_django()

pythonkr_backend/pythonkr_backend/settings/localtesting.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pathlib import Path
22
import os
3+
import logfire
34

45
from .base import *
56

@@ -25,4 +26,8 @@
2526
# bakery
2627

2728
BAKERY_MULTISITE = True
28-
BUILD_DIR = os.path.join("/app/bakery_static", "build")
29+
BUILD_DIR = os.path.join("/app/bakery_static", "build")
30+
31+
# setup logfire
32+
logfire.configure(environment='localtest')
33+
logfire.instrument_django()

pythonkr_backend/pythonkr_backend/settings/prod.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pathlib import Path
22
import os
3+
import logfire
34

45
from .base import *
56

@@ -22,4 +23,14 @@
2223
# bakery
2324

2425
BAKERY_MULTISITE = True
25-
BUILD_DIR = os.path.join("/home/pk/bakery_static", "build")
26+
BUILD_DIR = os.path.join("/home/pk/bakery_static", "build")
27+
28+
29+
# service_version
30+
sha_service_version = os.environ.get("SHA")
31+
32+
# logfire settings
33+
logfire.configure(environment='prod', service_name="web", service_version=sha_service_version)
34+
logfire.instrument_system_metrics()
35+
logfire.instrument_django()
36+
logfire.instrument_psycopg('psycopg')

0 commit comments

Comments
 (0)