Update README.md

This commit is contained in:
Awiteb 2024-05-03 11:07:29 +03:00
parent dc62f080c8
commit 0945e9359e
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F

View file

@ -4,7 +4,7 @@ This is my personal matrix homeserver. You can clone this repository and run the
## Overview ## Overview
In this repository I use `4rs.nl` (my domain) as an example. You should replace this with your own domain. In this repository I use `4rs.nl` (my domain) as an example. You should replace this with your own domain.
After reading this README you should have a `/.well-known/matrix/server` and `/.well-known/matrix/client` file on your domain (4rs.nl) and your matrix subdomain (matrix.4rs.nl). The client will use `matrix.4rs.nl` as the homeserver and the displayed homeserver will be `4rs.nl`. After reading this README you should have a `/.well-known/matrix/server` and `/.well-known/matrix/client` file on your domain (4rs.nl). The client will use `matrix.4rs.nl` as the homeserver and the displayed server name will be `4rs.nl`.
## Requirements ## Requirements
- docker - docker
@ -12,14 +12,14 @@ After reading this README you should have a `/.well-known/matrix/server` and `/.
- nginx - nginx
## Domain requirements ## Domain requirements
- Have a `/.well-known/matrix/server` file on your domain that points to your homeserver. This is required for federation to work. - Have a `/.well-known/matrix/server` file on your domain (server name) that points to your homeserver. This is required for federation to work.
The content of the file should be: The content of the file should be:
``` ```
{ {
"m.server": "matrix.4rs.nl:443" "m.server": "matrix.4rs.nl:443"
} }
``` ```
- Have a `/.well-known/matrix/client` file on your domain that points to your homeserver. This is required for the client to work. - Have a `/.well-known/matrix/client` file on your domain (server name) that points to your homeserver. This is required for the client to work.
The content of the file should be: The content of the file should be:
``` ```
{ {
@ -29,7 +29,8 @@ The content of the file should be:
} }
``` ```
For me, I created the files in my static blog and then deployed it in GitHub pages. See the [justfile that I use to deploy the files to the domain](https://git.4rs.nl/awiteb/blog/src/branch/master/Justfile#L15-L17). You can use any other method to deploy the files and make them accessible on your domain, as long as they are accessible at `/.well-known/matrix/server` and `/.well-known/matrix/client`. For me, I created the files in my static blog and then deployed it in GitHub pages. See the files [here](https://git.4rs.nl/awiteb/blog/src/branch/master/static/.well-known/matrix) in my blog repository.
You can use any other method to deploy the files and make them accessible on your domain, as long as they are accessible at `/.well-known/matrix/server` and `/.well-known/matrix/client`.
## Nginx configuration of the matrix subdomain ## Nginx configuration of the matrix subdomain
@ -87,16 +88,6 @@ server {
client_body_timeout 5s; client_body_timeout 5s;
client_header_timeout 5s; client_header_timeout 5s;
location /.well-known/matrix/server {
return 200 '{"m.server": "matrix.4rs.nl:443"}';
default_type application/json;
add_header Access-Control-Allow-Origin *;
}
location /.well-known/matrix/client {
return 200 '{"m.homeserver": {"base_url": "https://matrix.4rs.nl}}';
default_type application/json;
add_header Access-Control-Allow-Origin *;
}
location / { location / {
proxy_pass http://localhost:8008; proxy_pass http://localhost:8008;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
@ -116,12 +107,13 @@ After you have cloned the repository, replace all `4rs.nl` with your domain also
There is tow things only you need to change it, the first one is the secrets in `./data/homeserver.yaml` and the second one is the signing key in `./data/4rs.nl.signing.key`. There is tow things only you need to change it, the first one is the secrets in `./data/homeserver.yaml` and the second one is the signing key in `./data/4rs.nl.signing.key`.
### Homeserver.yaml ### homeserver.yaml
After replacing all `4rs.nl` with your domain, you need to generate a secret for each secret in the `homeserver.yaml` file. You can generate a secret with `openssl rand -base64 32`. Replace the secret with the generated secret. After replacing all `4rs.nl` with your domain, you need to generate a secret for each secret in the `homeserver.yaml` file. You can generate a secret with `openssl rand -base64 32`. Replace the secret with the generated secret.
### Signing key ### Signing key
> **Note** > [!NOTE]
>
> You need `signedjson` dependency to generate a signing key. You can install it with `pip3 install signedjson`. > You need `signedjson` dependency to generate a signing key. You can install it with `pip3 install signedjson`.
Change the content of the `4rs.nl.signing.key` file with a generated key. You can generate a key with `generate_signing_key` script in root of the repository. Run `python3 generate_signing_key` and replace the content of the `4rs.nl.signing.key` file with the generated key. Change the content of the `4rs.nl.signing.key` file with a generated key. You can generate a key with `generate_signing_key` script in root of the repository. Run `python3 generate_signing_key` and replace the content of the `4rs.nl.signing.key` file with the generated key.
@ -134,7 +126,8 @@ Now you need to create an admin user with `docker exec -it synapse register_new_
## Backup ## Backup
> **Note** > [!NOTE]
>
> You need [`just`](https://just.systems/) to backup the homeserver. You can install it with `cargo install just`. > You need [`just`](https://just.systems/) to backup the homeserver. You can install it with `cargo install just`.
You can backup the homeserver with `just backup <backup-name>`. And it's will stored as encrypted AES256 7z file. You can backup the homeserver with `just backup <backup-name>`. And it's will stored as encrypted AES256 7z file.