Skip to content

Replication

Overview

StarkOne supports two types of replication:

  1. Website file replication - sync website files to remote servers using rsync
  2. Panel action replication - replay panel actions (create website, add database, etc.) on one or more secondary servers in real time

Panel Action Replication

Panel action replication mirrors panel operations to secondary StarkOne servers. When you create a website on the primary, the secondary gets the same website created automatically.

Replication Servers

# List replication servers
GET /api/replication-servers

# Add a server
POST /api/replication-servers
{
  "name": "Secondary EU",
  "host": "eu-server.example.com",
  "port": 2087,
  "token": "secret-token"
}

# Update
PUT /api/replication-servers/:id

# Delete
DELETE /api/replication-servers/:id

# Test connectivity
POST /api/replication-servers/:id/test

# Toggle enabled/disabled
POST /api/replication-servers/:id/toggle

Category Toggles

Control which categories of actions are replicated:

# Get categories for a server
GET /api/replication-servers/:id/categories

# Update all categories
PUT /api/replication-servers/:id/categories
{
  "websites": true,
  "databases": true,
  "dns": false,
  "users": true
}

# Update a single category
PATCH /api/replication-servers/:id/categories/:category
{ "enabled": false }

Action Log

# Get recent replication actions and their status
GET /api/replication-servers/:id/action-log

# Retry a failed action
POST /api/replication-servers/:id/action-log/:action_id/retry

# Clear action log
DELETE /api/replication-servers/:id/action-log

Website File Replication

Sync website files to a remote server.

List Website Replications

GET /api/webapps/:id/replications

Create a Replication

POST /api/webapps/:id/replications
{
  "server_id": 1,
  "remote_path": "/home/example/public_html/",
  "schedule": "*/30 * * * *"
}

Delete a Replication

DELETE /api/webapps/:id/replications/:replication_id

Trigger Manual Sync

POST /api/webapps/:id/replications/:replication_id/sync

Trigger Initial Sync

For the first sync (full copy):

POST /api/webapps/:id/replications/:replication_id/initial-sync

Watch Folders

Control which folders are included in replication:

# List watch folders
GET /api/webapps/:id/replications/:replication_id/watch-folders

# Add a watch folder
POST /api/webapps/:id/replications/:replication_id/watch-folders
{ "path": "/public_html/" }

# Delete a watch folder
DELETE /api/webapps/:id/replications/:replication_id/watch-folders/:folder_id

# Toggle a watch folder
POST /api/webapps/:id/replications/:replication_id/watch-folders/:folder_id/toggle

Helper Endpoints

Used internally during replication setup:

# Check if a user exists on this server
GET /api/replication/check-user/:username

# Install an SSH public key for a user
POST /api/replication/install-ssh-key/:username
{ "public_key": "ssh-rsa AAAA..." }