Skip to content

ProspectMatch/wp-swarm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 WordPress Docker Swarm Template

Template for deploying WordPress in a Docker Swarm environment using:

  • 🐳 Docker Swarm
  • ⚙️ GitHub Actions (CI/CD)
  • 🔐 Secrets-based image builds and secure SSH deployment
  • 🌐 NGINX Proxy Manager
  • 🛠 MariaDB (shared container or RDS)
  • 🧩 Auto WordPress install + plugin setup

📦 What This Template Includes

  • docker-compose.yml for Swarm-based deployment
  • wordpress/Dockerfile to extend wordpress:php8.4-fpm with:
    • SSH access
    • WP-CLI
    • Auto plugin install
  • GitHub Actions workflow to:
    • Build Docker image
    • Push to GitHub Container Registry (GHCR)
      • Organizational secret required
        • SWARM_HOST
        • SWARM_USER
        • SSH_PRIVATE_KEY
    • Deploy to your Swarm node via SSH
  • entrypoint.sh to initialize WordPress and install core plugins

🧰 Requirements

  • Docker Swarm with at least one node - label (name) required during install
  • GitHub CLI on swarm manager
  • GitHub Secrets:
    • DOCKERHUB_USERNAME
    • DOCKERHUB_TOKEN
    • SWARM_HOST
    • SWARM_USER
    • SSH_PRIVATE_KEY
  • Optional:
    • NGINX Proxy Manager running
    • Cloudflare credentials (for DNS automation)
    • Passwords are visibile during setup for verification. Modify the script to hide passwords using -sp instead of -p if you want to hide the passwords.

⚙️ Usage

1. Click “Use this template”

Create a new private repo for your WordPress site using this template.

2. Update Environment Values

Edit:

  • docker-compose.yml
  • .github/workflows/docker-build.yml

Change:

  • Site/domain name
  • DB credentials
  • Image name (yourdockerhub/wp_sitename)

3. Push to GitHub

This triggers:

  • Docker image build via GitHub Actions
  • Image push to Docker Hub
  • Deployment to your Docker Swarm

📦 Installed Plugins (by default)

  • Elementor
  • Rank Math SEO
  • Code Snippets
  • WP Mail SMTP
  • UpdraftPlus
  • WPForms Lite
  • Cloudflare
  • WP Optimize

📜 Deployment Script

The /scripts/createPrivateSiteFromTemplate.sh script should be copied and run on your Docker Swarm manager to:

  • Clone this template
  • Customize values for a new WordPress site
  • Create a new private repo
  • Push and trigger CI/CD deployment
  • GitHub CLI authentication required on swarm manager:
    • gh auth login (then choose)
      • GitHub.com
      • HTPPS
      • Paste your token (recommended) or authenticate via browser

Run it with:

  • mkdir -p /scripts
  • chmod +x /scripts/createPrivateSiteFromTemplate.sh
  • ./scripts/createPrivateSiteFromTemplate.sh

To delete a site from the swarm: run /scripts/deleteSiteFromSwarm.sh


🔒 License

This project is licensed under the MIT License.


🧠 Notes

  • This repo is meant to be a clean base. You can fork it or use it as a GitHub template.
  • For each client/site, spin up a new private repo using this template.
  • Secrets should be managed securely via GitHub Actions or a vault.

Made with ❤️ by Mark Wood - Prospect Match LLC

About

Wordpress Swarm Template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published