How tamanna456760-it/tamanna-server works
1. Overall shape
This repository is not a single app; it is an operations/control-plane package for bd-king-r7. The core architecture is a central orchestrator plus per-server agents that automate sync, fix/build, commit, and reporting across multiple machines.
2. Central orchestrator
The orchestrator is the system-of-record for automated runs. The README describes it as a Flask service that accepts JSON reports and serves a small dashboard on port 8000. The tree also contains a .NET 8 orchestrator project (bd-king-orchestrator.csproj, program.cs, appsettings.json, appdbcontext.cs), so this repo appears to carry both an orchestrator implementation and build artifacts/variants around it.
3. Agent runtime on each host
agent.py is the per-server worker. It reads machine-specific config from agent.example.yml / agent.yml, runs on a timer or as a service, and uses the local repo checkout to perform:
- safe sync/update
- optional fix commands
- build/test commands
- marker/version updates
- git commit and optional push
- JSON status reporting back to the orchestrator
4. Primary data flow
The main flow is:
source repo on a server → agent executes commands locally → agent emits report JSON → orchestrator stores/displays history.
The report path is the main boundary between distributed workers and the central dashboard.
5. Safety and concurrency boundaries
The design is intentionally cautious:
- per-run locking prevents overlapping executions
- push is disabled by default
- dedicated automation branch is recommended
- logs go to /var/log
- token-based auth gates agent-to-orchestrator traffic
These controls are central to the architecture because the system is allowed to modify code automatically.
6. Configuration model
Configuration is heavily file-driven and split by concern:
- agent.example.yml, ai_sync_config.json, sync_config.json, monitoring.json
- Config/Config.json, app_config.json, appsettings.json
- .env, .env.example
- many domain-specific JSON files such as Metadata.json, system_identity.json, reports.db, symptoms_db.json
This suggests the system is designed to be redeployed across many hosts with different repo paths, branches, and command hooks.
7. Persistence and state
Persistent state is mostly lightweight and local:
- reports.db for run history/records
- JSON files for configuration and monitoring state
- marker/text files used by sync flows and status tracking
The orchestrator likely keeps central history, while agents keep local runtime state and logs.
8. Deployment and runtime plumbing
Operational deployment is built around:
- docker-compose.yml / dockerfile for central orchestration
- bd-king-agent.service, sync_and_add.service, sync_and_add.timer, autometick.service for systemd-based agent execution
- shell wrappers like autorun.sh, autosync.sh, setup_service.sh, install_orchestrator.sh
The repo is optimized for headless server automation rather than interactive use.
9. Supporting automation ecosystem
The tree contains many adjunct scripts in Python, JS, and shell (auto_sync.py, cloud_auto_sync.py, monitor.py, power_engine.py, server.py, server.js, ai_control.py, ai_engine.py, etc.). These look like a broader toolbox around the same domain: synchronization, monitoring, power/control flows, and AI-assisted coordination. They are adjacent subsystems, not all part of the core agent/orchestrator path.
10. Network and name-resolution sidecar
The Dns/ directory (named.conf, zone files) and related shell scripts (check_domen.sh, firewall_chant.sh, gcp_security_audit.sh) indicate the repo also contains infrastructure support for DNS and host/network hardening. These are operational dependencies around the sync platform rather than its main business logic.
11. UI and presentation surfaces
There are several small presentation assets (Wabsite/Index.html, index.html, style.css, bd-king-r7.html, bd-king-r7_login.html, device_location.html) plus an Android/Java entrypoint (mainactivity.java, androidmanifest.xml, activity_main.xml). These appear to be auxiliary interfaces or demos, not the primary control path.
12. How to diagram it
A good architecture diagram should center on:
- Agent nodes running on multiple servers
- Central orchestrator receiving authenticated reports
- Local repo checkout and build/fix execution on each node
- Config/filesystem state, logs, and report storage
- Deployment layer via Docker and systemd
- Optional supporting boxes for DNS/network tooling and the extra automation scripts around the core loop
Main entry points: program.cs Orchestrator · agent.py Agent · firewall_chant.sh Firewall · monitor.py Monitor
Components 20
Orchestration
Central service that records runs and serves the operator view.
- Orchestrator · Central service entrypoint for run ingestion and dashboard behavior.
program.cs - DB context · Persistence layer used by the orchestrator.
appdbcontext.cs - App config · Service settings for the orchestrator.
appsettings.json - Reports DB · Stored run history and local records.
reports.db - README · Describes the control-plane and reporting workflow.
README.md
Agent runtime
Per-host automation that syncs, fixes, builds, commits, and reports.
- Agent · Per-server automation worker that executes the local run loop.
agent.py - Agent config · Example machine-specific agent configuration.
agent.example.yml - Sync config · Settings for repository sync and update behavior.
sync_config.json - Monitor config · Monitoring and reporting thresholds for the automation loop.
monitoring.json - Sync flow · Representative sync/update automation used by the agent ecosystem.
auto_sync.py - Fix rules · Representative fix/build command configuration.
fix.yml - Monitor · Representative runtime for health and progress observation.
monitor.py
Operations
Deployment, service management, and infrastructure support.
- Compose · Containerized deployment for the orchestrator stack.
docker-compose.yml - Agent service · System service for unattended agent execution.
bd-king-agent.service - Setup service · Installs and wires the headless runtime services.
setup_service.sh - DNS · Name-resolution and zone configuration support.
Dns - Firewall · Host/network access control and security hardening.
firewall_chant.sh
Interfaces
Small presentation and client surfaces.
- Web UI · Small presentation surface for the broader project.
index.html - Site home · Alternative website landing page.
Wabsite/Index.html - Android UI · Android client entrypoint bundled with the repo.
mainactivity.java
Connections 19
- README → Orchestrator: describes · Documentation explains the central orchestrator and reporting model.
- Orchestrator → DB context: uses · Orchestrator persists run history through its data layer.
- Orchestrator → App config: reads · Service behavior is configured through app settings.
- Orchestrator → Reports DB: stores · Central history and run records are kept in the reports database.
- Orchestrator → Web UI: serves · Dashboard and operator-facing pages are exposed by the control plane.
- Agent config → Agent: configures · Host-specific values drive the agent runtime.
- Sync config → Agent: configures · Sync policies shape local update behavior.
- Monitor config → Monitor: configures · Monitoring thresholds and state feed the observer loop.
- Agent → Sync flow: invokes · The agent executes sync/update automation locally.
- Agent → Fix rules: applies · Optional fix/build command sequences are part of the run loop.
- Agent → Monitor: reports · Worker status is collected and emitted by monitoring logic.
- Agent → Orchestrator: sends report · Authenticated JSON reports flow back to the central orchestrator.
- Agent → Agent service: runs as · Per-host execution is commonly managed as a systemd service.
- Setup service → Agent service: installs · Bootstrap scripts provision the agent service.
- Compose → Orchestrator: deploys · Container orchestration supports the central service stack.
- DNS → Firewall: supports · Network and DNS setup depends on host hardening and access rules.
- Firewall → Agent: protects · Agent traffic and host access are constrained by firewall policy.
- Site home → Orchestrator: fronts · A small site surface sits alongside the orchestrator.
- Android UI → Orchestrator: clients · Mobile client code connects to the broader control-plane ecosystem.