validops-east-1 commited on
Commit
6cd5bf4
·
1 Parent(s): aaec145
.env.example CHANGED
@@ -92,14 +92,14 @@ SELF_PING_URL=
92
  # The main app reverse-proxies /api/whatsapp/* to the WhatsApp service.
93
  # When the image embeds the binary (start.sh) the gateway is auto-enabled;
94
  # set explicitly to control it. WHATSAPP_SERVICE_URL may be a service name
95
- # (http://whatsapp-service:8080) when the WhatsApp service runs as a separate
96
  # container, or loopback when co-hosted in this image.
97
  WHATSAPP_SERVICE_ENABLED=false
98
- WHATSAPP_SERVICE_URL=http://127.0.0.1:8080
99
  WHATSAPP_SERVICE_TIMEOUT=30
100
  WHATSAPP_SERVICE_CONNECT_TIMEOUT=5
101
  # Port start.sh launches the embedded Go binary on (its SERVER_PORT).
102
- WHATSAPP_SERVICE_PORT=8080
103
 
104
  # --- Settings forwarded to the Go service (start.sh / Docker) ---
105
  # Global API key of the WhatsApp service. Used by the gateway as the default
 
92
  # The main app reverse-proxies /api/whatsapp/* to the WhatsApp service.
93
  # When the image embeds the binary (start.sh) the gateway is auto-enabled;
94
  # set explicitly to control it. WHATSAPP_SERVICE_URL may be a service name
95
+ # (http://whatsapp-service:8231) when the WhatsApp service runs as a separate
96
  # container, or loopback when co-hosted in this image.
97
  WHATSAPP_SERVICE_ENABLED=false
98
+ WHATSAPP_SERVICE_URL=http://127.0.0.1:8231
99
  WHATSAPP_SERVICE_TIMEOUT=30
100
  WHATSAPP_SERVICE_CONNECT_TIMEOUT=5
101
  # Port start.sh launches the embedded Go binary on (its SERVER_PORT).
102
+ WHATSAPP_SERVICE_PORT=8231
103
 
104
  # --- Settings forwarded to the Go service (start.sh / Docker) ---
105
  # Global API key of the WhatsApp service. Used by the gateway as the default
app/config.py CHANGED
@@ -198,10 +198,10 @@ class Settings(BaseSettings):
198
  # WhatsApp service gateway. The main FastAPI app acts as a reverse proxy to
199
  # the internal AgentDeck WhatsApp service (a Go application). Set
200
  # WHATSAPP_SERVICE_ENABLED=true and point WHATSAPP_SERVICE_URL at the
201
- # internal service (e.g. http://localhost:8080 when co-hosted, or
202
- # http://whatsapp-service:8080 in a Docker network).
203
  whatsapp_service_enabled: bool = Field(default=False, alias="WHATSAPP_SERVICE_ENABLED")
204
- whatsapp_service_url: str = Field(default="http://localhost:8080", alias="WHATSAPP_SERVICE_URL")
205
  whatsapp_service_timeout: float = Field(default=30.0, alias="WHATSAPP_SERVICE_TIMEOUT")
206
  whatsapp_service_connect_timeout: float = Field(default=5.0, alias="WHATSAPP_SERVICE_CONNECT_TIMEOUT")
207
  # Global API key of the WhatsApp service (GLOBAL_API_KEY). Used as the
 
198
  # WhatsApp service gateway. The main FastAPI app acts as a reverse proxy to
199
  # the internal AgentDeck WhatsApp service (a Go application). Set
200
  # WHATSAPP_SERVICE_ENABLED=true and point WHATSAPP_SERVICE_URL at the
201
+ # internal service (e.g. http://localhost:8231 when co-hosted, or
202
+ # http://whatsapp-service:8231 in a Docker network).
203
  whatsapp_service_enabled: bool = Field(default=False, alias="WHATSAPP_SERVICE_ENABLED")
204
+ whatsapp_service_url: str = Field(default="http://localhost:8231", alias="WHATSAPP_SERVICE_URL")
205
  whatsapp_service_timeout: float = Field(default=30.0, alias="WHATSAPP_SERVICE_TIMEOUT")
206
  whatsapp_service_connect_timeout: float = Field(default=5.0, alias="WHATSAPP_SERVICE_CONNECT_TIMEOUT")
207
  # Global API key of the WhatsApp service (GLOBAL_API_KEY). Used as the
docs/whatsapp-gateway.md CHANGED
@@ -11,7 +11,7 @@ Client
11
  Main FastAPI :7860
12
  | /api/whatsapp/...
13
  v
14
- WhatsApp Service (internal, e.g. http://localhost:8080)
15
  |
16
  v
17
  Client
@@ -40,7 +40,7 @@ Single Docker container (Hugging Face Spaces style): the Go binary is compiled
40
  in a multi-stage `whatsapp-build` stage and embedded in the image at
41
  `/app/whatsapp-service/server`. `start.sh` launches it as a sibling process and
42
  `uvicorn` is the primary process. The gateway reaches it over loopback
43
- (`http://127.0.0.1:8080`).
44
 
45
  A crash of the WhatsApp service does **not** take the main app down: the gateway
46
  returns sanitized `502`/`503` responses until it recovers (restart loop every
@@ -66,11 +66,11 @@ returns sanitized `502`/`503` responses until it recovers (restart loop every
66
  | Variable | Default | Description |
67
  |---|---|---|
68
  | `WHATSAPP_SERVICE_ENABLED` | `false` | Enable the gateway routes. `start.sh` auto-enables it when the binary exists. |
69
- | `WHATSAPP_SERVICE_URL` | `http://localhost:8080` | Base URL of the internal WhatsApp service. |
70
  | `WHATSAPP_SERVICE_TIMEOUT` | `30` | Read/write/pool timeout for upstream calls (seconds). |
71
  | `WHATSAPP_SERVICE_CONNECT_TIMEOUT` | `5` | Connect timeout for upstream calls (seconds). |
72
  | `WHATSAPP_SERVICE_GLOBAL_API_KEY` | _(empty)_ | The WhatsApp service `GLOBAL_API_KEY`, injected as the default `apikey` header. |
73
- | `WHATSAPP_SERVICE_PORT` | `8080` | Port `start.sh` uses to launch the embedded binary (`SERVER_PORT`). |
74
  | `WHATSAPP_SERVICE_BINARY` | `/app/whatsapp-service/server` | Path to the embedded binary. |
75
 
76
  ### WhatsApp service env vars (centralized in the main app)
 
11
  Main FastAPI :7860
12
  | /api/whatsapp/...
13
  v
14
+ WhatsApp Service (internal, e.g. http://localhost:8231)
15
  |
16
  v
17
  Client
 
40
  in a multi-stage `whatsapp-build` stage and embedded in the image at
41
  `/app/whatsapp-service/server`. `start.sh` launches it as a sibling process and
42
  `uvicorn` is the primary process. The gateway reaches it over loopback
43
+ (`http://127.0.0.1:8231`).
44
 
45
  A crash of the WhatsApp service does **not** take the main app down: the gateway
46
  returns sanitized `502`/`503` responses until it recovers (restart loop every
 
66
  | Variable | Default | Description |
67
  |---|---|---|
68
  | `WHATSAPP_SERVICE_ENABLED` | `false` | Enable the gateway routes. `start.sh` auto-enables it when the binary exists. |
69
+ | `WHATSAPP_SERVICE_URL` | `http://localhost:8231` | Base URL of the internal WhatsApp service. |
70
  | `WHATSAPP_SERVICE_TIMEOUT` | `30` | Read/write/pool timeout for upstream calls (seconds). |
71
  | `WHATSAPP_SERVICE_CONNECT_TIMEOUT` | `5` | Connect timeout for upstream calls (seconds). |
72
  | `WHATSAPP_SERVICE_GLOBAL_API_KEY` | _(empty)_ | The WhatsApp service `GLOBAL_API_KEY`, injected as the default `apikey` header. |
73
+ | `WHATSAPP_SERVICE_PORT` | `8231` | Port `start.sh` uses to launch the embedded binary (`SERVER_PORT`). |
74
  | `WHATSAPP_SERVICE_BINARY` | `/app/whatsapp-service/server` | Path to the embedded binary. |
75
 
76
  ### WhatsApp service env vars (centralized in the main app)
start.sh CHANGED
@@ -99,7 +99,7 @@ fi
99
  # ─────────────────────────────────────────────────────────────────────────────
100
 
101
  WHATSAPP_SERVICE_BINARY="${WHATSAPP_SERVICE_BINARY:-/app/whatsapp-service/server}"
102
- WHATSAPP_SERVICE_PORT="${WHATSAPP_SERVICE_PORT:-8080}"
103
  WHATSAPP_SERVICE_ENABLED="${WHATSAPP_SERVICE_ENABLED:-}"
104
  WHATSAPP_PID=""
105
 
 
99
  # ─────────────────────────────────────────────────────────────────────────────
100
 
101
  WHATSAPP_SERVICE_BINARY="${WHATSAPP_SERVICE_BINARY:-/app/whatsapp-service/server}"
102
+ WHATSAPP_SERVICE_PORT="${WHATSAPP_SERVICE_PORT:-8231}"
103
  WHATSAPP_SERVICE_ENABLED="${WHATSAPP_SERVICE_ENABLED:-}"
104
  WHATSAPP_PID=""
105
 
whatsapp-service/Makefile CHANGED
@@ -252,12 +252,12 @@ status: ## Verifica status da aplicação
252
  profile-cpu: ## Profile de CPU (requer aplicação rodando)
253
  @echo "$(GREEN)📊 Capturando profile de CPU...$(NC)"
254
  curl http://localhost:4000/debug/pprof/profile?seconds=30 > cpu.prof
255
- $(GO) tool pprof -http=:8080 cpu.prof
256
 
257
  profile-mem: ## Profile de memória (requer aplicação rodando)
258
  @echo "$(GREEN)📊 Capturando profile de memória...$(NC)"
259
  curl http://localhost:4000/debug/pprof/heap > mem.prof
260
- $(GO) tool pprof -http=:8080 mem.prof
261
 
262
  generate: ## Roda go generate
263
  @echo "$(GREEN)⚙️ Executando go generate...$(NC)"
 
252
  profile-cpu: ## Profile de CPU (requer aplicação rodando)
253
  @echo "$(GREEN)📊 Capturando profile de CPU...$(NC)"
254
  curl http://localhost:4000/debug/pprof/profile?seconds=30 > cpu.prof
255
+ $(GO) tool pprof -http=:8231 cpu.prof
256
 
257
  profile-mem: ## Profile de memória (requer aplicação rodando)
258
  @echo "$(GREEN)📊 Capturando profile de memória...$(NC)"
259
  curl http://localhost:4000/debug/pprof/heap > mem.prof
260
+ $(GO) tool pprof -http=:8231 mem.prof
261
 
262
  generate: ## Roda go generate
263
  @echo "$(GREEN)⚙️ Executando go generate...$(NC)"