<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>debian Archives - URage</title>
	<atom:link href="https://urage.net/blog/tag/debian/feed/" rel="self" type="application/rss+xml" />
	<link>https://urage.net/blog/tag/debian/</link>
	<description>Hating Unity? So we do - Help rage with us!</description>
	<lastBuildDate>Sun, 14 Dec 2025 01:45:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://urage.net/wp-content/uploads/2024/05/cropped-unityrage-logo-e1722825408774-32x32.png</url>
	<title>debian Archives - URage</title>
	<link>https://urage.net/blog/tag/debian/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Setting up a Matrix Server using Ansible and Docker</title>
		<link>https://urage.net/blog/setting-up-a-matrix-server-using-ansible-and-docker/</link>
		
		<dc:creator><![CDATA[rainer]]></dc:creator>
		<pubDate>Sun, 25 Aug 2024 19:00:22 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ansible]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[synapse]]></category>
		<guid isPermaLink="false">https://urage.net/?p=1838</guid>

					<description><![CDATA[<p>Matrix is an open standard for decentralized communication, and Synapse is its reference implementation. If you want to set up your own [&#8230;]</p>
<p>The post <a href="https://urage.net/blog/setting-up-a-matrix-server-using-ansible-and-docker/">Setting up a Matrix Server using Ansible and Docker</a> appeared first on <a href="https://urage.net">URage</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Matrix is an open standard for decentralized communication, and Synapse is its reference implementation. If you want to set up your own Matrix server, using Docker and Ansible can make the process much smoother. This blog post will guide you through the setup process using the excellent <code>matrix-docker-ansible-deploy</code> repository by Slavi Pantaleev. Along the way, I&#8217;ll share some of my findings and the steps I took to overcome a few hurdles.</p>
<pre>Prerequisites</pre>
<pre><code>sudo lsof -i :80
</code></pre>
<p>Before diving into the setup, ensure your system meets the prerequisites outlined in the official documentation:</p>
<ol>
<li><strong>Clone the Repository</strong>:
<pre><code>git clone https://github.com/spantaleev/matrix-docker-ansible-deploy.git
cd matrix-docker-ansible-deploy
</code></pre>
</li>
<li><strong>Install Required Dependencies</strong>:
<ul>
<li>First, ensure you have the necessary tools installed:
<pre><code>sudo apt update
sudo apt install curl git ansible
</code></pre>
<p>Next, install Rust and <code>just</code>, a command runner that makes working with this setup easier:</p>
<pre><code>curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
git clone https://github.com/casey/just.git
cd just
cargo build --release
sudo mv target/release/just /usr/local/bin/
just --version  # Verify the installation
</code></pre>
</li>
</ul>
</li>
<li><strong>Firewall Configuration</strong>:<br />
Ensure your server is properly configured to allow necessary traffic:</p>
<pre><code># Allow HTTP and HTTPS
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Allow TURN ports
sudo ufw allow 3478/tcp
sudo ufw allow 3478/udp
sudo ufw allow 5349/tcp
sudo ufw allow 5349/udp

# Allow Matrix Federation API
sudo ufw allow 8448/tcp

# Allow UDP port range for TURN
sudo ufw allow 49152:49172/udp

# Enable UFW if it's not already enabled
sudo ufw enable

# Verify the rules
sudo ufw status verbose
</code></pre>
</li>
<li><strong>Check for Port Conflicts</strong>:<br />
Before proceeding, check if the necessary ports are already in use:</p>
<pre><code>sudo lsof -i :80
</code>if port is occupied, resolve the conflict before continuing.</pre>
<pre><code>just register-user
</code></pre>
<pre><code>git clone https://github.com/spantaleev/matrix-docker-ansible-deploy.git
cd matrix-docker-ansible-deploy</code></pre>
</li>
</ol>
<hr />
<p><strong>Setting Up the Matrix Server</strong></p>
<pre><code>
</code></pre>
<p>With the prerequisites in place, you can proceed with the server setup.</p>
<ol>
<li><strong>Install Ansible Galaxy Dependencies</strong>:<br />
From within the <code>matrix-docker-ansible-deploy</code> directory:</p>
<pre><code>ansible-galaxy install -r requirements.yml
</code></pre>
</li>
<li><strong>Run the Setup Playbook</strong>:<br />
Use <code>just</code> to install all necessary roles and start the server:</p>
<pre><code>just roles
ansible-playbook -i inventory/hosts setup.yml --tags=install-all,ensure-matrix-users-created,start --ask-become-pass
</code></pre>
</li>
<li><strong>Dealing with Service Failures</strong>:<br />
During my setup, I encountered an issue with the <code>matrix-traefik</code> service failing to start due to a port conflict:</p>
<pre><code>systemd[1]: matrix-traefik.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: matrix-traefik.service: Failed with result 'exit-code'.
systemd[1]: matrix-traefik.service: Scheduled restart job, restart counter is at 289.
</code></pre>
<p>The solution was to identify which service was occupying port</p>
<pre><code>just register-user   
</code></pre>
<pre><code>git clone https://github.com/spantaleev/matrix-docker-ansible-deploy.git
cd matrix-docker-ansible-deploy
</code></pre>
<p>and either stop it or configure <code>traefik</code> to use a different port.</li>
<li><strong>Configuring Matrix Synapse</strong>:
<ul>
<li>If you need to register users, you can use the <code>just</code> command:
<pre><code>just register-user   
</code></pre>
</li>
<li>To configure Synapse further, such as disabling the ability to join remote rooms:
<pre><code>sudo su - matrix
nano /matrix/synapse/config/homeserver.yaml
</code></pre>
<p>Add or modify the following configuration:</p>
<pre><code>sudo apt update
sudo apt install curl git ansible
</code></pre>
<pre><code>git clone https://github.com/spantaleev/matrix-docker-ansible-deploy.git
cd matrix-docker-ansible-deploy
</code></pre>
</li>
<li>After making changes, restart the Synapse service:
<pre><code>sudo apt update
sudo apt install curl git ansible
</code></pre>
<pre><code></code></pre>
</li>
</ul>
</li>
</ol>
<hr />
<pre>https://github.com/etkecc/synapse-admin/?tab=readme-ov-file
</pre>
<p><strong>Final Thoughts and Support</strong></p>
<p>Setting up a Matrix server using Docker and Ansible with <code>matrix-docker-ansible-deploy</code> is a powerful and flexible approach, especially if you plan to manage multiple services or scale your deployment. However, it’s important to be prepared for some potential troubleshooting along the way, especially when it comes to port conflicts and service configurations.</p>
<p>The Matrix community and the maintainers of this playbook offer fantastic support:</p>
<ul>
<li><strong>Matrix Room</strong>: <a href="https://matrix.to/#/#matrix-docker-ansible-deploy:devture.com">#matrix-docker-ansible-deploy:devture.com</a></li>
<li><strong>IRC Channel</strong>: <code>#matrix-docker-ansible-deploy</code> on the Libera Chat IRC network (<a href="irc://irc.libera.chat:&lt;br /&gt;&lt;pre wp-pre-tag-6&gt;&lt;/pre&gt; &lt;p&gt;,&lt;/p&gt; &lt;pre&gt;&lt;code&gt;just roles ansible-playbook -i inventory/hosts setup.yml --tags=install-all,ensure-matrix-users-created,start --ask-become-pass &lt;/code&gt;&lt;/pre&gt; &lt;pre wp-pre-tag-6&gt;&lt;/pre&gt; &lt;p&gt;,&lt;/p&gt; &lt;pre&gt;&lt;code&gt;just roles ansible-playbook -i inventory/hosts setup.yml --tags=install-all,ensure-matrix-users-created,start --ask-become-pass &lt;/code&gt;&lt;/pre&gt; &lt;pre wp-pre-tag-9&gt;&lt;/pre&gt; &lt;p&gt;,&lt;/p&gt; &lt;pre&gt;&lt;code&gt;sudo su - matrix nano /matrix/synapse/config/homeserver.yaml &lt;/code&gt;&lt;/pre&gt; &lt;pre wp-pre-tag-7&gt;&lt;/pre&gt; &lt;p&gt;,&lt;/p&gt; &lt;pre&gt;&lt;code&gt;systemd[1]: matrix-traefik.service: Main process exited, code=exited, status=1/FAILURE systemd[1]: matrix-traefik.service: Failed with result 'exit-code'. systemd[1]: matrix-traefik.service: Scheduled restart job, restart counter is at 289. &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;">irc.libera.chat:</a>
<pre></pre>
<pre><code>just roles
ansible-playbook -i inventory/hosts setup.yml --tags=install-all,ensure-matrix-users-created,start --ask-become-pass
</code></pre>
<pre><code>sudo su - matrix
nano /matrix/synapse/config/homeserver.yaml
</code></pre>
<pre><code>systemd[1]: matrix-traefik.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: matrix-traefik.service: Failed with result 'exit-code'.
systemd[1]: matrix-traefik.service: Scheduled restart job, restart counter is at 289.
</code></pre>
</li>
<li><strong>GitHub Issues</strong>: <a href="https://github.com/spantaleev/matrix-docker-ansible-deploy/issues">spantaleev/matrix-docker-ansible-deploy/issues</a></li>
</ul>
<p>The post <a href="https://urage.net/blog/setting-up-a-matrix-server-using-ansible-and-docker/">Setting up a Matrix Server using Ansible and Docker</a> appeared first on <a href="https://urage.net">URage</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
