수정사항

This commit is contained in:
2025-12-26 22:22:08 +09:00
parent af9a38a973
commit 0c53e1d2f2
4 changed files with 96 additions and 4 deletions

4
.gitignore vendored
View File

@@ -129,7 +129,7 @@ dmypy.json
# FlaksFarm
config.yaml
# config.yaml
lib2/
.vscode/
memo.txt
@@ -141,7 +141,7 @@ pre_start.sh
*.code-workspace
false
*copy.py
*.sh
# *.sh
data/
tmp/
lib/support/site/tving.py

51
config.yaml Normal file
View File

@@ -0,0 +1,51 @@
path_data: '.'
##########################################################################
# 데이터 폴더 루트 경로
# 윈도우의 경우 폴더 구분 기호 \ 를 두개 사용
# 예) data_folder: "C:\\work\\data"
# 현재 폴더인 경우 .
#path_data: "."
# 개발용 플러그인 경로
path_dev: '/Volumes/WD/Users/Work/python/ff_dev_plugins'
# gevent 사용여부
# 플러그인 개발이나 termux 환경에서의 실행 같이 특수한 경우에만 false로 사용.
# 실행환경에 gevent 관련 패키지가 설치되어 있지 않는다면 값과 상관 없이 false로 동작.
use_gevent: true
# celery 사용 여부
use_celery: true
# redis port
# celery를 사용하는 경우 사용하는 redis 포트
# 환경변수 REDIS_PORT 값이 있는 경우 무시됨.
#redis_port: 6379
# 포트
# 생략시 DB 값을 사용.
port: 9099
# 소스 수정시 재로딩
# 두번 로딩되는 것을 감안하여 코딩해야 함.
debug: false
# debug: true
# 플러그인 업데이트 여부
# - true인 경우 로딩시 플러그인을 업데이트 함.
# /data/plugins 폴더에 있는 플러그인 만을 대상으로 함.
# - debug 값이 true인 경우에는 항상 false
plugin_update: false
# running_type
# termux, entware 인 경우 입력 함.
running_type: 'native'
# 개발용 폴더만 로딩할 경우 사용
# plugin_loading_only_devpath: true
# 로딩할 플러그인 package 명
# 타 플러그인과 연동되는 플러그인 개발시 사용.
# import 로 런타임에 로딩할 수 있지만 타 패키지 메뉴 등은 표시되지 않음.
#plugin_loading_list: ['command', 'flaskcode']
# 로딩 제외할 플러그인 package 명
plugin_except_list: ['.idea', '.git', '.vscode', '.nova', '.mypy_cache']

38
gommi.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
CONFIGFILE="./config.yaml"
COUNT=0
# 🔧 서버 시작 전에 플러그인 업데이트
update_plugins() {
PLUGINS_DIR="./data/plugins"
if [ -d "$PLUGINS_DIR" ]; then
for dir in "$PLUGINS_DIR"/*/; do
if [ -d "$dir/.git" ]; then
echo "Updating plugin: $dir"
git -C "$dir" reset --hard HEAD 2>/dev/null
git -C "$dir" pull 2>/dev/null & # 병렬 실행
fi
done
wait # 모든 git pull 완료 대기
fi
}
# 첫 실행 시 또는 --update 옵션일 때만
if [ "$COUNT" = "0" ]; then
update_plugins
fi
while true;
do
python -m flaskfarm.main --repeat ${COUNT} --config ${CONFIGFILE}
RESULT=$?
echo "PYTHON EXIT CODE : ${RESULT}.............."
if [ "$RESULT" = "1" ]; then
echo 'REPEAT....'
update_plugins # 재시작 시에도 업데이트
else
echo 'FINISH....'
break
fi
COUNT=`expr $COUNT + 1`
done

View File

@@ -33,8 +33,11 @@ try:
package_name = "python-socketio"
version = importlib.metadata.version(package_name)
# 개선 (비동기 + 로깅)
if int(version.replace(".", "")) < 580:
os.system(f"pip install --upgrade {package_name}")
import subprocess
subprocess.Popen(["pip", "install", "--upgrade", package_name],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except Exception:
pass