diff options
| author | Leitwolf11 | 2026-11-15 15:28:13 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-15 15:28:13 +0300 |
| commit | 30b799ffe9f67aac0abe9ce8426cec8b2d6163f8 (patch) | |
| tree | 9e10a98f8bd780ab820d034c32f9deccb0b8956f /ops | |
| parent | 1a73486c0f67ddf3bfe3fd01e2258648f81fbb48 (diff) | |
| download | progmaweb-ops/schemastore.tar.gz | |
Serve JSON Schemas on schemastore.progmasoft.comops/schemastore
schemastore.progmasoft.com/json/ holds the JSON Schemas of Progmasoft's file
formats. The first is progmasoft-cpp-index.json, which describes the
index.json of each folder of guidelines in Progmasoft/progmasoft-cpp: the
language versions with exactly one default, and every document with its
chapter, path and versions.
- ops/schemastore/json: the schemas, under CC0-1.0 (REUSE.toml, the legal
code in LICENSES/CC0-1.0.txt) so that projects and schema catalogs can copy
them.
- ops/schemastore/nginx/schemastore.conf: static files from
/srv/schemastore, GET only, readable from every origin for editors in the
browser, an hour of caching; everything outside /json/ is 404.
- ops/README.md: the install steps, the SELinux label and the rule that a
schema which would reject files it accepted before gets a new name.
Live on 91.151.88.130; the progmasoft.com certificate names the host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
Diffstat (limited to 'ops')
| -rw-r--r-- | ops/README.md | 18 | ||||
| -rw-r--r-- | ops/schemastore/json/progmasoft-cpp-index.json | 118 | ||||
| -rw-r--r-- | ops/schemastore/nginx/schemastore.conf | 69 |
3 files changed, 205 insertions, 0 deletions
diff --git a/ops/README.md b/ops/README.md index b3c95bf..36b44bd 100644 --- a/ops/README.md +++ b/ops/README.md @@ -295,6 +295,24 @@ ssh root@91.151.88.130 'chown -R root:root /srv/maven && restorecon -R /srv/mave Published versions are never changed. The certificate of `progmasoft.com` must name `maven.progmasoft.com`. +## JSON Schemas + +`schemastore.progmasoft.com/json/` serves the JSON Schemas of Progmasoft's file formats, such as +`progmasoft-cpp-index.json` for the `index.json` of each folder of guidelines in Progmasoft/progmasoft-cpp. The schemas +are in `ops/schemastore/json`, under CC0-1.0, and are served from `/srv/schemastore/json` by +`ops/schemastore/nginx/schemastore.conf` (installed as `/etc/nginx/conf.d/schemastore.conf`), to any origin, with GET +only: + +```sh +install -d -m 0755 /srv/schemastore /srv/schemastore/json +semanage fcontext -a -t httpd_sys_content_t '/srv/schemastore(/.*)?' +scp ops/schemastore/json/*.json root@91.151.88.130:/srv/schemastore/json/ +ssh root@91.151.88.130 'chown -R root:root /srv/schemastore && chmod 0644 /srv/schemastore/json/*.json && restorecon -R /srv/schemastore' +``` + +A schema's `$id` is its address. A change that would reject files the schema accepted before gets a new file name +instead. The certificate of `progmasoft.com` must name `schemastore.progmasoft.com`. + ## Git mirrors `git.progmasoft.com` shows read-only mirrors of the public repositories under development, such as diff --git a/ops/schemastore/json/progmasoft-cpp-index.json b/ops/schemastore/json/progmasoft-cpp-index.json new file mode 100644 index 0000000..e467d4b --- /dev/null +++ b/ops/schemastore/json/progmasoft-cpp-index.json @@ -0,0 +1,118 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemastore.progmasoft.com/json/progmasoft-cpp-index.json", + "title": "Progmasoft C/C++ Styles guidelines index", + "description": "The index.json of a guidelines folder in Progmasoft C/C++ Styles (https://github.com/Progmasoft/progmasoft-cpp): the language versions it covers and every document with its chapter and the versions it applies to.", + "type": "object", + "required": ["title", "license", "standards", "documents"], + "additionalProperties": false, + "properties": { + "$schema": { + "description": "This schema: https://schemastore.progmasoft.com/json/progmasoft-cpp-index.json.", + "type": "string", + "format": "uri" + }, + "title": { + "description": "The name of the guidelines, such as \"Progmasoft Core C++ Coding Guidelines\".", + "type": "string", + "minLength": 1 + }, + "license": { + "description": "The SPDX license identifier of the text of the guidelines.", + "type": "string", + "minLength": 1 + }, + "standards": { + "description": "The language versions the guidelines cover. Exactly one is the default.", + "type": "array", + "minItems": 1, + "items": { "$ref": "#/$defs/standard" }, + "contains": { + "type": "object", + "properties": { "default": { "const": true } }, + "required": ["default"] + }, + "minContains": 1, + "maxContains": 1 + }, + "documents": { + "description": "Every document of the guidelines.", + "type": "array", + "minItems": 1, + "items": { "$ref": "#/$defs/document" } + } + }, + "$defs": { + "id": { + "description": "A lowercase identifier: letters, digits and hyphens.", + "type": "string", + "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" + }, + "path": { + "description": "A Markdown file, relative to the folder of index.json, with forward slashes.", + "type": "string", + "pattern": "^[A-Za-z0-9_-]+(/[A-Za-z0-9_.-]+)*\\.md$" + }, + "standard": { + "type": "object", + "required": ["id", "name", "default", "for", "documents"], + "additionalProperties": false, + "properties": { + "id": { + "$ref": "#/$defs/id", + "description": "The identifier documents use in their standards list, such as \"cpp20\"." + }, + "name": { + "description": "The name of the version, such as \"C++20\".", + "type": "string", + "minLength": 1 + }, + "default": { + "description": "Whether a project uses this version unless it says otherwise.", + "type": "boolean" + }, + "for": { + "description": "The projects this version is meant for.", + "type": "string", + "minLength": 1 + }, + "documents": { + "description": "The documents that hold the rules of this version alone.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { "$ref": "#/$defs/path" } + } + } + }, + "document": { + "type": "object", + "required": ["id", "title", "path", "standards"], + "additionalProperties": false, + "properties": { + "id": { + "$ref": "#/$defs/id", + "description": "The identifier of the document, unique in the index." + }, + "chapter": { + "description": "The chapter number of a document shared by every version; a version's own page has none.", + "type": "integer", + "minimum": 1 + }, + "title": { + "description": "The title of the document.", + "type": "string", + "minLength": 1 + }, + "path": { "$ref": "#/$defs/path" }, + "standards": { + "description": "The identifiers of the versions the document applies to.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { "$ref": "#/$defs/id" } + } + } + } + } +} diff --git a/ops/schemastore/nginx/schemastore.conf b/ops/schemastore/nginx/schemastore.conf new file mode 100644 index 0000000..199d3ee --- /dev/null +++ b/ops/schemastore/nginx/schemastore.conf @@ -0,0 +1,69 @@ +# SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +# SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 + +# https://schemastore.progmasoft.com: the JSON Schemas of Progmasoft's file +# formats, such as /json/progmasoft-cpp-index.json. Static files only, copied +# from ops/schemastore/json; see ops/README.md. Installed as +# /etc/nginx/conf.d/schemastore.conf. + +server { + listen 80; + listen [::]:80; + server_name schemastore.progmasoft.com; + + location ^~ /.well-known/acme-challenge/ { + root /var/lib/letsencrypt; + default_type text/plain; + } + + location / { + return 308 https://schemastore.progmasoft.com$request_uri; + } +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + http2 on; + server_name schemastore.progmasoft.com; + + ssl_certificate /etc/letsencrypt/live/progmasoft.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/progmasoft.com/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + + root /srv/schemastore; + client_max_body_size 1k; + + add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; + add_header X-Content-Type-Options "nosniff" always; + add_header Referrer-Policy "strict-origin-when-cross-origin" always; + + location = / { + return 302 https://schemastore.progmasoft.com/json/; + } + + # Editors in the browser fetch schemas from other origins, so every origin + # may read them. Nothing here takes cookies or writes anything. + location ^~ /json/ { + limit_except GET { + deny all; + } + autoindex on; + charset utf-8; + charset_types application/json; + types { + application/json json; + } + expires 1h; + add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; + add_header X-Content-Type-Options "nosniff" always; + add_header Referrer-Policy "strict-origin-when-cross-origin" always; + add_header Access-Control-Allow-Origin "*" always; + add_header Content-Security-Policy "default-src 'none'; frame-ancestors 'none'" always; + try_files $uri $uri/ =404; + } + + location / { + return 404; + } +} |