Skip to content

Clone Site Plugin

Daniel Neto edited this page Mar 21, 2022 · 15 revisions

This Plugin helps you to clone YouPHPTube sites

This plugin requires from you that you have 2 instances of AVideo running. also you will need SSH access to both servers

Check our video tutorial: https://tutorials.youphptube.com/video/backup-or-clone-your-site

The Feature

In this feature, we have two ends. clients (The Clone) and server (The Master).

Important to inform you that every time it is cloned the Client database will be overwritten with the Server database, so if you have uploaded, commented, or view any video on the client, it will be lost.

The Process with rsync (Support HLS)

Rsync is a very powerful tool to take backups or sync files and directories between two different locations (or servers).

To use rsync you must have it and the sshpass tool, so use the command sudo apt-get install rsync sshpass

  1. The Client asks the Server permission to clone him
  2. The Server Accept the permission
  3. The Server makes a Dump of his database
  4. The Client download the database file from the Server and overwrite his own database with the downloaded one
  5. The Client will use rsync to sync all the files inside the videos directory, except .php and .log files.
  6. The Client notifies the Server of the Job and the server delete the generated dump file

The Process without rsync (Does not support HLS)

Basically, the process is like that ...

  1. The Client asks the Server permission to clone him
  2. The Server Accept the permission
  3. The Server makes a Dump of his database and creates a list of its videos and images (With the file size and Modification time)
  4. The Client download the database file from the Server and overwrite his own database with the downloaded one
  5. The Client compares the videos and files list with his own video and files and downloads the new and the modified files.
  6. The Client notifies the Server of the Job and the server delete the generated dump file

Configuration

  • You will need two YouPHPTube installations (Client and Server), with the latest commit on both.
  • You must enable the CloneSite Plugin on the Client and on the Server

Client

The Client is a YouPHPTube Site Clone

Follow those steps on your Client

  1. Fill the cloneSiteURL parameter with the server site
  2. Click on the Green Button "Clone Now"
  3. You may be notified with "The URL ... was just added in our server, ask the Server Manager to approve this URL on plugins->Clone Site->Clones Manager (The Blue Button) and Activate your client". So that means your need to approve your client on the Server, otherwise, the cloning process will start

Server

The Server is also a YouPHPTube Site where the clients will be cloned from

To approve clients to clone your site click on the blue button "Clones Manager" and the green button "Activate" on the left side of the client you want to approve.

Clone this wiki locally