mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-08-16 01:36:41 +08:00
start_frp()
This commit is contained in:
parent
a34424a6a8
commit
6b9b8b89b9
29
main.py
29
main.py
@ -145,25 +145,36 @@ def trigger_vercel_deploy():
|
|||||||
print(f"An error occurred: {req_err}")
|
print(f"An error occurred: {req_err}")
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import random
|
||||||
|
|
||||||
def start_frp():
|
def start_frp():
|
||||||
# !cat /kaggle/working/frpc.toml
|
# !cat /kaggle/working/frpc.toml
|
||||||
# subprocess.Popen(["sed", "-i", f"s/8188/{port}/g", "/kaggle/working/frpc.toml"],shell=False)
|
# subprocess.Popen(["sed", "-i", f"s/8188/{port}/g", "/kaggle/working/frpc.toml"],shell=False)
|
||||||
|
|
||||||
|
port = 27666 # 根据 args.frp_remote_port_idx 随机一个端口
|
||||||
|
|
||||||
|
if args.frp_remote_port_idx is not None:
|
||||||
|
if args.frp_remote_port_idx == 3:
|
||||||
|
port = random.randint(27001, 28000)
|
||||||
|
elif args.frp_remote_port_idx == 4:
|
||||||
|
port = random.randint(28001, 29000)
|
||||||
|
elif args.frp_remote_port_idx == 5:
|
||||||
|
port = random.randint(29001, 30000)
|
||||||
|
else:
|
||||||
|
port = random.randint(30001, 31000)
|
||||||
|
else:
|
||||||
|
port = random.randint(30001, 31000)
|
||||||
|
|
||||||
|
subprocess.Popen(["sed", "-i", f"s/REMOTE_PORT/{port}/g", "/kaggle/working/frpc.toml"],shell=False)
|
||||||
subprocess.run(['chmod', '+x', '/kaggle/working/frpc'], check=True)
|
subprocess.run(['chmod', '+x', '/kaggle/working/frpc'], check=True)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
subprocess.Popen(['/kaggle/working/frpc', '-c', '/kaggle/working/frpc.toml'])
|
subprocess.Popen(['/kaggle/working/frpc', '-c', '/kaggle/working/frpc.toml'])
|
||||||
print(f'frp已经启动')
|
print(f'frp已经启动')
|
||||||
|
|
||||||
|
notion.add_record_to_notion_database(f"http://117.72.185.137:{port}/")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# start_frp()
|
start_frp()
|
||||||
# frp_remote_port_idx: 3, 4, 5, 6....
|
|
||||||
if args.frp_remote_port_idx is not None:
|
|
||||||
if args.frp_remote_port_idx == -1:
|
|
||||||
notion.add_record_to_notion_database(f"http://111.170.148.226:21673/")
|
|
||||||
else:
|
|
||||||
notion.add_record_to_notion_database(f"http://111.170.148.226:2166{args.frp_remote_port_idx}/")
|
|
||||||
else:
|
|
||||||
print("frp_remote_port_idx is None, no records will be added to notion database")
|
|
||||||
|
|
||||||
print("disable_trigger_vercel_deploy: ", args.disable_trigger_vercel_deploy)
|
print("disable_trigger_vercel_deploy: ", args.disable_trigger_vercel_deploy)
|
||||||
if args.disable_trigger_vercel_deploy is None:
|
if args.disable_trigger_vercel_deploy is None:
|
||||||
|
|||||||
38
script.sh
38
script.sh
@ -121,23 +121,23 @@ cp -p /kaggle/working/frp_0.54.0_linux_amd64/frpc /kaggle/working/frpc
|
|||||||
cp -p /kaggle/ComfyUI/template_frpc /kaggle/working/frpc.toml
|
cp -p /kaggle/ComfyUI/template_frpc /kaggle/working/frpc.toml
|
||||||
|
|
||||||
# 1, 2 主要是为了兼容之前的comfyUI notebook(不想一个一个的去修改了)
|
# 1, 2 主要是为了兼容之前的comfyUI notebook(不想一个一个的去修改了)
|
||||||
FRP_CONFIG_FILE="/kaggle/working/frpc.toml"
|
# FRP_CONFIG_FILE="/kaggle/working/frpc.toml"
|
||||||
CHOICE="$1"
|
# CHOICE="$1"
|
||||||
if [ "$CHOICE" -eq 3 ]; then
|
# if [ "$CHOICE" -eq 3 ]; then
|
||||||
TARGET_REMOTE_PORT="21663"
|
# TARGET_REMOTE_PORT="21663"
|
||||||
elif [ "$CHOICE" -eq 4 ]; then
|
# elif [ "$CHOICE" -eq 4 ]; then
|
||||||
TARGET_REMOTE_PORT="21664"
|
# TARGET_REMOTE_PORT="21664"
|
||||||
|
|
||||||
elif [ "$CHOICE" -eq 5 ]; then
|
# elif [ "$CHOICE" -eq 5 ]; then
|
||||||
TARGET_REMOTE_PORT="21665"
|
# TARGET_REMOTE_PORT="21665"
|
||||||
elif [ "$CHOICE" -eq 6 ]; then
|
# elif [ "$CHOICE" -eq 6 ]; then
|
||||||
TARGET_REMOTE_PORT="21666"
|
# TARGET_REMOTE_PORT="21666"
|
||||||
elif [ "$CHOICE" -eq -1 ]; then
|
# elif [ "$CHOICE" -eq -1 ]; then
|
||||||
TARGET_REMOTE_PORT="21673"
|
# TARGET_REMOTE_PORT="21673"
|
||||||
else
|
# else
|
||||||
echo "Invalid CHOICE: $CHOICE"
|
# echo "Invalid CHOICE: $CHOICE"
|
||||||
echo "Only 1 or 2 are supported."
|
# echo "Only 1 or 2 are supported."
|
||||||
exit 1 # 退出并返回错误码
|
# exit 1 # 退出并返回错误码
|
||||||
fi
|
# fi
|
||||||
sed -i "s/REMOTE_PORT/$TARGET_REMOTE_PORT/g" "$FRP_CONFIG_FILE"
|
# sed -i "s/REMOTE_PORT/$TARGET_REMOTE_PORT/g" "$FRP_CONFIG_FILE"
|
||||||
sleep 2
|
# sleep 2
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
serverAddr = '111.170.148.226'
|
serverAddr = '117.72.185.137'
|
||||||
serverPort = 21661
|
serverPort = 27000
|
||||||
auth.method = "token"
|
auth.method = "token"
|
||||||
auth.token = "072083"
|
auth.token = "xF5kJa#v"
|
||||||
|
|
||||||
[[proxies]]
|
[[proxies]]
|
||||||
name = 'web-REMOTE_PORT'
|
name = 'web-REMOTE_PORT'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user