Move synctl into synapse._scripts and expose as an entrypoint (#12140)

This commit is contained in:
David Robertson 2022-03-04 11:58:49 +00:00 committed by GitHub
parent 423cca9efe
commit 4aeb00ca20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 33 additions and 13 deletions

View File

@ -7,6 +7,5 @@
!MANIFEST.in !MANIFEST.in
!README.rst !README.rst
!setup.py !setup.py
!synctl
**/__pycache__ **/__pycache__

View File

@ -1,4 +1,3 @@
include synctl
include LICENSE include LICENSE
include VERSION include VERSION
include *.rst include *.rst

1
changelog.d/12140.misc Normal file
View File

@ -0,0 +1 @@
Move `synctl` into `synapse._scripts` and expose as an entry point.

View File

@ -46,7 +46,7 @@ RUN \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copy just what we need to pip install # Copy just what we need to pip install
COPY MANIFEST.in README.rst setup.py synctl /synapse/ COPY MANIFEST.in README.rst setup.py /synapse/
COPY synapse/__init__.py /synapse/synapse/__init__.py COPY synapse/__init__.py /synapse/synapse/__init__.py
COPY synapse/python_dependencies.py /synapse/synapse/python_dependencies.py COPY synapse/python_dependencies.py /synapse/synapse/python_dependencies.py

View File

@ -153,9 +153,9 @@ database file (typically `homeserver.db`) to another location. Once the
copy is complete, restart synapse. For instance: copy is complete, restart synapse. For instance:
```sh ```sh
./synctl stop synctl stop
cp homeserver.db homeserver.db.snapshot cp homeserver.db homeserver.db.snapshot
./synctl start synctl start
``` ```
Copy the old config file into a new config file: Copy the old config file into a new config file:
@ -192,10 +192,10 @@ Once that has completed, change the synapse config to point at the
PostgreSQL database configuration file `homeserver-postgres.yaml`: PostgreSQL database configuration file `homeserver-postgres.yaml`:
```sh ```sh
./synctl stop synctl stop
mv homeserver.yaml homeserver-old-sqlite.yaml mv homeserver.yaml homeserver-old-sqlite.yaml
mv homeserver-postgres.yaml homeserver.yaml mv homeserver-postgres.yaml homeserver.yaml
./synctl start synctl start
``` ```
Synapse should now be running against PostgreSQL. Synapse should now be running against PostgreSQL.

View File

@ -238,8 +238,9 @@ After updating the homeserver configuration, you must restart synapse:
* If you use synctl: * If you use synctl:
```sh ```sh
cd /where/you/run/synapse # Depending on how Synapse is installed, synctl may already be on
./synctl restart # your PATH. If not, you may need to activate a virtual environment.
synctl restart
``` ```
* If you use systemd: * If you use systemd:
```sh ```sh

View File

@ -47,7 +47,7 @@ this document.
3. Restart Synapse: 3. Restart Synapse:
```bash ```bash
./synctl restart synctl restart
``` ```
To check whether your update was successful, you can check the running To check whether your update was successful, you can check the running
@ -85,6 +85,27 @@ process, for example:
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
``` ```
# Upgrading to v1.55.0
## `synctl` script has been moved
The `synctl` script
[has been made](https://github.com/matrix-org/synapse/pull/12140) an
[entry point](https://packaging.python.org/en/latest/specifications/entry-points/)
and no longer exists at the root of Synapse's source tree. If you wish to use
`synctl` to manage your homeserver, you should invoke `synctl` directly, e.g.
`synctl start` instead of `./synctl start` or `/path/to/synctl start`.
You will need to ensure `synctl` is on your `PATH`.
- This is automatically the case when using
[Debian packages](https://packages.matrix.org/debian/) or
[docker images](https://hub.docker.com/r/matrixdotorg/synapse)
provided by Matrix.org.
- When installing from a wheel, sdist, or PyPI, a `synctl` executable is added
to your Python installation's `bin`. This should be on your `PATH`
automatically, though you might need to activate a virtual environment
depending on how you installed Synapse.
# Upgrading to v1.54.0 # Upgrading to v1.54.0
## Legacy structured logging configuration removal ## Legacy structured logging configuration removal

View File

@ -85,7 +85,7 @@ else
"synapse" "docker" "tests" "synapse" "docker" "tests"
# annoyingly, black doesn't find these so we have to list them # annoyingly, black doesn't find these so we have to list them
"scripts-dev" "scripts-dev"
"contrib" "synctl" "setup.py" "synmark" "stubs" ".ci" "contrib" "setup.py" "synmark" "stubs" ".ci"
) )
fi fi
fi fi

View File

@ -155,6 +155,7 @@ setup(
# Application # Application
"synapse_homeserver = synapse.app.homeserver:main", "synapse_homeserver = synapse.app.homeserver:main",
"synapse_worker = synapse.app.generic_worker:main", "synapse_worker = synapse.app.generic_worker:main",
"synctl = synapse._scripts.synctl:main",
# Scripts # Scripts
"export_signing_key = synapse._scripts.export_signing_key:main", "export_signing_key = synapse._scripts.export_signing_key:main",
"generate_config = synapse._scripts.generate_config:main", "generate_config = synapse._scripts.generate_config:main",
@ -177,6 +178,5 @@ setup(
"Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
], ],
scripts=["synctl"],
cmdclass={"test": TestCommand}, cmdclass={"test": TestCommand},
) )

View File

@ -42,7 +42,6 @@ lint_targets =
scripts-dev scripts-dev
stubs stubs
contrib contrib
synctl
synmark synmark
.ci .ci
docker docker