Agent Job Reload Nginx always show running Frappe Press

Anyone face this issues? help me why agent job status not update

i too faced this issue add_site_to_upstream task is running forever right?

I was able to fix my issue with the following steps. It’s a simple document I put together — I hope it’s clear and helpful!

Technical Analysis

Job Execution Flow

1. Job starts → add_site_to_upstream_job()
2. Creates upstream files → SUCCESS
3. Calls reload_nginx() → Queues request in Redis
4. nginx_reload_manager should process → MISSING SERVICE
5. Job waits for reload confirmation → TIMEOUT
6. Job retries infinitely → STUCK

Redis Queue Investigation

redis-cli -p 25025 LLEN nginx||pending_queue # Shows queued reload requests LLEN nginx||processing_queue # Shows requests being processed KEYS nginx_reload_status* # Shows individual job statuses

Agent Code Analysis

The async nginx reload system in /home/frappe/agent/repo/agent/nginx_reload_manager.py requires a dedicated supervisor service to process queued reload requests.

Solution Implemented

1. Added Missing Supervisor Service

File: /etc/supervisor/conf.d/agent.conf

[program:nginx_reload_manager] command=/home/frappe/agent/env/bin/python -m agent.nginx_reload_manager environment=PYTHONUNBUFFERED=1 autostart=true autorestart=true stdout_logfile=/home/frappe/agent/logs/nginx_reload_manager.log stderr_logfile=/home/frappe/agent/logs/nginx_reload_manager.error.log user=frappe directory=/home/frappe/agent

Updated group section:

[group:agent] programs=web, redis, worker, nginx_reload_manager

2. Service Activation

sudo supervisorctl reread sudo supervisorctl update sudo supervisorctl start agent:nginx_reload_manager

3. Verification

sudo supervisorctl status | grep nginx # Should show: agent:nginx_reload_manager RUNNING

Results

nginx_reload_manager service running
Redis queues processing successfully
Stuck jobs completed
New “Add Site to Upstream” operations work
Infrastructure fully operational

Example success log:

[2025-05-29 05:25:10.625461] Reload Success | 1 requests

Identified Bugs (Not Fixed)

1. Proxy Server Detection Logic

File: Agent supervisor setup code
Issue: is_proxy_server = self.config.get("name").startswith("n")
Problem: Fails for servers named proxy.*
Impact: nginx_reload_manager not automatically added to supervisor config