File size: 2,079 Bytes
c1a43bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96e1383
 
c1a43bf
 
 
 
96e1383
c1a43bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96e1383
c1a43bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96e1383
c1a43bf
 
96e1383
c1a43bf
96e1383
 
 
c1a43bf
96e1383
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
; ============================================
; Supervisord Configuration for Hugging Face Spaces
; Manages both Go API Server and Streamlit Frontend
; ============================================

[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
loglevel=info
logfile_maxbytes=10MB
logfile_backups=3

; ============================================
; Go API Server - CLIProxyAPI Plus (Optional)
; Only starts if CLIProxyAPIPlus binary exists
; ============================================
[program:go-server]
command=/app/go-server/CLIProxyAPIPlus
directory=/app/go-server
autostart=false
autorestart=true
startsecs=10
stopwaitsecs=30
startretries=3
stopasgroup=true
killasgroup=true
stdout_logfile=/var/log/supervisor/go-server.log
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=3
stderr_logfile=/var/log/supervisor/go-server-error.log
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=3
environment=HOME="/root",DEPLOY="true"

; ============================================
; Streamlit Frontend (Always runs)
; ============================================
[program:streamlit]
command=streamlit run /app/streamlit/app.py --server.port=7860 --server.address=0.0.0.0
directory=/app/streamlit
autostart=true
autorestart=true
startsecs=5
stopwaitsecs=10
startretries=3
stopasgroup=true
killasgroup=true
stdout_logfile=/var/log/supervisor/streamlit.log
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=3
stderr_logfile=/var/log/supervisor/streamlit-error.log
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=3
environment=HOME="/root",STREAMLIT_SERVER_HEADLESS="true"

; ============================================
; Event Listener for Go Server Auto-Start
; ============================================
[eventlistener:go_server_checker]
command=bash -c "if [ -f /app/go-server/CLIProxyAPIPlus ]; then supervisorctl start go-server; fi"
events=PROCESS_STATE_RUNNING
buffer_size=100
stdout_logfile=/var/log/supervisor/go-server-checker.log
stderr_logfile=/var/log/supervisor/go-server-checker-error.log