Skip to content

Project Management

WDG's multi-project architecture enables you to manage unlimited WordPress sites simultaneously, each with complete isolation while sharing common infrastructure.

Overview

Each project in WDG is a fully isolated WordPress installation with:

  • Dedicated Docker container
  • Separate MySQL database
  • Individual SSL certificate
  • Isolated vector database collection
  • Project-specific repositories
  • Custom domain (project-name.localhost:8443)

Project Lifecycle

Creating Projects

bash
# Basic project
wdg create my-site

# Project with specific PHP version
wdg create my-site --php=8.1

# Project with managed wp-content repository
wdg create my-site --init-wikit

# Project with GitHub integration
wdg create my-site --init-wikit --remote

# Clone existing client repository
wdg create my-site --clone-repo=https://github.com/client/wp-content

Project Structure

projects/
└── my-site/
    ├── docker-compose.yml       # Project-specific services
    ├── project.json             # Project metadata
    ├── .env                     # Project environment
    ├── backups/                 # Database backups
    ├── config/                  # Configuration files
    ├── logs/                    # Application logs
    └── repositories/            # Project repositories
        └── my-site/             # Wikit-managed repository
            └── wp-content/
                ├── themes/
                ├── plugins/
                ├── mu-plugins/
                └── uploads/

Multi-Project Architecture

%%{init: {'theme':'neutral'}}%%
graph TB
    subgraph "Shared Infrastructure"
        Nginx[Nginx Proxy<br/>Port 8443]
        MySQL[(MySQL<br/>Single Instance)]
        Qdrant[(Qdrant<br/>Vector DB)]
        MCP[MCP Server]
    end

    subgraph "Project Isolation"
        P1[Project 1<br/>PHP 8.2]
        P2[Project 2<br/>PHP 8.1]
        P3[Project 3<br/>PHP 8.3]
    end

    subgraph "Storage"
        DB1[(wp_project1)]
        DB2[(wp_project2)]
        DB3[(wp_project3)]
        V1[Collection: project_1]
        V2[Collection: project_2]
        V3[Collection: project_3]
    end

    Nginx --> P1
    Nginx --> P2
    Nginx --> P3

    P1 --> DB1
    P2 --> DB2
    P3 --> DB3

    MCP --> V1
    MCP --> V2
    MCP --> V3

Project Isolation

Container Isolation

Each project runs in its own Docker container with:

  • Isolated file system
  • Dedicated PHP-FPM process pool
  • Resource limits (CPU/memory)
  • Independent WordPress installation

Database Isolation

sql
-- Each project gets its own database
CREATE DATABASE wp_project1;
CREATE DATABASE wp_project2;
CREATE DATABASE wp_project3;

-- Separate users per project (optional)
CREATE USER 'project1_user'@'%' IDENTIFIED BY 'password';
GRANT ALL ON wp_project1.* TO 'project1_user'@'%';

Network Isolation

yaml
# Each project has unique domain
https://project1.localhost:8443
https://project2.localhost:8443
https://project3.localhost:8443

# Internal Docker network
project1-wp --> mysql:3306
project2-wp --> mysql:3306
project3-wp --> mysql:3306

Code Isolation

  • Separate vector database collections
  • Project-specific AI context
  • No cross-project code access
  • Client code remains private

Managing Multiple Projects

Starting Projects

bash
# Start all core services
wdg start

# Start specific project
wdg start my-site

# Start multiple projects
wdg start site1 site2 site3

Stopping Projects

bash
# Stop all services
wdg stop

# Stop specific project
wdg stop my-site

# Stop multiple projects
wdg stop site1 site2 site3

Listing Projects

bash
wdg list

Output:

WDG AI Projects:
  ● my-site (running)
     URL: https://my-site.localhost:8443
     PHP: 8.2
     Database: wp_my_site
     Repositories: 1
     Indexed: Yes (2,450 vectors)

  ● client-website (running)
     URL: https://client-website.localhost:8443
     PHP: 8.1
     Database: wp_client_website
     Repositories: 3
     Indexed: Yes (5,120 vectors)

  ○ old-project (stopped)
     PHP: 8.0
     Repositories: 1
     Indexed: No

Project Status

bash
# Check all services
wdg status

# View project details
wdg status my-site

PHP Version Management

Each project can use a different PHP version:

bash
# Check current version
wdg my-site php

# Change PHP version (rebuilds container)
wdg my-site php set 8.3

# List available versions
wdg my-site php available

Available PHP Versions:

  • 8.0
  • 8.1
  • 8.2 (default)
  • 8.3

💡 TIP

Changing PHP versions rebuilds the container but preserves all data including database, uploads, and configurations.

Repository Management

Adding Repositories

bash
# Add repository to specific project
wdg my-site repo add https://github.com/client/custom-plugin

# Clone to central location and connect
wdg repo clone https://github.com/client/wp-content client-content
wdg repo connect my-site client-content --type=wp-content

Listing Repositories

bash
# List project repositories
wdg my-site repo list

# List all available repositories
wdg repos

Project Configuration

Project Metadata (project.json)

json
{
  "name": "my-site",
  "created": "2024-10-14T10:30:00Z",
  "php_version": "8.2",
  "domain": "my-site.localhost",
  "database": "wp_my_site",
  "repositories": [
    {
      "name": "my-site",
      "path": "repositories/my-site",
      "type": "wp-content",
      "branch": "main"
    }
  ],
  "indexed": true,
  "collection": "project_my_site"
}

Environment Variables

Each project inherits from global .env but can override:

bash
# Project-specific .env
WP_HOME=https://my-site.localhost:8443
WP_SITEURL=https://my-site.localhost:8443
DB_NAME=wp_my_site
DB_USER=wordpress
DB_PASSWORD=wordpress
PHP_VERSION=8.2

Development Workflow

Daily Development

bash
# 1. Start your project
wdg start my-site

# 2. Open in browser
open https://my-site.localhost:8443

# 3. Start development mode (file watching)
wdg my-site dev

# 4. Make changes to code
# (files auto-rebuild)

# 5. Commit changes (triggers indexing)
cd projects/my-site/repositories/my-site
git add .
git commit -m "Add new feature"

# 6. Push to remote
git push origin main

Building for Production

bash
# Build optimized assets
wdg my-site build

# Export database for deployment
wdg db export my-site production.sql

# Search/replace domains
wdg db search-replace my-site "my-site.localhost:8443" "production-domain.com"

Resource Management

Monitoring Resources

bash
# View container resources
docker stats wdg-wp-my-site

# View logs
wdg logs my-site

# Check disk usage
du -sh projects/my-site

Resource Limits

Configure in project's docker-compose.yml:

yaml
services:
  wordpress:
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 2G
        reservations:
          memory: 1G

Backups

Database Backups

bash
# Manual backup
wdg db export my-site backups/backup-$(date +%Y%m%d).sql

# Automated backup script
#!/bin/bash
for project in $(wdg list --names); do
    wdg db export "$project" "backups/${project}-$(date +%Y%m%d).sql"
done

File Backups

bash
# Backup uploads
tar -czf my-site-uploads-$(date +%Y%m%d).tar.gz \
    projects/my-site/repositories/my-site/wp-content/uploads/

# Full project backup
tar -czf my-site-full-$(date +%Y%m%d).tar.gz \
    projects/my-site/

Deleting Projects

bash
# Delete with confirmation
wdg delete my-site

# Force delete (skip confirmation)
wdg delete my-site --force

What gets deleted:

  • Docker container and volumes
  • MySQL database
  • Project files and repositories
  • Nginx configuration
  • SSL certificates
  • Vector database collection

🚨 DANGER

This action cannot be undone! Make sure to backup important data first.

Advanced Usage

Custom Docker Configuration

Each project can have custom Docker settings:

yaml
# projects/my-site/docker-compose.yml
services:
  wordpress:
    environment:
      - WORDPRESS_DEBUG=true
      - WORDPRESS_DEBUG_LOG=true
    volumes:
      - ./custom-php.ini:/usr/local/etc/php/conf.d/custom.ini

Multiple Domains per Project

bash
# Add additional domains in Nginx config
# services/nginx/sites-enabled/my-site.conf
server_name my-site.localhost alt-domain.localhost;

Project Templates

Create custom templates for common setups:

bash
# Create from template
wdg create new-site --template ecommerce

# Available templates:
# - wikit-base (default)
# - ecommerce
# - membership
# - blog

Troubleshooting

Project Won't Start

bash
# Check service logs
wdg logs my-site

# Verify port availability
docker ps | grep 8443

# Restart services
wdg stop my-site
wdg start my-site

Database Connection Issues

bash
# Test database connection
wdg wp my-site db check

# Reset database connection
docker-compose restart mysql
wdg restart my-site

File Permission Issues

bash
# Fix WordPress file permissions
docker exec wdg-wp-my-site chown -R www-data:www-data /var/www/html/wp-content

Best Practices

1. Consistent Naming

bash
# Use descriptive, kebab-case names
wdg create client-website       # ✓ Good
wdg create ClientWebsite        # ✗ Bad
wdg create cw                   # ✗ Too short

2. Regular Backups

bash
# Weekly database exports
0 0 * * 0 /path/to/backup-script.sh

3. Monitor Resources

bash
# Check project disk usage regularly
wdg status --resources

4. Update Regularly

bash
# Pull latest Wikit updates
wdg update

# Re-index after updates
wdg index my-site

5. Clean Up Old Projects

bash
# Remove unused projects
wdg delete old-project --force

# Clean up Docker resources
docker system prune -a

Integration with AI

Each project has its own AI context:

bash
# Search within specific project
wdg search "custom post type" --project my-site

# AI assistant automatically scopes to active project
# when you're working in project directory

Next Steps:

Released under the MIT License.