# Production Linux Server Audit and Repair for a Data Subscription Site

> An audit of the single Ubuntu server behind a financial-data subscription site, a fix for its silently failed social-posting pipeline, and a documented setup so it can be maintained safely.

Section: Python Automation

Page: https://mburhan.com/case/python-production-vps-audit-and-pipeline-repair

## Project Overview

A financial-data subscription site ran its Python backend, data pipelines, scheduled jobs, publishing automation, and social-posting pipeline on a single Ubuntu VPS. The project focused on auditing the server, repairing a silently failed social-posting pipeline, and documenting the setup for safer maintenance.

**Technology:** Python, Flask, SQLite, systemd, cron, Nginx, Gunicorn, Cloudflare Tunnel, Stripe, WordPress, Brevo

## 01. The Problem

The server supported several interconnected services and automated workflows. The social-posting pipeline had silently stopped working, and the client needed a server audit, a repair, and a clear maintenance roadmap.

## 02. What Was Done

- Audited systemd units, cron jobs, logs, Nginx, Gunicorn, the SQLite database, and the backup job.
- Prepared a plain-English client report with a health score and prioritized fixes.
- Repaired the social-posting pipeline with two targeted changes and stabilized its scheduling.
- Set up a Git mirror of `/opt` and added a `CLAUDE.md` file documenting the architecture to support safer maintenance with Claude Code.

## 03. How the System Runs

- **Nightly pipeline — 20:00 ET:** Ingests OHLC data, runs scanners, builds JSON outputs, backs up the database to Google Drive using rclone, builds the newsletter and blog post, publishes through the WordPress REST API, and sends the daily email through Brevo.
- **Live pipeline — 15:45 ET:** Runs `live_pipeline.py` for real-time signals and options pricing.
- **Always-on API:** Runs the Gunicorn-hosted Flask API on port 5500 behind Nginx and Cloudflare Tunnel.
- **Content engine:** Scheduled through cron at 08:15, 08:45, every 15 minutes during market hours, and 21:00 to render PNG/MP4 content cards and post to Instagram, X, and TikTok.

## 04. Workflow

Image (https://mburhan.com/uploads/410eadba5fe6120d33486a0e.png)

**Nightly Data Pipeline**

Scheduled systemd Timer → `nightly_pipeline.sh` → Ingest OHLC Data → Run Scanners → Build JSON → Back Up Database to Google Drive → Build Newsletter and Blog Post → Publish via WordPress REST API → Send Daily Email via Brevo

**Live Data Pipeline**

Scheduled systemd Timer → `live_pipeline.py` → Real-Time Signals and Options Pricing

**API Service**

Flask API → Gunicorn on Port 5500 → Nginx → Cloudflare Tunnel

**Social Content Pipeline**

Cron Schedule → Content Engine → Render PNG/MP4 Cards → Publish to Instagram, X, and TikTok

```plain text
20:00 ET  systemd timer  → nightly_pipeline.sh
                            ingest OHLC → run scanners → build JSON → DB backup to Drive (rclone)
                            → build newsletter + blog post (publish via WP REST API)
                            → send daily email (Brevo)
15:45 ET  systemd timer  → live_pipeline.py (real-time signals + options pricing)
always    systemd service → gunicorn Flask API :5500 behind nginx + Cloudflare Tunnel
cron      08:15 / 08:45 / every 15 min market hours / 21:00 → content engine renders PNG/MP4 cards and posts to IG / X / TikTok
```

## 05. Technology and Integrations

Python, Flask, SQLite, systemd, cron, Bash, Nginx, Gunicorn, Cloudflare Tunnel, rclone, JWT authentication, Stripe, WordPress REST API, Brevo, and the Post for Me API.

## 06. Outcome

The server was audited, the failed social-posting pipeline was repaired, scheduling was stabilized, and the architecture was documented to support safer ongoing maintenance.
