Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

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

Merged
merged 7 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
!MANIFEST.in
!README.rst
!setup.py
!synctl

**/__pycache__
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include synctl
include LICENSE
include VERSION
include *.rst
Expand Down
1 change: 1 addition & 0 deletions changelog.d/12140.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move `synctl` into `synapse._scripts` and expose as an entry point.
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to include a note in the upgrade notes, since server admins might be relying on synctl being where it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's done. @babolivier could you give it a quick sanity check please?

2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RUN \
&& rm -rf /var/lib/apt/lists/*

# 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/python_dependencies.py /synapse/synapse/python_dependencies.py

Expand Down
8 changes: 4 additions & 4 deletions docs/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ database file (typically `homeserver.db`) to another location. Once the
copy is complete, restart synapse. For instance:

```sh
./synctl stop
synctl stop
cp homeserver.db homeserver.db.snapshot
./synctl start
synctl start
```

Copy the old config file into a new config file:
Expand Down Expand Up @@ -192,10 +192,10 @@ Once that has completed, change the synapse config to point at the
PostgreSQL database configuration file `homeserver-postgres.yaml`:

```sh
./synctl stop
synctl stop
mv homeserver.yaml homeserver-old-sqlite.yaml
mv homeserver-postgres.yaml homeserver.yaml
./synctl start
synctl start
```

Synapse should now be running against PostgreSQL.
Expand Down
5 changes: 3 additions & 2 deletions docs/turn-howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,9 @@ After updating the homeserver configuration, you must restart synapse:

* If you use synctl:
```sh
cd /where/you/run/synapse
./synctl restart
# Depending on how Synapse is installed, synctl may already be on
# your PATH. If not, you may need to activate a virtual environment.
synctl restart
```
* If you use systemd:
```sh
Expand Down
23 changes: 22 additions & 1 deletion docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ this document.
3. Restart Synapse:

```bash
./synctl restart
synctl restart
```

To check whether your update was successful, you can check the running
Expand Down Expand Up @@ -85,6 +85,27 @@ process, for example:
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

## Legacy structured logging configuration removal
Expand Down
2 changes: 1 addition & 1 deletion scripts-dev/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ else
"synapse" "docker" "tests"
# annoyingly, black doesn't find these so we have to list them
"scripts-dev"
"contrib" "synctl" "setup.py" "synmark" "stubs" ".ci"
"contrib" "setup.py" "synmark" "stubs" ".ci"
)
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def exec_file(path_segments):
# Application
"synapse_homeserver = synapse.app.homeserver:main",
"synapse_worker = synapse.app.generic_worker:main",
"synctl = synapse._scripts.synctl:main",
# Scripts
"export_signing_key = synapse._scripts.export_signing_key:main",
"generate_config = synapse._scripts.generate_config:main",
Expand All @@ -177,6 +178,5 @@ def exec_file(path_segments):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
scripts=["synctl"],
cmdclass={"test": TestCommand},
)
File renamed without changes.
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ lint_targets =
scripts-dev
stubs
contrib
synctl
synmark
.ci
docker
Expand Down