VPS & Infrastructure Setup
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The FusionOps infrastructure is a hybrid architecture designed for building and deploying PPC and affiliate landing pages. It leverages serverless Cloudflare Workers for logic and tracking, Cloudflare Pages for the frontend dashboard and landing pages, and a VPS-based automation stack for autonomous agent operations. This system ensures low-latency delivery via Cloudflare's edge network while maintaining a centralized control plane for campaign management and risk analysis.
The infrastructure is orchestrated through a series of automated setup scripts that provision databases, configure environment bindings, and deploy containerized services for the Hermes agent system. For data persistence, the project utilizes Cloudflare D1 (SQLite at the edge) and Neon Postgres for centralized dashboard settings and site configurations.
Sources: INFRASTRUCTURE_SETUP.md:1-55, scripts/setup-infrastructure.js:1-40, HERMES_FBIS_AUDIT.txt:1-25
Core Infrastructure Components
Cloudflare Serverless Stack
The primary application logic resides within Cloudflare's ecosystem. This includes multiple specialized Workers and D1 databases.
| Component | Purpose | Binding Name |
|---|---|---|
api-worker | Main CRUD operations for campaigns and templates | DB |
pixel-worker | First-party tracking for user events (clicks/conversions) | DB |
worker | Webhook callback handling and lead notifications | DB |
fusionops-main | D1 database for site and template metadata | - |
fusionops-pixel | D1 database for analytics tracking events | - |
fusionops-callback | D1 database for lead handling logs | - |
Sources: INFRASTRUCTURE_SETUP.md:75-90, scripts/setup-infrastructure.js:25-35, scripts/deploy-all.js:25-30
VPS Automation Stack (Hermes + FBIS)
The VPS infrastructure, typically provisioned on Hetzner CX22 (Ubuntu 24.04), hosts the FusionOps automation stack. This stack runs autonomous agents (Hermes) and a Ban Intelligence System (FBIS) within Docker containers.
The diagram shows the relationship between the Hermes agent, its visualization tools (Graphify/Mission Control), and the containerized MCP services that interact with the Cloudflare-based API.
Sources: infra/setup.sh:1-20, HERMES_FBIS_AUDIT.txt:5-50, infra/setup.sh:65-80
Setup & Provisioning Process
1. Automated VPS Initialization
The VPS is configured using a one-command setup script (infra/setup.sh). This script installs system dependencies including Docker, Node.js, and Python, clones the repository, and initializes the Hermes agent.
Key setup steps:
- System Packages: Installs
docker.io,docker-compose-v2,python3-pip, andnodejs. - Hermes Installation: Fetches and installs the Hermes Agent (v0.13.0+).
- Ecosystem Plugins: Installs Caveman compression middleware and Graphify for dependency visualization.
- Service Launch: Starts Docker services including
fbis-mcp,dashclaw, andmission-control.
Sources: infra/setup.sh:10-60, HERMES_FBIS_AUDIT.txt:190-210
2. Cloudflare Resource Provisioning
Cloudflare resources are provisioned via scripts/setup-infrastructure.js (Node.js) or scripts/setup-infrastructure.sh (Bash). These scripts automate the creation of D1 databases and the deployment of Workers.
This sequence illustrates the automated flow of creating edge databases, performing schema migrations, and deploying code.
Sources: scripts/setup-infrastructure.js:100-250, scripts/setup-infrastructure.sh:70-150
Database Architecture & Migrations
D1 SQLite (Edge)
Migrations are managed as SQL files within each worker's subdirectory. The setup scripts iterate through these files and execute them against the live D1 instances.
- Main Migrations:
0001_init.sql,0002_deploy_history.sql,0002_add_templates.sql. - Pixel Migrations:
0001_pixel_events.sql.
Sources: scripts/setup-infrastructure.js:35-40, INFRASTRUCTURE_SETUP.md:110-125
Neon Postgres (Centralized)
Neon is used for state that requires standard PostgreSQL features or global access outside the Cloudflare edge. It stores high-level site configurations and deployment history.
-- Site configuration schema
CREATE TABLE IF NOT EXISTS sites (
id TEXT PRIMARY KEY,
data JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- Deployment history schema
CREATE TABLE IF NOT EXISTS deploy_history (
id TEXT PRIMARY KEY,
site_id TEXT REFERENCES sites(id),
target TEXT NOT NULL, -- 'cloudflare', 'vercel', 'netlify'
url TEXT,
status TEXT DEFAULT 'pending',
created_at TIMESTAMPTZ DEFAULT NOW()
);
Sources: INFRASTRUCTURE_SETUP.md:180-215, scripts/setup-infrastructure.js:300-330
Configuration and Secrets
Infrastructure security is maintained through environment variables and GitHub Secrets. The project requires specific tokens to be configured before deployment is successful.
Required Secrets Table
| Secret Name | Source | Purpose |
|---|---|---|
CLOUDFLARE_ACCOUNT_ID | Cloudflare Dashboard | Target for Pages and Workers |
CLOUDFLARE_API_TOKEN | Cloudflare API Tokens | Authentication for Direct Upload |
NEON_DATABASE_URL | Neon Console | Connection string for Postgres |
FBIS_API_KEY | User Generated | Bearer token for VPS -> Worker comms |
TELEGRAM_BOT_TOKEN | BotFather | Alerts for the risk analysis pipeline |
Sources: INFRASTRUCTURE_SETUP.md:220-250, HERMES_FBIS_AUDIT.txt:175-185, scripts/setup-infrastructure.sh:350-380
Deployment Pipeline
The scripts/deploy-all.js script handles the full build and deployment cycle. It performs pre-flight checks, builds the Astro frontend, deploys the four core workers, and finally pushes the dashboard to Cloudflare Pages.
Deployment Targets:
- Workers: API, Pixel, Callback, and CF-Proxy.
- Pages: Frontend dashboard (
landerapp) deployed tofusionops-web.pages.dev. - DNS: Automated CNAME/A record updates for custom landing page domains.
Sources: scripts/deploy-all.js:10-100, INFRASTRUCTURE_SETUP.md:265-285, scripts/deploy-all.js:150-170
Conclusion
The FusionOps infrastructure setup combines serverless edge computing with localized VPS automation. By utilizing Cloudflare for the frontend and API layers, the system achieves global performance for landing pages. Simultaneously, the Hetzner-based VPS provides a stable environment for complex AI agent orchestration and risk scoring, creating a robust platform for PPC operations.