Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
services:conduwuit [2025/02/03 09:16] – willy | services:conduwuit [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Conduwuit ====== | ||
- | |||
- | |||
- | [[https:// | ||
- | |||
- | I will show you also how to install Element Web app which is a nice companion for web access everywhere. | ||
- | |||
- | ===== Installation of Conduwuit server ===== | ||
- | |||
- | Installation instructions: | ||
- | |||
- | Create user and required folders: | ||
- | <code bash> | ||
- | seradd -d / | ||
- | mkdir -p / | ||
- | chown conduwuit: | ||
- | </ | ||
- | |||
- | Download the correct executable from [[https:// | ||
- | <code bash> | ||
- | su - conduwuit | ||
- | mkdir bin | ||
- | cd bin | ||
- | wget https:// | ||
- | </ | ||
- | |||
- | ===== 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:// | ||
- | |||
- | Download latest release tarball from [[https:// | ||
- | <code bash> | ||
- | su - conduwuit | ||
- | wget https:// | ||
- | tar xvf element-<< | ||
- | ln -s element-<< | ||
- | </ | ||
- | |||
- | |||
- | ===== Configuration of Conduwuit server ===== | ||
- | |||
- | The official Conduwuit configuration documentation can be found [[https:// | ||
- | |||
- | Now, you cannot start Conduwuit withour a proper configuration file. I suggest you to put it under **/ | ||
- | <file / | ||
- | [global] | ||
- | server_name = " | ||
- | address = [" | ||
- | port = 6167 | ||
- | database_path = "/ | ||
- | new_user_displayname_suffix = " | ||
- | allow_check_for_updates = false | ||
- | max_request_size = 20971520 # this should match NGINX max request size | ||
- | #log = " | ||
- | #log_colors = true | ||
- | # | ||
- | |||
- | [global.well_known] | ||
- | client = " | ||
- | server = " | ||
- | </ | ||
- | |||
- | 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 // | ||
- | <code bash> | ||
- | cd / | ||
- | cp config.sample.json / | ||
- | ln -s / | ||
- | </ | ||
- | |||
- | At the very least perform the following edits: | ||
- | < | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | </ | ||
- | |||
- | 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 ===== | ||
- | |||
- | to run Conduwuit server, run the following command as **conduwuit** user: | ||
- | <code bash> | ||
- | / | ||
- | </ | ||
- | |||
- | Of course, replace the proper paths and filenames with your setup. | ||
- | |||
- | Running manually is good because you can easily access the admin console by typing **CTRL+C** from the terminal. You might want to take this opportunity to create your first user, and make it an admin too. | ||
- | |||
- | ===== Testing ===== | ||
- | |||
- | Call directly this endpoint: | ||
- | <code bash> | ||
- | curl https:// | ||
- | {" | ||
- | </ | ||
- | |||
- | Check federation and Matrix operability, | ||
- | < | ||
- | https:// | ||
- | </ | ||
- | |||
- | |||
- | ===== Reverse proxy ===== | ||
- | |||
- | A Matrix server must be hosted on a dedicated subdomain. Please see my [[selfhost: | ||
- | |||
- | <file - chat.conf> | ||
- | server { | ||
- | server_name chat.mydomain.com; | ||
- | listen 8443 ssl; # external access | ||
- | listen 443 ssl; # internal access | ||
- | |||
- | access_log / | ||
- | error_log / | ||
- | |||
- | location / { | ||
- | root / | ||
- | } | ||
- | |||
- | location ~ ^(/ | ||
- | add_header ' | ||
- | proxy_pass http:// | ||
- | #proxy_pass http:// | ||
- | proxy_set_header X-Forwarded-For $remote_addr; | ||
- | proxy_set_header X-Forwarded-Proto $scheme; | ||
- | proxy_set_header Host $host; | ||
- | proxy_buffering off; | ||
- | client_max_body_size 30M; | ||
- | proxy_read_timeout 10m; | ||
- | proxy_http_version 1.1; | ||
- | } | ||
- | |||
- | location / | ||
- | return 200 ' | ||
- | types { } default_type " | ||
- | } | ||
- | |||
- | location / | ||
- | return 200 ' | ||
- | types { } default_type " | ||
- | add_header " | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | ===== Adding users ===== | ||
- | |||
- | From the Contuwuit admin console, which can be accessed by running the conduwuit binary in a terminal then hit **CTRL+C**, you can do a lot of admin stuff, including creating new users. | ||
- | |||
- | To create a user: | ||
- | < | ||
- | uwu> admin users create-user myuser mypassword | ||
- | </ | ||
- | |||
- | To make a user an admin: | ||
- | < | ||
- | uwu> admin users make-user-admin myuser | ||
- | </ | ||
- | |||
- | To change a user password: | ||
- | < | ||
- | uwu> admin users reset-password myuser mynewpassword | ||
- | </ | ||
- | |||
- | You **must** create at least one user and make it admin! | ||
- | |||
- | 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 ===== | ||
- | |||
- | Since i use OpenRC, simply drop the following script to / | ||
- | <file - / | ||
- | # | ||
- | # Copyright 2025 Gentoo Authors | ||
- | # Distributed under the terms of the GNU General Public License v2 | ||
- | |||
- | name=" | ||
- | description=" | ||
- | pidfile="/ | ||
- | command_background=true | ||
- | command="/ | ||
- | command_args=" | ||
- | command_user=" | ||
- | |||
- | depend() { | ||
- | need net | ||
- | } | ||
- | </ | ||
- | |||
- | Make it executable and add to the proper runlevel: | ||
- | <code bash> | ||
- | chmod +x / | ||
- | rc-update add conduwuit default | ||
- | </ | ||
- | |||
- | If you use the telegram bridge described below, also add the following: | ||
- | <file - / | ||
- | # | ||
- | # Copyright 2025 Gentoo Authors | ||
- | # Distributed under the terms of the GNU General Public License v2 | ||
- | |||
- | name=" | ||
- | description=" | ||
- | pidfile="/ | ||
- | command_background=true | ||
- | command="/ | ||
- | command_args=" | ||
- | command_user=" | ||
- | |||
- | start_pre() { | ||
- | cd / | ||
- | } | ||
- | |||
- | depend() { | ||
- | need net | ||
- | } | ||
- | </ | ||
- | |||
- | Make it executable and add to the proper runlevel: | ||
- | <code bash> | ||
- | chmod +x / | ||
- | rc-update add conduwuit-telegram default | ||
- | </ | ||
- | |||
- | ===== Installing the Telegram Bridge ===== | ||
- | |||
- | The Mautrix Telegram bridge is currently the best (only?) option. More info | ||
- | [[https:// | ||
- | |||
- | Create subfolder and Python venv inside (see [[gentoo: | ||
- | <code bash> | ||
- | su - conduwuit | ||
- | mkdir mautrix-telegram | ||
- | cd mautrix-telegram | ||
- | # Enable PIP like in the link above | ||
- | # - create ~/ | ||
- | # - add ~/ | ||
- | python -m venv . # Note the dot at the end! | ||
- | source ./ | ||
- | # Now flip include-system-site-packages = true in pyvenv.cfg | ||
- | # Install: | ||
- | pip install --upgrade mautrix-telegram[all] | ||
- | </ | ||
- | |||
- | You need to create API keys to connect to Telegram. Go to [[https:// | ||
- | Grab the example config file [[https:// | ||
- | <code bash> | ||
- | wget -O / | ||
- | ln -d / | ||
- | </ | ||
- | |||
- | This file is huge, here are the most relevant changes needed: | ||
- | <file - config.yaml> | ||
- | address: https:// | ||
- | domain: chat.mydomain.com | ||
- | verify_ssl: true | ||
- | database: sqlite:/ | ||
- | telegram: | ||
- | # Get your own API keys at https:// | ||
- | api_id: << put your id here >> | ||
- | api_hash: << put your hash >> | ||
- | # (Optional) Create your own bot at https:// | ||
- | bot_token: disabled | ||
- | permissions: | ||
- | " | ||
- | " | ||
- | " | ||
- | </ | ||
- | More details on configuration can be found [[https:// | ||
- | |||
- | 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 | ||
- | </ | ||
- | |||
- | 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: | ||
- | < | ||
- | !admin appservices register << shift+enter >> | ||
- | ``` << shift+enter >> | ||
- | id: telegram | ||
- | as_token: << autogenrated >> | ||
- | hs_token: << autogenrated >> | ||
- | namespaces: | ||
- | users: | ||
- | - exclusive: true | ||
- | regex: ' | ||
- | - exclusive: true | ||
- | regex: ' | ||
- | aliases: | ||
- | - exclusive: true | ||
- | regex: \# | ||
- | url: http:// | ||
- | sender_localpart: | ||
- | rate_limited: | ||
- | de.sorunome.msc2409.push_ephemeral: | ||
- | push_ephemeral: | ||
- | ``` << enter >> | ||
- | </ | ||
- | |||
- | 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 // | ||
- | |||
- | The chat should reply with a message like: | ||
- | < | ||
- | Appservice registered with ID: telegram | ||
- | </ | ||
- | |||
- | More details on registering the appservice can be found [[https:// | ||
- | |||
- | You need to create the **telegrambot** user, again from the admin chat: | ||
- | < | ||
- | !admin users create-user telegrambot | ||
- | </ | ||
- | |||
- | Good! Now you can run the bridge: | ||
- | <code bash> | ||
- | python -m mautrix_telegram | ||
- | </ | ||
- | |||
- | If all is well, your bridge should be up and running now. | ||
- | |||
- | To login into telegram you need to: | ||
- | * Start a chat with telegrambot: | ||
- | * type " | ||
- | * 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:// | ||
- | |||
- | To manage animated sticker [[https:// | ||
- | |||