Update `docker-compose` README.md

Signed-off-by: mervyn <6359152+reply2future@users.noreply.github.com>
pull/16392/head
mervyn 2023-09-27 14:44:28 +08:00
parent 9c80525afa
commit c59971cb9f
1 changed files with 29 additions and 16 deletions

View File

@ -1,31 +1,44 @@
# Synapse Docker # Synapse Docker
There are two `docker-compose.yaml` files to support `sqlite` and `postgres` databases.
1. The `postgres` database is recommended for production use, you could use `docker-compose.postgres.yaml`.
2. The `sqlite` database is recommended for development and testing, you could use `docker-compose.sqlite.yaml`.
Please comment/uncomment sections that are not suitable for your usecase.
Go to the directory `contrib/docker` to run the below command.
### Configuration ### Configuration
A sample ``docker-compose.yml`` is provided, including example labels for The container `synapse-init` is to generate a fresh `homeserver.yaml`, you can use the `generate` command.
reverse proxying and other artifacts. The docker-compose file is an example,
please comment/uncomment sections that are not suitable for your usecase.
Specify a ``SYNAPSE_CONFIG_PATH``, preferably to a persistent path,
to use manual configuration.
To generate a fresh `homeserver.yaml`, you can use the `generate` command.
(See the [documentation](../../docker/README.md#generating-a-configuration-file) (See the [documentation](../../docker/README.md#generating-a-configuration-file)
for more information.) You will need to specify appropriate values for at least the for more information.) You will need to specify appropriate values for at least the
`SYNAPSE_SERVER_NAME` and `SYNAPSE_REPORT_STATS` environment variables. For example: `SYNAPSE_SERVER_NAME` and `SYNAPSE_REPORT_STATS` environment variables. For example:
``` Specify a ``SYNAPSE_CONFIG_PATH``, preferably to a persistent path,
docker-compose run --rm -e SYNAPSE_SERVER_NAME=my.matrix.host -e SYNAPSE_REPORT_STATS=yes synapse generate to use manual configuration.
```
(This will also generate necessary signing keys.) You just choose one of the following options.
Then, customize your configuration and run the server: #### sqlite
``` 1. change the `SYNAPSE_SERVER_NAME` of `synapse-init` at the `docker-compose.sqlite.yaml`
docker-compose up -d 2. change the local device path of `volumes` at the `docker-compose.sqlite.yaml`
``` 3. run the command `docker-compose -f docker-compose.sqlite.yml up -d`
#### postgres
1. change the `SYNAPSE_SERVER_NAME` of `synapse-init` at the `docker-compose.postgres.yaml`
2. change the local device path of `volumes` for `synapse_data` and `pg_data` at the `docker-compose.postgres.yaml`
3. create the direcotry of `pg_data`, such as `mkdir -p pg_data`
3. change the postgres password by `POSTGRES_PASSWORD`
3. run the command `docker-compose -f docker-compose.postgres.yml up -d`
### Validate
Open `http://localhost:8008` in your browser, and it's successful if you see the welcome page.
### More information ### More information