Presslabs Git servers

All the code of all the sites hosted on our Presslabs platform is being stored on our Git servers stack—a pair of servers in sync, with a failover mechanism in case something goes wrong with the primary server. Here’s how it works.

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?

Once a site is added on our dashboard, a repo is automatically created for it. The dashboard app clones the repo and gets the code from the standard site file layout – Gitium base, which is a public repo on GitHub, and all our instances start from there.

The code gets pushed to the repo on Gitea , and deploy hooks are added (for every push on Gitea, a deploy on wp-admin and purge assets cache are made). A deploy key is created, which is a unique key for each instance, so that every change from wp-admin can get on Gitea.

All the collaborators from our dashboard are added in Gitea. An oxygen-bot collaborator will be also added, in order for our team to have access to the users’ code.

In order to access a repo, a user has to add his/her SSH key on our dashboard, and use HTTPS to clone the repo by introducing his/her Presslabs account credentials.

What is stored in Git and what not?

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

site-name
`-- 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.