legend1234 commited on
Commit
90c6c86
·
1 Parent(s): 8a16774
Files changed (4) hide show
  1. celery_config.py +0 -17
  2. gunicorn_config.py +0 -54
  3. nginx.conf +0 -62
  4. prometheus.yml +0 -20
celery_config.py DELETED
@@ -1,17 +0,0 @@
1
- from celery import Celery
2
-
3
- celery = Celery("procrustes_server", broker="redis://redis:6379/0", backend="redis://redis:6379/0")
4
-
5
- celery.conf.update(
6
- worker_max_tasks_per_child=1000,
7
- worker_prefetch_multiplier=1,
8
- task_acks_late=True,
9
- task_reject_on_worker_lost=True,
10
- broker_pool_limit=None,
11
- broker_connection_timeout=30,
12
- result_expires=3600, # Results expire after 1 hour
13
- task_track_started=True,
14
- task_time_limit=300, # 5 minutes
15
- task_soft_time_limit=240, # 4 minutes
16
- worker_concurrency=4, # Number of worker processes per Celery worker
17
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
gunicorn_config.py DELETED
@@ -1,54 +0,0 @@
1
- import multiprocessing
2
- import os
3
-
4
- # Number of worker processes - adjust based on CPU cores
5
- workers = 1
6
-
7
- # Number of threads per worker
8
- threads = 4
9
-
10
- # Maximum number of pending connections
11
- backlog = 2048
12
-
13
- # Maximum number of requests a worker will process before restarting
14
- max_requests = 10000
15
- max_requests_jitter = 50
16
-
17
- # Timeout for worker processes (2 minutes)
18
- timeout = 120
19
-
20
- # Keep-alive timeout
21
- keepalive = 5
22
-
23
- # Log settings
24
- loglevel = "info"
25
- accesslog = "-"
26
- errorlog = "-"
27
- access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
28
-
29
- # Bind address - use HF_PORT for Hugging Face deployment
30
- bind = "0.0.0.0:8009" # Match HF port
31
-
32
- # Worker class
33
- worker_class = "gthread" # Use gthread instead of sync
34
-
35
- # Process name
36
- proc_name = "selector_server"
37
-
38
- # Preload app for faster worker spawning
39
- preload_app = True
40
-
41
- # Graceful timeout
42
- graceful_timeout = 30
43
-
44
- # Server mechanics
45
- daemon = False
46
- pidfile = None
47
- umask = 0
48
- user = None
49
- group = None
50
- tmp_upload_dir = None
51
-
52
- # Logging
53
- capture_output = True
54
- enable_stdio_inheritance = False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
nginx.conf DELETED
@@ -1,62 +0,0 @@
1
- user nginx;
2
- worker_processes auto;
3
- error_log /var/log/nginx/error.log warn;
4
- pid /var/run/nginx.pid;
5
-
6
- events {
7
- worker_connections 4096;
8
- use epoll;
9
- multi_accept on;
10
- }
11
-
12
- http {
13
- include /etc/nginx/mime.types;
14
- default_type application/octet-stream;
15
-
16
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
17
- '$status $body_bytes_sent "$http_referer" '
18
- '"$http_user_agent" "$http_x_forwarded_for"';
19
-
20
- access_log /var/log/nginx/access.log main;
21
-
22
- sendfile on;
23
- tcp_nopush on;
24
- tcp_nodelay on;
25
- keepalive_timeout 65;
26
- types_hash_max_size 2048;
27
- client_max_body_size 32M;
28
-
29
- # Gzip compression
30
- gzip on;
31
- gzip_vary on;
32
- gzip_proxied any;
33
- gzip_comp_level 6;
34
- gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
35
-
36
- upstream selector_backend {
37
- server web:8008;
38
- }
39
-
40
- server {
41
- listen 8008;
42
- server_name localhost;
43
-
44
- location / {
45
- proxy_pass http://selector_backend;
46
- proxy_set_header Host $host;
47
- proxy_set_header X-Real-IP $remote_addr;
48
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
49
- proxy_set_header X-Forwarded-Proto $scheme;
50
- }
51
-
52
- location /flower/ {
53
- rewrite ^/flower/(.*)$ /$1 break;
54
- proxy_pass http://celery_flower:5555;
55
- proxy_set_header Host $host;
56
- proxy_redirect off;
57
- proxy_http_version 1.1;
58
- proxy_set_header Upgrade $http_upgrade;
59
- proxy_set_header Connection "upgrade";
60
- }
61
- }
62
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
prometheus.yml DELETED
@@ -1,20 +0,0 @@
1
- global:
2
- scrape_interval: 15s
3
- evaluation_interval: 15s
4
-
5
- scrape_configs:
6
- - job_name: 'prometheus'
7
- static_configs:
8
- - targets: ['localhost:9090']
9
-
10
- - job_name: 'flask'
11
- static_configs:
12
- - targets: ['web:8000']
13
-
14
- - job_name: 'redis'
15
- static_configs:
16
- - targets: ['redis-exporter:9121']
17
-
18
- - job_name: 'flower'
19
- static_configs:
20
- - targets: ['flower:5555']