Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Machine-readable config description #17892

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e41a90d
Add basic JSON Schema for Synapse’s configuration
V02460 Oct 21, 2024
a547145
Add descriptions and examples
V02460 Oct 22, 2024
048b619
Add worker section
V02460 Oct 31, 2024
5a299f1
Initial script
V02460 Oct 23, 2024
85ac15d
Improve defaults
V02460 Oct 31, 2024
6de8466
Add section headers
V02460 Oct 31, 2024
5688f0f
Generate documentation from schema
V02460 Oct 31, 2024
fb6a876
Add newsfragment
V02460 Oct 31, 2024
2dddfdf
Merge branch 'develop' into schema
V02460 Nov 5, 2024
9b57816
Fix link to config documentation
V02460 Nov 5, 2024
fecddae
Tweak script so it actually runs (perhaps specific to Python 3.10)
reivilibre Nov 13, 2024
6906711
Add errors for missing descriptions
reivilibre Nov 13, 2024
186f43b
Remove 'smart quotes'; use plain ASCII quotes
reivilibre Nov 13, 2024
6de86f2
Add special type name overrides for bytes, duration and size
reivilibre Nov 13, 2024
b2672d7
Fix word `avatar` being lost in transcription of schema
reivilibre Nov 13, 2024
1705d7e
Fix some typos and duplicated example/default blocks
reivilibre Nov 13, 2024
7dc3053
Remove duplicate default
reivilibre Nov 13, 2024
4c98384
Fix type of `account_threepid_delegates`
reivilibre Nov 13, 2024
cb15ce6
Add 'Reloading cache factors' section back
reivilibre Nov 13, 2024
2c4902a
Re-add description of room complexity
reivilibre Nov 13, 2024
c7fbf7b
Fix default config of `ip_range_blacklist`
reivilibre Nov 13, 2024
d6eec62
Fix default of `media_store_path`
reivilibre Nov 13, 2024
84a2491
Move schema
V02460 Nov 25, 2024
9704afb
Format JSON schema
V02460 Nov 25, 2024
122a3b3
Fix typos
V02460 Nov 26, 2024
18f9ac8
Add synapse-config.schema.yaml
V02460 Nov 25, 2024
f451e23
Add missing descriptions
V02460 Nov 26, 2024
e157a0a
Add meta schema
V02460 Nov 26, 2024
9fd0a48
Merge branch 'develop' into schema
V02460 Nov 26, 2024
2d817dc
Print usage on too many arguments
V02460 Nov 26, 2024
d39bc3d
Merge branch 'develop' into schema
V02460 Feb 4, 2025
151813b
Fix duration definition
V02460 Feb 4, 2025
9b43a23
ci: Validate schema and check doc generation
V02460 Feb 4, 2025
fdd5e11
Remove JSON schema in favor of the YAML one
V02460 Feb 4, 2025
bf984d6
Fix rc definition and defaults
V02460 Feb 4, 2025
56c1faf
Add support for YAML input to script
V02460 Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Schema

on:
pull_request:
paths:
- schema/**
- docs/usage/configuration/config_documentation.md

jobs:
validate-schema:
name: Ensure Synapse config schema is valid
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install check-jsonschema
run: pip install check-jsonschema

- name: Validate meta schema
run: check-jsonschema --check-metaschema schema/meta.schema.json
- name: Validate schema
run: check-jsonschema --schemafile=schema/meta.schema.json schema/synapse-config.schema.yaml
- name: Validate default config
run: echo "{}" | check-jsonschema --fill-defaults --schemafile=schema/synapse-config.schema.yaml -

check-doc-generation:
name: Ensure generated documentation is up-to-date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Regenerate config documentation
run: |
scripts-dev/gen_config_documentation.py \
schema/synapse-config.schema.yaml \
> docs/usage/configuration/config_documentation.md
- name: Log any differences
run: git diff
- name: Error in case of any differences
run: '! git status --porcelain=1 | grep "^ M"'
1 change: 1 addition & 0 deletions changelog.d/17892.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Generate config documentation from JSON Schema file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed this PR in a weekly meeting to make sure that this is something we want to do. People are onboard with the benefits 👍

We just have to make sure this implementation is something we want to use and we won't be kicking ourselves months down the line that it's difficult to express constraints, validation, or formatting.

2 changes: 1 addition & 1 deletion docs/usage/administration/admin_faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ line to `/etc/default/matrix-synapse`:

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2

*Note*: You may need to set `PYTHONMALLOC=malloc` to ensure that `jemalloc` can accurately calculate memory usage. By default, Python uses its internal small-object allocator, which may interfere with jemalloc's ability to track memory consumption correctly. This could prevent the [cache_autotuning](../configuration/config_documentation.md#caches-and-associated-values) feature from functioning as expected, as the Python allocator may not reach the memory threshold set by `max_cache_memory_usage`, thus not triggering the cache eviction process.
*Note*: You may need to set `PYTHONMALLOC=malloc` to ensure that `jemalloc` can accurately calculate memory usage. By default, Python uses its internal small-object allocator, which may interfere with jemalloc's ability to track memory consumption correctly. This could prevent the [cache_autotuning](../configuration/config_documentation.md#caches) feature from functioning as expected, as the Python allocator may not reach the memory threshold set by `max_cache_memory_usage`, thus not triggering the cache eviction process.

This made a significant difference on Python 2.7 - it's unclear how
much of an improvement it provides on Python 3.x.
Expand Down
Loading