Presslabs Git servers

The code of all the sites hosted with Presslabs is stored on our Git servers stack. The stack consists in a pair of servers in sync, with a failover mechanism in case something goes wrong with the primary server.

How does it all work?

The main Git repositories (stored on the stack mentioned above) are cloned and mounted on the corresponding lxc container where the php code is executed. All the changes done directly from WordPress, such as plugins and themes installs, updates, deletions, or direct files changes, are then committed as changes by our Gitium plugin. This means that all changes done are stored as Git commits and can be easily reverted using Git commands. In the same time, whenever a new push is done on the Git servers, Gitium is notified through a post-push hook and pulls that push into the cloned repo. In this way you see on your site the changes done through direct Git commands or via SFTP.

In the same time, the Git repos are cloned on our SFTP server and mounted there using gitfs. Here as well, gitfs is catching all changes done via SFTP and sends them as Git commits to the main Git repos. Gitfs does regular checks for new commits every 30 seconds, updating the cloned repo with all other changes, keeping in this way SFTP in sync with everything else.


gitfs enters in idle mode after 50 seconds from the last change done using SFTP. When in idle mode, the checks for new commits are done every 5 minutes.

What is stored in Git and what not?

Here's the standard folders structure from a Git repository for a site hosted with Presslabs:

`-- provision (this is used by Vagrant)
    |-- wordpress (this is an empty folder where Vagrant will clone the WordPress repo)
    `-- wp-content
        |-- gallery (this is a symlink to the uploads -> gallery folder)
        |-- languages (optional, where translations are stored)
        |-- plugins (plugins are stored here)
        |-- root (files from the root of your site are stored here)
        |-- themes (your site's themes are stored here)
        |-- uploads (this is here for the symlink above to work)
        `-- wptouch-data (another symlink to the uploads folders)

The answer is simple: those folders contain data that shouldn't be stored directly in wp-content, but rather in the uploads folder. The gallery folder is created by the plugin NextGEN Gallery and contains image files and can be very large in size. There is no point in storing image files on Git, therefore we have moved it in the uploads folder where it belongs. Then the plugin WpTouch or WpTouch Pro is creating the wptouch-data folder that can also become huge in size in case the debug option is turned on.

Using symlinks was the only solution to keep those plugins working and to move the content of those folders in the uploads folder as a sub-folder.