惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Engineering at Meta
Engineering at Meta
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
M
MIT News - Artificial intelligence
IT之家
IT之家
博客园 - 【当耐特】
U
Unit 42
云风的 BLOG
云风的 BLOG
L
LangChain Blog
小众软件
小众软件
Microsoft Security Blog
Microsoft Security Blog
B
Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
宝玉的分享
宝玉的分享
N
Netflix TechBlog - Medium

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
CI/CD Pipeline for a Multi-Site Video Platform
ahmet gedik · 2026-04-29 · via DEV Community

ViralVidVault is part of a family of video platforms, each running on separate LiteSpeed shared hosting. Same codebase, different configurations. Deploying manually to multiple hosts was error-prone and tedious. Here's the GitHub Actions pipeline that replaced it.

Constraints

Shared hosting means no SSH, no Docker on the server, no git pull. The only deployment option is FTP. The pipeline needs to:

  • Run PHP linting and tests
  • Deploy to multiple hosts in parallel
  • Exclude sensitive files (.env, data/)
  • Clear LiteSpeed cache after deploy
  • Verify each deployment succeeded

The Workflow

# .github/workflows/deploy.yml
name: Test and Deploy

on:
  push:
    branches: [main]
  workflow_dispatch:
    inputs:
      site:
        description: 'Deploy specific site (or all)'
        required: false
        default: 'all'
        type: choice
        options: [all, dwv, tvh, vvv, tvs]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: shivammathur/setup-php@v2
        with:
          php-version: '8.3'
          extensions: sqlite3, pdo_sqlite, curl
      - name: Lint PHP files
        run: |
          EXIT_CODE=0
          while IFS= read -r file; do
            php -l "$file" > /dev/null 2>&1 || EXIT_CODE=1
          done < <(find app/ public/ cron/ -name '*.php')
          exit $EXIT_CODE
      - name: Run test suite
        run: php tests/run.php
        env:
          APP_ENV: testing

  deploy:
    needs: test
    runs-on: ubuntu-latest
    strategy:
      matrix:
        site: [dwv, tvh, vvv, tvs]
      fail-fast: false
    steps:
      - uses: actions/checkout@v4

      - name: Deploy via FTP
        uses: SamKirkland/FTP-Deploy-Action@v4.3.5
        with:
          server: ${{ secrets[format('{0}_FTP_HOST', matrix.site)] }}
          username: ${{ secrets[format('{0}_FTP_USER', matrix.site)] }}
          password: ${{ secrets[format('{0}_FTP_PASS', matrix.site)] }}
          server-dir: /public_html/
          exclude: |
            **/.env
            **/data/**
            **/*.log
            **/.git/**
            **/tests/**
            **/backlink/**

      - name: Clear LiteSpeed cache
        run: |
          curl -sf "${{ secrets[format('{0}_URL', matrix.site)] }}/task/clear-cache?key=${{ secrets.TASK_KEY }}" \
            --max-time 10 || echo "Cache clear timed out (non-fatal)"

Enter fullscreen mode Exit fullscreen mode

The workflow_dispatch input lets you deploy a single site manually from the GitHub UI. Useful when you need to hotfix one site without touching the others.

Matrix Strategy Deep Dive

The matrix keyword creates four parallel jobs, one per site. Each job has its own runner and its own set of secrets:

    strategy:
      matrix:
        site: [dwv, tvh, vvv, tvs]
      fail-fast: false

Enter fullscreen mode Exit fullscreen mode

fail-fast: false is critical. Without it, if the tvh deploy fails (say, FTP timeout), GitHub cancels the vvv, dwv, and tvs jobs too. That turns one problem into four.

Secrets Organization

Twelve repository secrets, three per site:

DWV_FTP_HOST=ftp.dailywatch.video
DWV_FTP_USER=deploy@dailywatch.video
DWV_FTP_PASS=<password>

VVV_FTP_HOST=ftp.viralvidvault.com
VVV_FTP_USER=deploy@viralvidvault.com
VVV_FTP_PASS=<password>

# ... same pattern for TVH, TVS

Enter fullscreen mode Exit fullscreen mode

The format() function dynamically resolves the right secret:

server: ${{ secrets[format('{0}_FTP_HOST', matrix.site)] }}
# When matrix.site = 'vvv', resolves to secrets.VVV_FTP_HOST

Enter fullscreen mode Exit fullscreen mode

Post-Deploy Verification

Deploy doesn't mean working. Add a verification step:

      - name: Verify deployment
        run: |
          URL="${{ secrets[format('{0}_URL', matrix.site)] }}"
          echo "Checking $URL..."

          # Basic availability check
          HTTP_CODE=$(curl -s -o /dev/null -w '%{http_code}' "$URL" --max-time 15)
          if [ "$HTTP_CODE" != "200" ]; then
            echo "::error::${{ matrix.site }} returned HTTP $HTTP_CODE"
            exit 1
          fi

          # Version check via health endpoint
          DEPLOYED=$(curl -sf "$URL/health" --max-time 10 | python3 -c "import sys,json; print(json.load(sys.stdin).get('commit','unknown'))")
          echo "${{ matrix.site }}: HTTP $HTTP_CODE, version $DEPLOYED"

Enter fullscreen mode Exit fullscreen mode

This catches silent failures — FTP uploads that seem to succeed but actually fail due to permissions, disk space, or path misconfigurations.

Notifications on Failure

A deploy that fails silently is worse than a deploy that fails loudly:

  notify:
    needs: deploy
    if: failure()
    runs-on: ubuntu-latest
    steps:
      - name: Alert on failure
        run: |
          curl -X POST "${{ secrets.DISCORD_WEBHOOK }}" \
            -H 'Content-Type: application/json' \
            -d '{"content": "Deploy FAILED for ${{ github.sha }}. Check: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}'

Enter fullscreen mode Exit fullscreen mode

Production Results

Since switching to this pipeline for ViralVidVault and the other sites:

  • Deploy time went from 15 minutes (manual, sequential) to 4 minutes (automated, parallel)
  • Zero missed deployments (no more "forgot to deploy to tvs")
  • Three bad deploys caught by the verification step before any user noticed

The FTP constraint makes this less elegant than a container-based deploy, but the reliability improvement is the same. Automate the boring parts, verify the important parts.


This article is part of the Building ViralVidVault series.