Leon4gr45 commited on
Commit
de8a055
·
verified ·
1 Parent(s): 75d8158

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. deploy/nginx.conf +0 -13
  2. entrypoint.sh +4 -43
  3. run_acceptance_tests.py +14 -9
deploy/nginx.conf CHANGED
@@ -5,19 +5,6 @@ server {
5
 
6
  client_max_body_size 100M;
7
 
8
- location ~ ^/brains/[^/]+/mcp(/.*)?$ {
9
- proxy_pass http://127.0.0.1:8001;
10
- proxy_http_version 1.1;
11
- proxy_set_header Host $host;
12
- proxy_set_header X-Real-IP $remote_addr;
13
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14
- proxy_set_header X-Forwarded-Proto $scheme;
15
- proxy_set_header Connection "";
16
- proxy_buffering off;
17
- proxy_cache off;
18
- chunked_transfer_encoding off;
19
- }
20
-
21
  location / {
22
  proxy_pass http://127.0.0.1:8000;
23
  proxy_http_version 1.1;
 
5
 
6
  client_max_body_size 100M;
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  location / {
9
  proxy_pass http://127.0.0.1:8000;
10
  proxy_http_version 1.1;
entrypoint.sh CHANGED
@@ -126,38 +126,10 @@ REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p $REDIS_PORT shutdown 2
126
  sleep 1
127
 
128
  # 4. Nginx Setup
129
- cat <<'EOF' > /etc/nginx/conf.d/default.conf
130
- server {
131
- listen 7860 default_server;
132
- listen [::]:7860 default_server;
133
- server_name _;
134
-
135
- client_max_body_size 100M;
136
-
137
- location ~ ^/brains/[^/]+/mcp(/.*)?$ {
138
- proxy_pass http://127.0.0.1:8001;
139
- proxy_http_version 1.1;
140
- proxy_set_header Host $host;
141
- proxy_set_header X-Real-IP $remote_addr;
142
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
143
- proxy_set_header X-Forwarded-Proto $scheme;
144
- proxy_set_header Connection "";
145
- proxy_buffering off;
146
- proxy_cache off;
147
- chunked_transfer_encoding off;
148
- }
149
-
150
- location / {
151
- proxy_pass http://127.0.0.1:8000;
152
- proxy_http_version 1.1;
153
- proxy_set_header Host $host;
154
- proxy_set_header X-Real-IP $remote_addr;
155
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
156
- proxy_set_header X-Forwarded-Proto $scheme;
157
- }
158
- }
159
- EOF
160
- rm -f /etc/nginx/sites-enabled/default 2>/dev/null || true
161
 
162
  # 5. Plugin setup
163
  plugin_failure_policy="${PLUGIN_FAILURE_POLICY:-}"
@@ -232,17 +204,6 @@ stdout_logfile_maxbytes=0
232
  stderr_logfile=/dev/stderr
233
  stderr_logfile_maxbytes=0
234
 
235
- [program:brainapi-mcp]
236
- command=/app/.venv/bin/python -m src.services.mcp.main
237
- directory=/app
238
- autostart=true
239
- autorestart=true
240
- priority=10
241
- stdout_logfile=/dev/stdout
242
- stdout_logfile_maxbytes=0
243
- stderr_logfile=/dev/stderr
244
- stderr_logfile_maxbytes=0
245
-
246
  [program:brainapi-worker]
247
  command=/app/.venv/bin/python -m celery -A src.services.tasks.main.celery_app worker --loglevel=info
248
  directory=/app
 
126
  sleep 1
127
 
128
  # 4. Nginx Setup
129
+ if [ -f /app/deploy/nginx.conf ]; then
130
+ cp /app/deploy/nginx.conf /etc/nginx/conf.d/default.conf
131
+ rm -f /etc/nginx/sites-enabled/default 2>/dev/null || true
132
+ fi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
  # 5. Plugin setup
135
  plugin_failure_policy="${PLUGIN_FAILURE_POLICY:-}"
 
204
  stderr_logfile=/dev/stderr
205
  stderr_logfile_maxbytes=0
206
 
 
 
 
 
 
 
 
 
 
 
 
207
  [program:brainapi-worker]
208
  command=/app/.venv/bin/python -m celery -A src.services.tasks.main.celery_app worker --loglevel=info
209
  directory=/app
run_acceptance_tests.py CHANGED
@@ -28,44 +28,49 @@ status, body = req("/health")
28
  print(f"Status: {status}, Body: {body}")
29
  assert status == 200
30
 
31
- print("2. Testing GET /system/workspaces...")
 
 
 
 
 
32
  status, body = req("/system/workspaces")
33
  print(f"Status: {status}, Body: {body}")
34
  assert status == 200
35
 
36
- print("3. Testing POST /system/workspaces (create workspace alpha)...")
37
  try:
38
  status, body = req("/system/workspaces", method="POST", data={"slug": "alpha", "display_name": "Alpha Workspace"})
39
  print(f"Status: {status}, Body: {body}")
40
  except urllib.error.HTTPError as e:
41
  print("Post error (might already exist):", e.code, e.read().decode("utf-8"))
42
 
43
- print("4. Testing GET /brains/alpha/api...")
44
  status, body = req("/brains/alpha/api")
45
  print(f"Status: {status}")
46
  assert status == 200
47
 
48
- print("5. Testing GET /brains/alpha/agent/capabilities...")
49
  status, body = req("/brains/alpha/agent/capabilities")
50
  print(f"Status: {status}, Body: {body}")
51
  assert status == 200
52
 
53
- print("6. Testing POST /brains/alpha/agent/memory...")
54
  status, body = req("/brains/alpha/agent/memory", method="POST", data={"text": "User prefers concise summaries."})
55
  print(f"Status: {status}, Body: {body}")
56
- assert status == 200
57
  task_id = body.get("task_id") or body.get("id")
58
 
59
  if task_id:
60
- print(f"7. Testing GET /brains/alpha/agent/tasks/{task_id}...")
61
- for _ in range(10):
62
  status, body = req(f"/brains/alpha/agent/tasks/{task_id}")
63
  print(f"Task status: {body.get('status')}")
64
  if body.get("status") in ("completed", "failed", "success"):
65
  break
66
  time.sleep(2)
67
 
68
- print("8. Testing MCP initialize on /brains/alpha/mcp...")
69
  status, body = req("/brains/alpha/mcp", method="POST", data={
70
  "jsonrpc": "2.0",
71
  "id": 1,
 
28
  print(f"Status: {status}, Body: {body}")
29
  assert status == 200
30
 
31
+ print("2. Testing GET /console/...")
32
+ status, body = req("/console/")
33
+ print(f"Status: {status}")
34
+ assert status == 200
35
+
36
+ print("3. Testing GET /system/workspaces...")
37
  status, body = req("/system/workspaces")
38
  print(f"Status: {status}, Body: {body}")
39
  assert status == 200
40
 
41
+ print("4. Testing POST /system/workspaces (create workspace alpha)...")
42
  try:
43
  status, body = req("/system/workspaces", method="POST", data={"slug": "alpha", "display_name": "Alpha Workspace"})
44
  print(f"Status: {status}, Body: {body}")
45
  except urllib.error.HTTPError as e:
46
  print("Post error (might already exist):", e.code, e.read().decode("utf-8"))
47
 
48
+ print("5. Testing GET /brains/alpha/api...")
49
  status, body = req("/brains/alpha/api")
50
  print(f"Status: {status}")
51
  assert status == 200
52
 
53
+ print("6. Testing GET /brains/alpha/agent/capabilities...")
54
  status, body = req("/brains/alpha/agent/capabilities")
55
  print(f"Status: {status}, Body: {body}")
56
  assert status == 200
57
 
58
+ print("7. Testing POST /brains/alpha/agent/memory...")
59
  status, body = req("/brains/alpha/agent/memory", method="POST", data={"text": "User prefers concise summaries."})
60
  print(f"Status: {status}, Body: {body}")
61
+ assert status in (200, 202)
62
  task_id = body.get("task_id") or body.get("id")
63
 
64
  if task_id:
65
+ print(f"8. Testing GET /brains/alpha/agent/tasks/{task_id}...")
66
+ for _ in range(15):
67
  status, body = req(f"/brains/alpha/agent/tasks/{task_id}")
68
  print(f"Task status: {body.get('status')}")
69
  if body.get("status") in ("completed", "failed", "success"):
70
  break
71
  time.sleep(2)
72
 
73
+ print("9. Testing MCP initialize on /brains/alpha/mcp...")
74
  status, body = req("/brains/alpha/mcp", method="POST", data={
75
  "jsonrpc": "2.0",
76
  "id": 1,