matrix是一个非常强大的开源即时通信项目。本文主要分享如何在VPS服务器上部署matrix的后端(synapse)及前端(element)服务。在matrix的官方文档中,找到了一篇如何在oracle arm服务器上部署的教程,正好手里有一台oracle机器,于是从这篇教程出发开始研究。
https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/README.md
https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/configuring-dns.md
A matrix ${ip} CNAME element matrix.${domain}
部署matrix用的是matrix-docker-ansible-deploy这个项目,需要把代码拉取下来:
git clone https://github.com/spantaleev/matrix-docker-ansible-deploy.git
mkdir inventory/host_vars/matrix.${domain} cp examples/vars.yml inventory/host_vars/matrix.$domain/vars.yml cp examples/hosts inventory/hosts $EDITOR inventory/hosts # put most settings here in vars.yml, read following sections for some ideas $EDITOR inventory/host_vars/matrix.$domain/vars.yml
inventory/hosts
[matrix_servers] matrix.renxx.tk ansible_host=$your_host ansible_ssh_user=root ansible_ssh_port=22
如果你的ansible是用docker方式执行,需要加上ansible_connection=community.docker.nsenter
[matrix_servers] matrix.renxx.tk ansible_host=$your_host ansible_ssh_user=root ansible_ssh_port=22 ansible_connection=community.docker.nsenter
inventory/host_vars/matrix.$your_domain/vars.yml
yaml---
# The bare domain name which represents your Matrix identity.
# Matrix user ids for your server will be of the form (`@user:<matrix-domain>`).
#
# Note: this playbook does not touch the server referenced here.
# Installation happens on another server ("matrix.<matrix-domain>").
#
# If you've deployed using the wrong domain, you'll have to run the Uninstalling step,
# because you can't change the Domain after deployment.
#
# Example value: example.com
matrix_domain: matrix.your_domain
# The Matrix homeserver software to install.
# See:
# - `roles/custom/matrix-base/defaults/main.yml` for valid options
# - the `docs/configuring-playbook-IMPLEMENTATION_NAME.md` documentation page, if one is available for your implementation choice
matrix_homeserver_implementation: synapse
# A secret used as a base, for generating various other secrets.
# You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`).
matrix_homeserver_generic_secret_key: ''
# This is something which is provided to Let's Encrypt when retrieving SSL certificates for domains.
#
# In case SSL renewal fails at some point, you'll also get an email notification there.
#
# If you decide to use another method for managing SSL certificates (different than the default Let's Encrypt),
# you won't be required to define this variable (see `docs/configuring-playbook-ssl-certificates.md`).
#
# Example value: someone@example.com
matrix_ssl_lets_encrypt_support_email: ''
# A Postgres password to use for the superuser Postgres user (called `matrix` by default).
#
# The playbook creates additional Postgres users and databases (one for each enabled service)
# using this superuser account.
devture_postgres_connection_password: ''
matrix_playbook_docker_installation_enabled: false
apt-get install python3-pip python3 -m pip install ansible
docker run -itd --name ansible --privileged --pid=host -w /work -v `pwd`:/work --entrypoint=/bin/sh docker.io/devture/ansible:2.13.6-r0-1 docker exec -ti ansible sh git config --global --add safe.directory /work
curl --proto '=https' --tlsv1.3 -sSf https://just.systems/install.sh | sh -s -- --to /usr/local/bin/
just roles # or rm -rf roles/galaxy ansible-galaxy install -r requirements.yml -p roles/galaxy/ --force ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start ansible-playbook -i inventory/hosts setup.yml --tags=self-check ansible-playbook -i inventory/hosts setup.yml -e username=$username -e password=$password -e admin=yes --tags=register-user
本文作者:renbear
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC 2.0 许可协议。转载请注明出处!