matrix-docker-ansible-deploy/docs/installing.md

112 lines
7.1 KiB
Markdown
Raw Normal View History

# Installing
<sup>⚡️[Quick start](README.md) | [Prerequisites](prerequisites.md) > [Configuring your DNS settings](configuring-dns.md) > [Getting the playbook](getting-the-playbook.md) > [Configuring the playbook](configuring-playbook.md) > Installing</sup>
If you've configured your DNS records and the playbook, you can start the installation procedure.
## Update Ansible roles
Before installing, you need to update the Ansible roles in this playbook by running `just roles`.
`just roles` is a shortcut (a `roles` target defined in [`justfile`](../justfile) and executed by the [`just`](https://github.com/casey/just) utility) which ultimately runs [agru](https://github.com/etkecc/agru) or [ansible-galaxy](https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html) (depending on what is available in your system) to download Ansible roles. If you don't have `just`, you can also manually run the `roles` commands seen in the `justfile`.
There's another shortcut (`just update`) which updates the playbook (`git pull`) and updates roles (`just roles`) at the same time.
## Install Matrix server and services
The Ansible playbook's tasks are tagged, so that certain parts of the Ansible playbook can be run without running all other tasks.
The general command syntax for installation (and also maintenance) is: `ansible-playbook -i inventory/hosts setup.yml --tags=COMMA_SEPARATED_TAGS_GO_HERE`. It is recommended to get yourself familiar with the [playbook tags](playbook-tags.md) before proceeding.
If you **don't** use SSH keys for authentication, but rather a regular password, you may need to add `--ask-pass` to the all Ansible commands.
If you **do** use SSH keys for authentication, **and** use a non-root user to *become* root (sudo), you may need to add `-K` (`--ask-become-pass`) to all Ansible commands.
There 2 ways to start the installation process - depending on whether you're [Installing a brand new server (without importing data)](#installing-a-brand-new-server-without-importing-data) or [Installing a server into which you'll import old data](#installing-a-server-into-which-youll-import-old-data).
**Note**: if you are migrating from an old server to a new one, take a look at [this guide](maintenance-migrating.md) instead. This is an easier and more straightforward way than installing a server and importing old data into it.
### Installing a brand new server (without importing data)
If this is **a brand new** Matrix server and you **won't be importing old data into it**, run all these tags:
```sh
2022-11-25 15:15:19 +01:00
ansible-playbook -i inventory/hosts setup.yml --tags=install-all,ensure-matrix-users-created,start
```
This will do a full installation and start all Matrix services.
**Note**: if the command does not work as expected, make sure that you have properly installed and configured software required to run the playbook, as described on [Prerequisites](prerequisites.md).
### Installing a server into which you'll import old data
If you will be importing data into your newly created Matrix server, install it, but **do not** start its services just yet. Starting its services or messing with its database now will affect your data import later on.
To do the installation **without** starting services, run `ansible-playbook` with the `install-all` tag only:
```sh
2022-11-25 15:15:19 +01:00
ansible-playbook -i inventory/hosts setup.yml --tags=install-all
```
**Note**: do not run the just "recipe" `just install-all` instead, because it automatically starts services at the end of execution.
When this command completes, services won't be running yet.
You can now:
- [Importing an existing SQLite database (from another Synapse installation)](importing-synapse-sqlite.md) (optional)
- [Importing an existing Postgres database (from another installation)](importing-postgres.md) (optional)
- [Importing `media_store` data files from an existing Synapse installation](importing-synapse-media-store.md) (optional)
.. and then proceed to starting all services:
```sh
ansible-playbook -i inventory/hosts setup.yml --tags=ensure-matrix-users-created,start
```
## Finalize the installation
Update docs/configuring-well-known.md and docs/installing.md (#3767) * Update docs/configuring-well-known.md: remove redundant information For example, anchor links to the headers are distractive as these headers are displayed by scrolling a bit. Also: edit section headers Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: add "Support service discovery" as a type of well-known service discovery Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: recategorize the sections about installing well-known files on the base domain's server The commit merges the content of the option 2 with the section above, as both explain how to serve the base domain via the playbook and claim it is the easy way of installing well-known files, and therefore the content is repetitive. Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: create a section for types of well-known service discovery mechanism Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: add a link to the Matrix Specification, to which MSC 1929 was implemented MSC 1929 has no longer been for an early adopter. Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: iterate Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-playbook-base-domain-serving.md Co-authored-by: Slavi Pantaleev <slavi@devture.com> * Update docs/configuring-well-known.md Co-authored-by: Slavi Pantaleev <slavi@devture.com> * Update docs/installing.md: iterate Summary: - Try to reflect review comments - Declare that the shorter user identifier is recommended - Add a note about installing the server matrix.example.com directly, with the link to the FAQ entry Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/installing.md: replace the anchor link to docs/configuring-well-known.md with one to docs/howto-server-delegation.md Service Discovery via .well-known files is one of the two ways for server delegation, and it is possible to set up server delegation via a DNS SRV record instead (though it is more advanced and complicated), so it should be more proper to use the words "delegation/redirection" than "service discovery". Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: fix a typo Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> --------- Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> Co-authored-by: Suguru Hirahara <acioustick@noreply.codeberg.org> Co-authored-by: Slavi Pantaleev <slavi@devture.com>
2024-11-15 07:34:21 +01:00
Now that services are running, you need to **finalize the installation process** by [delegating (redirecting) the server](howto-server-delegation.md) to your base domain (`example.com`).
Update docs/configuring-well-known.md and docs/installing.md (#3767) * Update docs/configuring-well-known.md: remove redundant information For example, anchor links to the headers are distractive as these headers are displayed by scrolling a bit. Also: edit section headers Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: add "Support service discovery" as a type of well-known service discovery Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: recategorize the sections about installing well-known files on the base domain's server The commit merges the content of the option 2 with the section above, as both explain how to serve the base domain via the playbook and claim it is the easy way of installing well-known files, and therefore the content is repetitive. Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: create a section for types of well-known service discovery mechanism Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: add a link to the Matrix Specification, to which MSC 1929 was implemented MSC 1929 has no longer been for an early adopter. Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: iterate Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-playbook-base-domain-serving.md Co-authored-by: Slavi Pantaleev <slavi@devture.com> * Update docs/configuring-well-known.md Co-authored-by: Slavi Pantaleev <slavi@devture.com> * Update docs/installing.md: iterate Summary: - Try to reflect review comments - Declare that the shorter user identifier is recommended - Add a note about installing the server matrix.example.com directly, with the link to the FAQ entry Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/installing.md: replace the anchor link to docs/configuring-well-known.md with one to docs/howto-server-delegation.md Service Discovery via .well-known files is one of the two ways for server delegation, and it is possible to set up server delegation via a DNS SRV record instead (though it is more advanced and complicated), so it should be more proper to use the words "delegation/redirection" than "service discovery". Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: fix a typo Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> --------- Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> Co-authored-by: Suguru Hirahara <acioustick@noreply.codeberg.org> Co-authored-by: Slavi Pantaleev <slavi@devture.com>
2024-11-15 07:34:21 +01:00
This is required for federation to work! Without a proper configuration, your server will effectively not be part of the Matrix network.
If you need the base domain for anything else such as hosting a website, you have to configure it manually, following the procedure described on the linked documentation.
However, if you do not need the base domain for anything else, the easiest way of configuring it is to [serve the base domain](configuring-playbook-base-domain-serving.md) from the integrated web server. It will enable you to use a Matrix user identifier like `@<username>:example.com` while hosting services on a subdomain like `matrix.example.com`.
Update docs/configuring-well-known.md and docs/installing.md (#3767) * Update docs/configuring-well-known.md: remove redundant information For example, anchor links to the headers are distractive as these headers are displayed by scrolling a bit. Also: edit section headers Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: add "Support service discovery" as a type of well-known service discovery Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: recategorize the sections about installing well-known files on the base domain's server The commit merges the content of the option 2 with the section above, as both explain how to serve the base domain via the playbook and claim it is the easy way of installing well-known files, and therefore the content is repetitive. Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: create a section for types of well-known service discovery mechanism Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: add a link to the Matrix Specification, to which MSC 1929 was implemented MSC 1929 has no longer been for an early adopter. Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: iterate Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-playbook-base-domain-serving.md Co-authored-by: Slavi Pantaleev <slavi@devture.com> * Update docs/configuring-well-known.md Co-authored-by: Slavi Pantaleev <slavi@devture.com> * Update docs/installing.md: iterate Summary: - Try to reflect review comments - Declare that the shorter user identifier is recommended - Add a note about installing the server matrix.example.com directly, with the link to the FAQ entry Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/installing.md: replace the anchor link to docs/configuring-well-known.md with one to docs/howto-server-delegation.md Service Discovery via .well-known files is one of the two ways for server delegation, and it is possible to set up server delegation via a DNS SRV record instead (though it is more advanced and complicated), so it should be more proper to use the words "delegation/redirection" than "service discovery". Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Update docs/configuring-well-known.md: fix a typo Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> --------- Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> Co-authored-by: Suguru Hirahara <acioustick@noreply.codeberg.org> Co-authored-by: Slavi Pantaleev <slavi@devture.com>
2024-11-15 07:34:21 +01:00
To configure server delegation in this way, add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file:
```yaml
matrix_static_files_container_labels_base_domain_enabled: true
```
After configuring the playbook, run the installation command:
```sh
ansible-playbook -i inventory/hosts setup.yml --tags=install-all,start
```
## Things to do next
After finilizing the installation, you can:
- [check if services work](maintenance-checking-services.md)
- or [create your first Matrix user account](registering-users.md)
- or [set up additional services](configuring-playbook.md#other-configuration-options) (bridges to other chat networks, bots, etc.)
- or learn how to [upgrade services when new versions are released](maintenance-upgrading-services.md)
- or learn how to [maintain your server](faq.md#maintenance)
- or join some Matrix rooms:
Add "Web" to Element and SchildiChat web application (#3755) * Replace "Element" with "Element Web" - If Element indicates the web application, then it is changed to Element Web. - If it indicates clients branded with Element such as Element desktop, web, mobile clients, then it is changed to Element clients. - If it is combined with location sharing functionality, it is not changed. with other some changes, including: - Change "app.element.io" anchor link to "https://github.com/element-hq/element-web" on README.md, following other documentation files Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Replace "SchildiChat" with "SchildiChat Web" - If SchildiChat indicates the web application, then it is changed to SchildiChat Web. - If it indicates clients branded with SchildiChat such as SchildiChat desktop, web, mobile clients, then it is changed to SchildiChat clients. - If it is combined with location sharing functionality, it is not changed. Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Rename configuring-playbook-client-schildichat.md to configuring-playbook-client-schildichat-web.md Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> * Rename configuring-playbook-client-element.md to configuring-playbook-client-element-web.md Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> --------- Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org> Co-authored-by: Suguru Hirahara <acioustick@noreply.codeberg.org>
2024-11-07 15:31:26 +01:00
* via the *Explore rooms* feature in Element Web or some other clients, or by discovering them using this [matrix-static list](https://view.matrix.org). **Note**: joining large rooms may overload small servers.
* or come say Hi in our support room - [#matrix-docker-ansible-deploy:devture.com](https://matrix.to/#/#matrix-docker-ansible-deploy:devture.com). You might learn something or get to help someone else new to Matrix hosting.
- or help make this playbook better by contributing (code, documentation, or [coffee/beer](https://liberapay.com/s.pantaleev/donate))
### Maintaining your setup in the future
Feel free to **re-run the setup command any time** you think something is off with the server configuration. Ansible will take your configuration and update your server to match. To update the playbook and the Ansible roles in the playbook, simply run `just roles`.
Note that if you remove components from `vars.yml`, or if we switch some component from being installed by default to not being installed by default anymore, you'd need to run the setup command with `--tags=setup-all` instead of `--tags=install-all`. See [this page on the playbook tags](playbook-tags.md) for more information.
A way to invoke these `ansible-playbook` commands with less typing in the future is to use [just](https://github.com/casey/just) to run the "recipe": `just install-all` or `just setup-all`. See [our `justfile`](../justfile) for more information.