Skip to content

Commit d64de12

Browse files
committed
add deploy_prod.sh
1 parent 15637b3 commit d64de12

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

deploy_prod.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
PID_FILE="/home/pk/pk.pid"
4+
LOG_DIR="/home/pk/logs"
5+
6+
cd ~/
7+
cd python.or.kr
8+
# shutdown exist gunicorn
9+
if [ -f ${PID_FILE} ]; then
10+
PID=$(cat $PID_FILE)
11+
kill -TERM $PID
12+
rm ${PID_FILE}
13+
fi
14+
15+
mkdir -p ${LOG_DIR}
16+
17+
# update changes before update
18+
# git pull
19+
source .venv/bin/activate
20+
uv sync
21+
cd pythonkr_backend
22+
export DJANGO_SETTINGS_MODULE="pythonkr_backend.settings.prod"
23+
./manage.py migrate --no-input
24+
./manage.py collectstatic --clear --noinput
25+
gunicorn --workers=2 \
26+
-b :2026 \
27+
--access-logfile ${LOG_DIR}/access.log \
28+
--error-logfile ${LOG_DIR}/error.log \
29+
--daemon \
30+
--pid ${PID_FILE} \
31+
pythonkr_backend.wsgi

0 commit comments

Comments
 (0)