Bogus Link

Sites Schema

The sites schema is a JSON schema for data describing website configurations. It is used on our server to verify the JSON data that drives maintaining the permissions/ownership model and folder structure that we use for websites, and web applications, that we host on our servers. It is currently being developed to drive generation of the Apache 2.4 httpd.conf configuration file. An example JSON data file is shown below the schema.

GitHub Repo

We are pleased to make the code available on GitHub under the Apache 2.0 open source license:
Sites Schema on GitHub

Latest Version

This is version 0.11 of the schema, completed 2 March 2017. See GitHub for the latest development version, or to download this version (look in releases for the appropriate version number).

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "https://sharphosting.uk/schemas/sites",
    "title": "Sites",
    "description": "Schema for data describing shared hosting website configurations.",
    "type": "object",
    "properties": {
        "site_types": {
            "type": "object",
            "patternProperties": {
                "^[a-z]+$": {
                    "title": "Site Type",
                    "type": "object",
                    "properties": {
                        "keep_empty": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "pattern": "^(/[^/]+)+$"
                            }
                        },
                        "open_folders": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "pattern": "^(/[^/]+)+$"
                            }
                        },
                        "read_only": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "pattern": "^(/[^/]+)+$"
                            }
                        }
                    }
                },
                "additionalProperties": false
            },
            "additionalProperties": false
        },
        "sites": {
            "type": "object",
            "patternProperties": {
                "^(/[^/]+)+$": {
                    "title": "Site Folder",
                    "type": "object",
                    "properties": {
                        "user": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9]+$"
                        },
                        "type": {
                            "type": "string",
                            "enum": ["static", "joomla", "wordpress"]
                        },
                        "open_folders": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "pattern": "^(/[^/]+)+$"
                            }
                        },
                        "read_only": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "pattern": "^(/[^/]+)+$"
                            }
                        },
                        "server_files": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "pattern": "^(/[^/]+)+$"
                            }
                        },
                        "has_cgi_bin": { "type": "boolean" }
                    },
                    "required": [ "user", "type" ],
                    "additionalProperties": false
                }
            },
            "additionalProperties": false
        }
    },
    "additionalProperties": false
}

Example Data

The data displayed below is an example of the kind of JSON data that might be validated using the above schema. The paths in the data are not real. We do not store out sites in /var/www/sites:

{
    "site_types" : {
        "joomla" : {
            "keep_empty" : [
                "/tmp"
            ],
            "open_folders" : [
                "/administrator/cache",
                "/cache",
                "/logs",
                "/tmp"
            ],
            "read_only" : [
                "/configuration.php"
            ]
        },
        "wordpress" : {
            "open_folders" : [
                "/wp-content/upload"
            ],
            "read_only" : [
                "/wp-config.php"
            ]
        }
    },
    "sites" : {
        "/var/www/sites/apps.example.com": {
            "user": "exampleapps",
            "type": "static"
        },
        "/var/www/sites/default_host": {
            "user": "jason",
            "type": "static"
        },
        "/var/www/sites/www.example.com": {
            "user": "exampleweb",
            "type": "joomla",
            "open_folders" : [
                "/images",
                "/templates/templatecw/images"
            ],
            "server_files" : [
                "/cache/37b32d223fc1de234850973dc23578ef-cache--38d1e432098e63c378943d2f489102fc.php"
            ]
        },
        "/var/www/sites/oldsite.example.org": {
                "user": "oldsiteexample",
                "type": "static",
            "has_cgi_bin": true
        }
    }
}