push_scrum_wiki.py 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import requests
  2. import urllib3
  3. urllib3.disable_warnings()
  4. base_url = 'https://192.168.130.161/taiga/api/v1'
  5. proj_id = 21
  6. def run_wiki_push():
  7. # Authenticate
  8. auth_resp = requests.post(f'{base_url}/auth', json={'type': 'normal', 'username': 'FrancoisLange', 'password': 'your_db_password_here'}, verify=False)
  9. if auth_resp.status_code != 200:
  10. print("Auth failed!")
  11. return
  12. auth = auth_resp.json()
  13. headers = {'Authorization': f'Bearer {auth["auth_token"]}', 'Content-Type': 'application/json'}
  14. pages = {
  15. "260521-plan": {
  16. "title": "26.05.21 PLAN",
  17. "content": """# 📅 Sprint 7 Plan - 26.05.21
  18. ## 🎯 Sprint Goal
  19. Transition the Local Food AI clinical platform from 100% offline, local-only fallback mode to the fully connected, distributed production environment now that the VM server and Taiga are fully accessible.
  20. ---
  21. ## 🛠️ Detailed Tasks & Actions
  22. ### 1. Git Repository & Server Sync
  23. * Push all local resilience configurations (dynamic DB URL, dynamic Zabbix host, Nginx configurations) to the Git repository.
  24. * Pull the latest code updates directly on the target server `192.168.130.170` to synchronize the host and remote states.
  25. ### 2. Remote Server Hardening
  26. * Address the `searxng` container crash-loop on the remote server by applying the default settings validation patch (`use_default_settings: true`).
  27. * Verify that all 8 containers in the `docker-compose.yml` stack are running smoothly in a fully operational state.
  28. * Perform runtime checks on the Streamlit web interface and verify the local Ollama LLM is successfully loading the clinical RAG tools on the server.
  29. ### 3. Observability & Telemetry Integration
  30. * Validate SNMPv3 metrics scraping on the server's local Zabbix agent.
  31. * Verify database row count check, memory consumption, and CPU load metrics are correctly streaming to the Zabbix dashboard.
  32. * Configure active alerts to trigger Discord and Microsoft Teams webhooks upon system metrics anomalies.
  33. ### 4. Continuous Documentation Mirroring
  34. * Automatically mirror daily sprint logs, plans, and retrospective reviews to the Taiga wiki.
  35. * Dynamically substitute RCS keyword `$Id$` placeholders across all documents and PDFs using git log revision details to ensure high-fidelity outputs.
  36. """
  37. },
  38. "260521-review": {
  39. "title": "26.05.21 REVIEW",
  40. "content": """# 🔍 Sprint 7 Review - 26.05.21
  41. ## 🏆 Accomplishments & Delivered Features
  42. This week was focused on recovering from the system crash, setting up resilient offline fallback architectures, and transition back to fully operational server mode.
  43. ---
  44. ## 📈 Detailed Breakdown
  45. ### 1. Database Operations & Resilience
  46. * **MySQL Network Port Recovery**: Resolved the problematic `command: --skip-grant-tables` issue which disabled TCP/IP networking sockets. MySQL now binds successfully to port `3306` inside the container network.
  47. * **Unified Initialization Script**: Developed `init.sql` to programmatically configure databases (`food_db`, `zabbix`), users, passwords, and correct privilege mapping.
  48. * **OpenFoodFacts Ingestion**: Successfully loaded the 20,000-row products macro subset offline using group-based vertical partitioning and FULLTEXT indexes.
  49. * **Alembic Schema Migrations**: Established target clinical tables (`users`, `user_health_profiles`, `plates`, `plate_items`) via python Alembic migrations.
  50. * **Admin Seeding**: Seeded the `Admin` dietitian account (password: `your_db_password_here`) to ensure instant clinical frontend login.
  51. ### 2. Enterprise Telemetry
  52. * **Dynamic Zabbix Telemetry**: Refactored `snmp_notifier.py` and `configure_zabbix_alerts.py` to dynamically resolve target hosts from environment variables instead of failing on hardcoded IPs.
  53. * **Local Telemetry Verification**: Confirmed that Zabbix Server, Web UI, and Agent are active locally and successfully scraping SNMP metric traps on container operations.
  54. ### 3. Documentation & Auditing
  55. * **Disaster Recovery**: Audited and updated the system disaster recovery plan to include local single-node fallback runbooks.
  56. * **Zabbix Telemetry Manual**: Documented local offline telemetry fallback steps.
  57. * **High-Fidelity PDF Compilation**: Resolved literal `$Id$` placeholders inside all manuals and PDFs, replacing them with dynamic git log revision hashes.
  58. """
  59. },
  60. "260521-daily": {
  61. "title": "26.05.21 DAILY",
  62. "content": """# 💬 Daily Scrum - 26.05.21
  63. ## 📅 Yesterday's Progress
  64. * Successfully finished offline fallback database migrations, ingestion of the OpenFoodFacts 20,000-row subset, and verified Streamlit app login.
  65. * Fixed the git RCS `$Id$` placeholder compilation bug in documents and PDFs, mirroring dynamic Git log information on the first page of compiled manuals.
  66. * Patched the PDF generator script (`generate_pdfs.py`) to gracefully skip locked files on Windows without crashing the build pipeline.
  67. ---
  68. ## 🚀 Today's Plan
  69. ### 1. Remote Server Integration & Fixes
  70. * **Taiga, Git, and Server Connectivity**: Re-established full connectivity with remote systems.
  71. * **SearXNG Crash-loop Fix**: Pull the latest code on the target server `192.168.130.170` to apply the default settings validation patch and resolve the remote SearXNG container crash-loop.
  72. * **Docker Operations**: Ensure the entire stack on the remote server runs healthy.
  73. ### 2. Antigravity Upgrade Check
  74. * **Environment Integrity**: Verified that the Antigravity local IDE setup is operating on the correct current version.
  75. * **Tool & Library Integrity**: Confirmed the status of local virtual environments (`.venv`), Python libraries, and tools.
  76. * **CI/CD Telemetry**: Verified git remote push/pull connectivity.
  77. ### 3. Agile Synchronization
  78. * Push this plan, daily, and review documents directly to the Taiga Wiki.
  79. * Run `taiga_sync_final.py` to resolve and populate unassigned tasks and user stories.
  80. ---
  81. ## 🚫 Blockers
  82. * **None**. The remote server VM and Taiga API are fully online and accessible.
  83. """
  84. }
  85. }
  86. # Also add standard hyphenated slugs to be perfectly robust
  87. hyphenated_pages = {}
  88. for k, v in pages.items():
  89. hyphenated_key = k.replace("260521", "26-05-21")
  90. hyphenated_pages[hyphenated_key] = v.copy()
  91. all_pages = {**pages, **hyphenated_pages}
  92. for slug, info in all_pages.items():
  93. # Check if page exists
  94. res = requests.get(f'{base_url}/wiki?project={proj_id}&slug={slug}', headers=headers, verify=False).json()
  95. if len(res) > 0:
  96. wiki_id = res[0]['id']
  97. version = res[0]['version']
  98. payload = {'content': info['content'], 'version': version}
  99. r = requests.put(f'{base_url}/wiki/{wiki_id}', json=payload, headers=headers, verify=False)
  100. print(f'Updated {slug} ({info["title"]}): {r.status_code}')
  101. else:
  102. payload = {'project': proj_id, 'slug': slug, 'content': info['content']}
  103. r = requests.post(f'{base_url}/wiki', json=payload, headers=headers, verify=False)
  104. print(f'Created {slug} ({info["title"]}): {r.status_code}')
  105. if __name__ == "__main__":
  106. run_wiki_push()