User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
matrix:conduwuit [2025/03/11 08:16] willymatrix:conduwuit [2025/03/11 08:45] (current) – [Reverse proxy] willy
Line 1: Line 1:
 ====== Conduwuit ====== ====== Conduwuit ======
  
-[[https://conduwuit.puppyirl.gay/|Conduwuit]] is a Matrix server written in RUST. [[https://matrix.org|Matrix]] is an open network for securedecentralised communication. It is a specification which is in turn implemented by many servers and clients, and you can self-host your server as well. This is a new, well supported, lightweight implementation of a Matrix server. +[[https://conduwuit.puppyirl.gay/|Conduwuit]] is a Matrix server written in RUST,  it is a new, well supported, lightweight implementation of a Matrix server. I also tried Synapse, the classic Matrix server, but ended up with Conduwuit that proved itself more lightweight and much easier to implement and maintain.
  
-I will show you also how to install Element Web app which is a nice companion for web access everywhere. +===== Installation =====
- +
-===== Installation of Conduwuit server =====+
  
 Installation instructions: [[https://conduwuit.puppyirl.gay/deploying/generic.html|here]]. While there is a docker approach, it is so simple to install on bare-metal that i preferred this approach to the container one. Actuall accessing the conduwuit command-line admin console is a pain with container, while it's so easy from the prebuilt-binary. Installation instructions: [[https://conduwuit.puppyirl.gay/deploying/generic.html|here]]. While there is a docker approach, it is so simple to install on bare-metal that i preferred this approach to the container one. Actuall accessing the conduwuit command-line admin console is a pain with container, while it's so easy from the prebuilt-binary.
Line 22: Line 20:
 cd bin cd bin
 wget https://github.com/girlbossceo/conduwuit/releases/download/<< version >>/static-x86_64-unknown-linux-musl wget https://github.com/girlbossceo/conduwuit/releases/download/<< version >>/static-x86_64-unknown-linux-musl
-</code> 
- 
-===== Installation of Element Web app ===== 
- 
-Element Web app is a great web based UI for Matrix, that you can pair to your instance. 
- 
-Again installing bare-metal is the way to go. See [[https://github.com/element-hq/element-web|here]]. 
- 
-Download latest release tarball from [[https://github.com/element-hq/element-web/releases|here]] and decompress it: 
-<code bash> 
-su - conduwuit 
-wget https://github.com/element-hq/element-web/releases/<< version >> /element-<< version >>.tar.gz 
-tar xvf element-<< version >>.tar.gz 
-ln -s element-<< version >> element-web 
 </code> </code>
  
Line 64: Line 48:
 You are now ready for testing your installation. You are now ready for testing your installation.
  
-===== Configuration of Element Web App ===== 
- 
-Rename the file called **config.sample.json** to **config.json** inside the //element-<< version >>// folder and edit accordingly, and to be sure to backup it properly, i suggest to move it to **/data/conduwuit**: 
-<code bash> 
-cd /data/daemons/conduwuit/element-web 
-cp config.sample.json /data/conduwuit/element-config.json 
-ln -s /data/conduwuit/element-config.json config.json 
-</code> 
- 
-At the very least perform the following edits: 
-<code> 
-    "default_server_config": { 
-        "m.homeserver": { 
-            "base_url": "https://chat.gardiol.org", 
-            "server_name": "chat.gardiol.org" 
-        }, 
-    "disable_custom_urls": true, 
-    "disable_guests": true, 
-</code> 
- 
-at the beginning of the file. I suggest to disable both custom URLs and guests, to avoid your web instance to be used too openly. Please note that this **does not mean** that your instance will be used: Element X is a javascript app that works in the browser of the use anyway. 
  
  
 ===== Manual startup ===== ===== Manual startup =====
  
-to run Conduwuit server, run the following command as **conduwuit** user:+To run Conduwuit server, run the following command as **conduwuit** user:
 <code bash> <code bash>
 /data/daemons/bin/static-x86_64-unknown-linux-musl -c /data/conduwuit/conduwuit.toml /data/daemons/bin/static-x86_64-unknown-linux-musl -c /data/conduwuit/conduwuit.toml
Line 119: Line 82:
 server { server {
         server_name chat.mydomain.com;         server_name chat.mydomain.com;
-        listen 8443 ssl; # external access +        # Port 8443 goes to external connection (internet) 
-        listen 443 ssl;  # internal access+        listen 8443 ssl;  
 +        Port 443 is used for internal connections (home) 
 +        listen 443 ssl;  
 +        http2 on;
  
         access_log /var/log/nginx/chat.mydomain.com_access_log main;         access_log /var/log/nginx/chat.mydomain.com_access_log main;
         error_log /var/log/nginx/chat.mydomain.com_error_log info;         error_log /var/log/nginx/chat.mydomain.com_error_log info;
  
-        location / {+        location / { # this is to provide a web client, see the ElementWeb page...
                 root /data/daemons/conduwuit/element-web;                 root /data/daemons/conduwuit/element-web;
         }         }
  
-        location ~ ^(/_matrix|/_synapse/client) { +        location ~ ^(/_matrix|/client) { 
-                add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS, PATCH, HEAD'; +                # The $request_uri is MANDATORY to avoid URI being modifyed by NGINX 
-                proxy_pass http://127.0.0.1:6167; +                proxy_pass                      http://127.0.0.1:6167$request_uri; 
-                #proxy_pass http://127.0.0.1:6167$request_uri; +                proxy_set_header                X-Forwarded-For $remote_addr; 
-                proxy_set_header X-Forwarded-For $remote_addr; +                proxy_set_header                X-Forwarded-Proto $scheme; 
-                proxy_set_header X-Forwarded-Proto $scheme; +                proxy_set_header                Host $host; 
-                proxy_set_header Host $host; +                add_header                      'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS, PATCH, HEAD'
-                proxy_buffering off; +                proxy_read_timeout      10m; 
-                client_max_body_size 30M+                proxy_http_version      1.1;
-                proxy_read_timeout 10m; +
-                proxy_http_version 1.1;+
         }         }
 +        # This is needed for federation
         location /.well-known/matrix/server {         location /.well-known/matrix/server {
-                return 200 '{"m.server": "chat.mydomain.com:443"}'+                default_type                    application/json; 
-                types { } default_type "application/json; charset=utf-8";+                add_header                      Access-Control-Allow-Origin *; 
 +                return                          200 '{"m.server": "chat.mydomain.com:443"}';
         }         }
 +        # Enable snail sync for Element X and client access info in general
         location /.well-known/matrix/client {         location /.well-known/matrix/client {
-                return 200 '{"m.homeserver": {"base_url": "https://chat.mydomain.com"},"org.matrix.msc3575.proxy": {"url": "https://chat.mydomain.com"}}'+                default_type                    application/json; 
-                types { } default_type "application/json; charset=utf-8"; +                add_header                      Access-Control-Allow-Origin *; 
-                add_header "Access-Control-Allow-Origin" *;+                return                          200 '{"m.homeserver": {"base_url": "https://chat.mydomain.com"},"org.mydomain.msc3575.proxy": {"url": "https://chat.mydomain.com"}}';
         }         }
 +        include com.mydomain/certbot.conf;
 } }
 </file> </file>
  
 +In the above file i have already introduced the location (/) of the ElementWeb client, the installation is described [[matrix:element-web|here]].
  
  
Line 180: Line 146:
  
 You can run any admin command later on directly in your favorite Matrix client in the admin chat. You might need the terminal only if you accidentally lock your user out of the instance. You can run any admin command later on directly in your favorite Matrix client in the admin chat. You might need the terminal only if you accidentally lock your user out of the instance.
 +
  
 ===== Autostart ===== ===== Autostart =====
Line 209: Line 176:
 rc-update add conduwuit default rc-update add conduwuit default
 </code> </code>
- 
-If you use the telegram bridge described below, also add the following: 
-<file - /etc/init.d/conduwuit-telegram> 
-#!/sbin/openrc-run 
-# Copyright 2025 Gentoo Authors 
-# Distributed under the terms of the GNU General Public License v2 
- 
-name="conduwuit telegram bridge" 
-description="Conduwuit Telegram Matrix Bridge" 
-pidfile="/run/conduwuit-telegram.pid" 
-command_background=true 
-command="/data/daemons/conduwuit/mautrix-telegram/bin/python" 
-command_args="/data/conduwuit/mautrix-telegram-config.yaml -m mautrix_telegram" 
-command_user="conduwuit:conduwuit" 
-output_log="/var/log/conduwuit/conduwuit-telegram.log" 
-output_err="/var/log/conduwuit/conduwuit-telegram.log" 
- 
-start_pre() { 
-        cd /data/daemons/conduwuit/mautrix-telegram 
-} 
- 
-depend() { 
-        need net 
-} 
-</file> 
- 
-Make it executable and add to the proper runlevel: 
-<code bash> 
-chmod +x /etc/init.d/conduwuit-telegram 
-rc-update add conduwuit-telegram default 
-</code> 
- 
-If you use the Whatsapp bridge described below, also add the following: 
-<file - /etc/init.d/conduwuit-whatsapp> 
-#!/sbin/openrc-run 
-# Copyright 2025 Gentoo Authors 
-# Distributed under the terms of the GNU General Public License v2 
- 
-name="conduwuit whatsapp bridge" 
-description="Conduwuit whatsapp Matrix Bridge" 
-pidfile="/run/conduwuit-whatsapp.pid" 
-command_background=true 
-command="/data/daemons/conduwuit/mautrix-whatsapp/mautrix-whatsapp" 
-command_args="/data/conduwuit/mautrix-whatsapp-config.yaml" 
-command_user="conduwuit:conduwuit" 
-output_log="/var/log/conduwuit/conduwuit-whatsapp.log" 
-output_err="/var/log/conduwuit/conduwuit-whatsapp.log" 
- 
-start_pre() { 
-        cd /data/daemons/conduwuit/mautrix-whatsapp 
-} 
- 
-depend() { 
-        need net 
-} 
-</file> 
- 
-Make it executable and add to the proper runlevel: 
-<code bash> 
-chmod +x /etc/init.d/conduwuit-whatsapp 
-rc-update add conduwuit-whatsapp default 
-</code> 
- 
-===== Installing the Telegram Bridge ===== 
- 
-The Mautrix Telegram bridge is currently the best (only?) option. More info  
-[[https://docs.mau.fi/bridges/python/setup.html?bridge=telegram|here]]. 
- 
-Create subfolder and Python venv inside (see [[gentoo:pip|PIP]]): 
-<code bash> 
-su - conduwuit 
-mkdir mautrix-telegram 
-cd mautrix-telegram 
-# Enable PIP like in the link above 
-# - create ~/.config/pip/pip.conf 
-# - add ~/.local/bin to the .bashrc 
-python -m venv . # Note the dot at the end! 
-source ./bin/activate 
-# Now flip include-system-site-packages = true in pyvenv.cfg 
-# Install: 
-pip install --upgrade mautrix-telegram[all] 
-</code> 
- 
-You need to create API keys to connect to Telegram. Go to [[https://my.telegram.org/auth?to=apps|this page]] and  
-Grab the example config file [[https://raw.githubusercontent.com/mautrix/telegram/refs/heads/master/mautrix_telegram/example-config.yaml|here]], save it as **config.yaml** in the /data/conduwuit/ folder and create a link to the //mautrix-telegram// folder and customize it to your needs: 
-<code bash> 
-wget -O /data/conduwuit/mautrix-telegram-config.yaml 
-mv /data/daemons/conduwuit/mautrix-telegram/config.yaml /data/conduwuit/mautrix-telegram-config.yaml 
-</code> 
- 
-This file is huge, here are the most relevant changes needed: 
-<file - config.yaml> 
-    address: https://chat.mydomain.com 
-    domain: chat.mydomain.com 
-    verify_ssl: true 
-    database: sqlite:/data/conduwuit/mautrix-telegram.db # place the database into the /data/conduwuit folder 
-telegram: 
-    # Get your own API keys at https://my.telegram.org/apps 
-    api_id: << put your id here >> 
-    api_hash: << put your hash >> 
-    # (Optional) Create your own bot at https://t.me/BotFather 
-    bot_token: disabled 
-permissions: 
-  "*": "relaybot"                      # non-local users can only see messages 
-  "chat.mydomain.com": "full"          # full access to all local users 
-  "@myself:chat.mydomain.com": "admin" # who can admin the bot 
-   
-encryption: 
-    # Whether to enable encryption at all. If false, the bridge will not function in encrypted rooms. 
-    allow: true 
- 
-+ double puppeting 
-</file> 
-More details on configuration can be found [[https://docs.mau.fi/bridges/general/initial-config.html|here]]. 
- 
-I choose to use SQLite as database because i only have a few users and don't want to spin a PostreSQL instance for that. 
- 
-At this point you need to register the bridge: 
-<code bash> 
-python -m mautrix_telegram -g -c /data/conduwuit/mautrix-telegram-config.yaml 
-</code> 
- 
-This step will create a **registration.yaml** file that you need to perform the registration of the bridge as an appservice in Conduwuit. Conduwuit is different from Synapse (the most common Matrix server) because the appservice must be registered from the admin chat with the following command: 
-<code> 
-!admin appservices register << shift+enter >> 
-```  << shift+enter >> 
-[ ... copy here the content of registration.yaml ... ] 
-``` << enter >> 
-</code> 
- 
-When you see **<< shift enter >>** you need to press those two keys in order to create a new line in the same command. The three **```** (backthicks) are the markdown token to create a code block. 
-The **<< autogenrated >>** are secret strings found in the //registration.yaml// file. 
- 
-The chat should reply with a message like: 
-<code> 
-Appservice registered with ID: telegram 
-</code> 
- 
-More details on registering the appservice can be found [[https://docs.mau.fi/bridges/general/registering-appservices.html|here]]. 
- 
-You need to create the **telegrambot** user, again from the admin chat: 
-<code> 
-!admin users create-user telegrambot 
-</code> 
- 
-Good! Now you can run the bridge: 
-<code bash> 
-python -m mautrix_telegram -c /data/conduwuit/mautrix-telegram-config.yaml 
-</code> 
- 
-If all is well, your bridge should be up and running now. 
- 
-To login into telegram you need to: 
-  * Start a chat with telegrambot:chat.mydomain.com 
-  * type "login" 
-  * when prompted, type your telegram registered phone number with country code 
-  * when prompted, type the code you received in telegram to authorize the login 
-  * when prompted, type your 2FA password (if enabled in telegram) 
- 
-You will start seeing your telegram chats appear in Matrix now! It takes time, even hours, and also most chats will only appear the first time the other person messages you. 
- 
-**Note:** Telegram does not allow registration from third party clients, so to register a **new** telegram account, you must use Telegram official app. 
- 
-General documentation on the Telegram bot can be found [[https://docs.mau.fi/bridges/python/telegram/index.html|here]]. 
- 
-To manage animated sticker [[https://github.com/sot-tech/LottieConverter|here]] 
- 
- 
-===== Installing the Whatsapp Bridge ===== 
- 
- 
-<code bash> 
-su - conduwuit 
-mkdir mautrix-whatsapp 
-cd mautrix-whatsapp 
-wget -O mautrix-whatsapp.zip 'https://mau.dev/mautrix/whatsapp/-/jobs/artifacts/main/download?job=build%20amd64'  
-unzip mautrix-whatsapp.zip 
-</code> 
- 
-Generate config and edit: 
-<code bash> 
-./mautrix-whatsapp -e 
-mv config.yaml /data/conduwuit/mautrix-whatsapp-config.yaml 
-</code> 
- 
-edit it... 
-<code> 
-network: 
-    displayname_template: "{{or .FullName .BusinessName .PushName .Phone}} (WA)" # This is very important to have usernames instead of phone numbers! 
-     
-database: 
-    type: sqlite3-fk-wal 
-    uri: file:/data/conduwuit/mautrix-whatsapp.db?_txlock=immediate 
-  
-homeserver: 
-    address: https://chat.mydomain.com 
-    domain: chat.mydomain.com 
-     
-permissions: # this is probably not needed, but anyway... 
-  "*": "relaybot"                      # non-local users can only see messages 
-  "chat.mydomain.com": "full"          # full access to all local users 
-  "@myself:chat.mydomain.com": "admin" # who can admin the bot 
- 
-backfill: 
-    enabled: true  # to populate chats with older messages 
-     
-    encryption: 
-    # Whether to enable encryption at all. If false, the bridge will not function in encrypted rooms. 
-    allow: true 
- 
-+ double puppeting 
- 
-</code> 
- 
-Note that backfill is disabled by default, you need to enable it to see older messages. Also note that messages **cannot** be backfilled for already created rooms, so don't forget to enable backfill before the first start! 
- 
-Generate the appservice files: 
-<code bash> 
-./mautrix-whatsapp -c  /data/conduwuit/mautrix-whatsapp-config.yaml -g 
-</code> 
- 
-This step will create a **registration.yaml** file that you need to perform the registration of the bridge as an appservice in Conduwuit. Conduwuit is different from Synapse (the most common Matrix server) because the appservice must be registered from the admin chat with the following command: 
-<code> 
-!admin appservices register << shift+enter >> 
-```  << shift+enter >> 
-id: whatsapp 
-[ ... copy the content of the appservice.yaml .. ] 
-``` << enter >> 
-</code> 
- 
-When you see **<< shift enter >>** you need to press those two keys in order to create a new line in the same command. The three **```** (backthicks) are the markdown token to create a code block. 
- 
-The chat should reply with a message like: 
-<code> 
-Appservice registered with ID: whatsapp 
-</code> 
- 
-More details on registering the appservice can be found [[https://docs.mau.fi/bridges/general/registering-appservices.html|here]]. 
- 
-The **whatsappbot** user should have been created automatically. 
- 
-Good! Now you can run the bridge: 
-<code bash> 
-/data/daemon/mautrix-whatsapp/mautrix-whatsapp -c /data/conduwuit/mautrix-whatsapp-config.yaml 
-</code> 
- 
-If all is well, your bridge should be up and running now. 
- 
-To login into whatsapp you need to: 
-  * Start a chat with whatsappbot:chat.mydomain.com 
-  * type "login qr" 
-  * Scan the QR code with your whatsapp on your phone. 
- 
-You could install whatsapp on a Android Virtual Emulator, but it's discouraged and could lead to a ban of your account. 
- 
-**Note:** if your usernames do not get popupated, you should do a //search username// in the whatsappbot chat. 
  

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information