Add web server to cluster demo and fix port bug

- Add web server integration to cluster_demo.sh script
  - Configure web server port (8090)
  - Update build_if_needed() to check for toastyfs_web binary
  - Add get_web_binary() function
  - Start web server after chunk servers
  - Update status display to show web server
  - Update help text to show HTTP interface

- Fix bug in web/main.c where --local-port incorrectly set
  upstream_port instead of local_port

The cluster demo now starts a full cluster with:
- Metadata server on port 8080 (ToastyFS protocol)
- N chunk servers starting from port 8081
- Web server on port 8090 (HTTP interface)
This commit is contained in:
Claude
2025-11-23 09:03:13 +01:00
committed by cozis
parent b661f18214
commit cc758a5d3a
2 changed files with 57 additions and 9 deletions
+7 -4
View File
@@ -10,6 +10,8 @@
#define UNREACHABLE __builtin_trap()
#define MAX_PROXIED_OPERATIONS (1<<10)
typedef enum {
PROXIED_OPERATION_FREE,
PROXIED_OPERATION_CREATE_DIR,
@@ -43,8 +45,6 @@ typedef struct {
} ProxiedOperation;
#define MAX_PROXIED_OPERATIONS (1<<10)
static int find_unused_struct(ProxiedOperation *arr, int num)
{
if (num == MAX_PROXIED_OPERATIONS)
@@ -116,7 +116,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Error: Invalid port %s\n", argv[i]);
return -1;
}
upstream_port = (uint16_t) tmp;
local_port = (uint16_t) tmp;
} else {
fprintf(stderr, "Error: Invalid option %s\n", argv[i]);
return -1;
@@ -146,6 +146,9 @@ int main(int argc, char **argv)
int num_proxied = 0;
ProxiedOperation proxied[MAX_PROXIED_OPERATIONS];
for (int i = 0; i < MAX_PROXIED_OPERATIONS; i++)
proxied[i].type = PROXIED_OPERATION_FREE;
for (;;) {
#define POLL_CAPACITY (HTTP_SERVER_POLL_CAPACITY + TOASTY_POLL_CAPACITY)
@@ -160,7 +163,7 @@ int main(int argc, char **argv)
reg = (EventRegister) {
.ptrs=ptrs,
.polled=polled,
.max_polled=POLL_CAPACITY,
.max_polled=HTTP_SERVER_POLL_CAPACITY,
.num_polled=0,
};
if (http_server_register_events(&server, &reg) < 0) {