Self-Hosting Matrix for Federated Communication @ Cédric Walter | Monday, Oct 7, 2024 | 4 minutes read | 825 Words | Update at Monday, Oct 14, 2024

Privacy and control over personal data are increasingly at risk, self-hosting communication tools has become more attractive. Among the available options, Matrix, an open-source decentralized communication protocol, stands out for its ability to offer federated, secure, and scalable communication.

Full Control Over Data

In today’s digital age, privacy concerns are higher than ever. Large tech companies collect vast amounts of data, often without explicit user consent. When using centralized platforms (e.g., WhatsApp, Slack), you’re placing trust in third-party entities to manage sensitive conversations and data.

By self-hosting Matrix, you have complete control over your server, meaning your data remains where you want it to be. You decide what is stored, how it is stored, and who can access it. In a world of increasing data breaches, this level of control ensures better protection of personal and business information.

Federation for Decentralization

Matrix operates on a federated model, meaning different servers can communicate with each other. This decentralization gives you the freedom to:

  • Join or create your server: You can run your own server and still communicate with users on other Matrix servers seamlessly.
  • Reduce dependency on centralized entities: Centralized services are vulnerable to shutdowns, policy changes, or server issues. Federation ensures resilience, allowing communication to continue even if one server goes offline.

For example, you can set up a small server for your company and enable external federated communication with clients and partners using other Matrix servers. This gives the flexibility to collaborate without compromising autonomy.

Privacy and End-to-End Encryption

Matrix supports end-to-end encryption (E2EE), providing a high level of privacy for your conversations. With self-hosting, you have the assurance that your encrypted messages aren’t passing through a third-party server, reducing the risk of external surveillance.

While centralized platforms may claim to offer secure messaging, the question remains: Who controls the encryption keys? With Matrix, those keys stay in your hands when you self-host.

Customizability and Open Source

Matrix is open source, meaning you can tweak and customize the platform to fit your specific needs. Self-hosting allows you to:

  • Integrate with other tools: Easily connect your Matrix server with other self-hosted services like GitLab, Nextcloud, or Jitsi for a unified, privacy-focused ecosystem.
  • Personalize features: You can modify the platform’s appearance, behavior, or add features not available on centralized messaging systems. For developers and tech-savvy users, the possibilities are endless in crafting a solution tailored to their exact requirements. This flexibility is especially useful for organizations looking to integrate specific workflows or automate communication processes.

Scalability and Cost Efficiency

One common misconception is that self-hosting is expensive or resource-intensive. Matrix, however, is designed to be scalable:

Start small, scale as needed: Whether you’re a single user or managing communication for a large team, Matrix allows you to start with a small setup and grow as your user base expands. Cost control: Self-hosting Matrix can be cost-effective since you can control hardware and hosting costs, compared to SaaS subscriptions for enterprise communication tools. For a personal server, modest resources might be sufficient, but you can expand as your needs grow without worrying about escalating subscription fees.

Installation of Synapse in docker

Synapse is an open-source homeserver implementation of the Matrix protocol. Matrix is a decentralized communication protocol designed to support secure, real-time communication, including instant messaging, VoIP, and more. Synapse acts as a server that hosts user accounts, stores messages, and participates in federated communications within the Matrix ecosystem.

Run only once this to generate configuration files Adapt path /root/docker/matrix and DNS name my.matrix.host

services:
    synapse:
        stdin_open: true
        tty: true
        volumes:
           - /root/docker/matrix:/data
        environment:
          - SYNAPSE_SERVER_NAME=my.matrix.host
          - SYNAPSE_REPORT_STATS=yes
        image: matrixdotorg/synapse:latest
        command: generate

Start the Synapse server with the following YAML. Note that we are running Synapse behind a reverse proxy (here Traefik) offers several benefits, including better control over HTTPS configurations, load balancing, and access logging.

networks:
  traefik_proxy:
    external: true

services:
    synapse:
        image: matrixdotorg/synapse:latest
        container_name: matrix
        environment:
          - LOG_LEVEL=debug
          - PUID=1000
          - PGID=1000
          - TZ=Europe/Zurich
        ports:
          - 8008:8008
        volumes:
          - /root/docker/matrix:/data
        restart: unless-stopped
        labels:
          - "traefik.enable=true"
          - "traefik.docker.network=traefik_proxy"
          # Http (Only redirect to HTTPS)
          - "traefik.http.routers.matrix.entrypoints=http"
          - "traefik.http.routers.matrix.rule=Host(`my.matrix.host`)"
          - "traefik.http.middlewares.matrix-https-redirect.redirectscheme.scheme=https"
          - "traefik.http.routers.matrix.middlewares=matrix-https-redirect"
          # Https
          - "traefik.http.routers.matrix-secure.entrypoints=https"
          - "traefik.http.routers.matrix-secure.rule=Host(`my.matrix.host`)"
          - "traefik.http.routers.matrix-secure.tls=true"
          - "traefik.http.routers.matrix-secure.tls.certresolver=letsencrypt"
          - "traefik.http.routers.matrix-secure.service=matrix"
          - "traefik.http.routers.matrix-secure.middlewares=secureHeaders@file"
          # Service
          - "traefik.http.services.matrix.loadbalancer.server.port=8008"
          - "traefik.http.services.matrix.loadbalancer.server.scheme=http"
        networks:
          - traefik_proxy

Finally create an admin user with

docker exec -it matrix register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -u adminUsername -p adminPassword

You can create as many user as wanted using the command above

Hardening

add to homeserver.yaml

enable_registration: false
allow_guest_access: false

rc_message:
  per_second: 0.2  # messages per second
  burst_count: 10   # allow bursts of up to 10 messages
rc_registration:
  per_second: 0.03  # registration requests per second
  burst_count: 5    # burst limit

Configure bridges

An important idea in Matrix is Interoperability. This means that Matrix is open to exchanging data and messages with other platforms using an Open Standard. We refer to the connection to other platforms as bridging. Click on the platform you would like to bridge to to see all the existing bridges. https://matrix.org/ecosystem/bridges/#whatsapp

Related content

20+ Bonnes Raisons de Quitter Instagram/Tik Tok/Facebook/Tik Tok/Facebook

20+ Bonnes Raisons de Quitter Instagram/Tik Tok/Facebook/Tik Tok/Facebook

Wednesday, Jul 24, 2024

Instagram/Tik Tok/Facebook est l’une des plateformes de médias sociaux les plus populaires, offrant un espace pour partager des photos, des vidéos et se connecter avec des amis et des influenceurs. Cependant, malgré ses avantages, de nombreuses personnes trouvent des raisons valables de quitter cette application. Voici 20 bonnes raisons pour lesquelles vous pourriez envisager de dire adieu à Instagram/Tik Tok/Facebook.
6 minutes read

© 1997 - 2024 Cédric Walter blog

Powered by Open Sources technologies

avatar

Cédric WalterA true selfless act always sparks another

6s A1 Acedeck Achat Acide-Hyaluronique Acma Adaptability Advocate-for-Change Ai Airplane Algorand Alice-Hlidkova-Author Alpine Alps Alternative Altruism-vs-Commercialization Antique-Scooters Antiseptic-Rinse Apache Apple Apps-De-Messagerie Arcade Arcade-Gaming Armattan Art Artemis Artemis-Viper Artistic-Expression Atlassian Authenticity-in-Writing Authenticity-Matters Avis Bag Bambulab Bash Bean Bennu Bernardet Bestwishes Betaflight Betruger Beware Bien-Vivre Bien-Être Bien-Être-Physique Bike Bio Bioethics Bitcoin Blessures-Sportives Blockchain Blockchain-Consensus-Encyclopedia Blockchain-Systems Blog Book-Review Books Bots Bought Box Brand-Authenticity Brand-Integrity Brand-Protection Breaking-Barriers Business-Management Business-Milestones Business-Strategy Business-Success Business-Transformation Businessbooks Byzantine-Fault-Tolerance Calculator Calibre Calibre-Web Camera Case-Studies Cc2500 Cgm-Next Challenges Changement-De-Vie Channel-Setup Cheaper Cherry-Blossoms Chiffrement Chirurgie-Orthopédique Choosing-Fbl-Gyro Ci/Cd Classic-Games Classic-Scooters Classic-Vespa Climb Climbing Codefest Collectible-Scooters Collectibles Collection Collector Color Communication Competition Confidentialité Consensus-Algorithms Consensus-Mechanisms Console Consommation-Responsable Consumer-Awareness Containerization Contest Control-Surfaces Controller Copy Corticostéroïdes Counterfeit-Awareness Counterfeit-Culture Counterfeit-Market Counterfeit-vs-Authentic Covid19 Creating Croissance-Personnelle Cryptocurrency Cultural-Experience Cultural-Richness Curve-Adjustments Customer-Discovery Cve-Issues Dance-Dreams Death Decentralization Decentralized Dental-Hygiene Dependency Design Development Devfest Devops Distributed-Ledger-Technology Diverse-Perspectives Diy-Dental Diy-Health Dji Docker Docker-Compose Docker-Hosting Docker-Networking Docker-Registry Docker-Security Dont-Buy Dotnet Download Downloading Dreams-and-Reality Drone Ducati Dynamic-Ip Désencombrement Développement-Personnel Développement-Spirituel Ecology Edgetx Elrs Elta Emotional-Challenges Emotional-Hurdles Empowering-Narrative Endpoints Engelberg Ensitm Entrepreneurial-Lessons Entrepreneurial-Mindset Entrepreneurs Entrepreneurship Entrepreneurship-Books Essaim Essentially Ethereum Ethical-Dilemmas Evoque Execution Exercices-De-Renforcement Exercise-Form Expérience-Utilisateur Facebook Failure-Analysis Failure-Stigma Failure-to-Success Fake Fake-Apparel Fake-Brands Fake-Goods Family Family-Building Family-Dynamics Fashion-Ethics Fashion-Fraud Fbl-Controllers Fbl-System-Compatibility Fbl-System-Features Fbl-System-Reviews Federated Fertility-Struggles Finance Finance-Books Finances-Personnelles Financial-Modeling Financiallanning Firearm Firmware-Customization Firmware-Issues Fissure-Horizontale Fitness-Routine Fitness-Tips Flexibilité Flight-Controller Flybarless-Advantages Flybarless-Systems Fonctionnalités-Avancées Foss Fpv Frame France Freestyle Fresh-Breath Friendship-Goals Front Gallery Game-Music Gameplay-Mechanics Gamer-Community Games Gaming-Culture Gaming-Enthusiast Gaming-History Gaming-Legacy Gaming-Nostalgia Generative-Ai Genou Gestion-De-Ladouleur Gestion-Du-Temps Git Global-Impact Google Green-Tea Green-Tea-Mouthwash Growth-Hacking-Books Growth-Mindset Guide Hackathon Hackday Hackfest Health-and-Wellness Helicopter Helicopter-Community Helicopter-Gyro Helicopter-Tuning Herbal-Mouthwash Hewlettpackard Historical-Scooters Hobbies Hobby Hobbyist-Blog Holidays Holistic-Oralcare Hollidays Home-Remedy Home-Workouts Homelab Homemade-Oralcare Honda Honesty Honey Hornet How-To HowTo Https Hugo Human-Connection Hygiene-Routine Icecream Iconic-Scooters Iflight Iflightnazgulevoque Im Imessage Immich Indoor Industrial-Shit Industry Injections-Intra-Articulaires Injury-Prevention Innovation Innovation-Books Innovation-Journey Instagram Intégration-Apple Ios Japan-Travel Japanese-Cuisine Jar Java Jdk11 Jellyfin Joint-Health Junit Jupiter Kitchen Knee-Rehabilitation Knee-Stability Knockoff-Alert Kyoto Lacoste Lacoste-Counterfeit Lambretta Landmarks Leadership Leadership-Books Lean-Startup Learning-From-Failure Leg-Day Leg-Workouts Legal-Complexities Legit-Fashion Let's-Encrypt Libération Life-Transformations Link Linux Llm Local-Traditions M2evo Macos Magical-Adventure Magician-Lord Main Maison Make Manurhin Manurhin-Sm75 Mapping Marathon Market-Research Marketing-Books Maven Me Medical Medical-Advancements Messagerie Messenger Metakernel Miami-Entertainment Mid-Century-Scooters Migration Mindset-Shifts Minimalisme Minimum-Viable-Product Minty-Fresh Mixer-Settings Mk3 Mk4 Mobilité Model-Setup Modern-Family Modern-Motherhood Moon Moral-Encounters Motherhood-Dilemmas Moto Motorcycle Mount Mountain Mountains Mouth-Rinse Mouthwash-Ingredients Mouthwash-Recipe Mulhouse Muscle-Activation Music Mvs Mycollection Ménisque NASA Natural-Mouthwash Nature Nazgul Neo-Geo-Aes Neogeo Network New-Bookrelease Nginx-Proxy North-Face North-Face-Replica Nostalgic-Scooters Nv14 Objectifs Offroad Old-School-Scooters Omphobby Open-Source Open-Source-Rc Opensource Opentx Openvpn Oral-Care Oral-Health Organizer Osaka Oss Overcoming-Challenges P1p P1s Parental-Rights Parenthood-Reflections Parts Passion Patella-Health Persistence Personal-Relationships Photos Physical-Therapy Physiothérapie Pivot-Strategy Pixel-Art Planet Plasma-Riche-en-Plaquettes Platform Plex Pluto Ppl Pretty-Girl-Complex Privacy Private-Pilot-License Product-Market-Fit Productivity-Books Proof-of-Stake Proof-of-Work Protect-Your-Style Protection-Des-Données Prusa Prusa-Research Public-Image Quadcopter Quadriceps-Strength Quiz Radio-Control Radio-Programming Radiomaster Rare-Scooters Raspberrypi Raspbian Rates-Configuration Rc Rc-Community Rc-Configuration Rc-Firmware Rc-Helicopter Rc-Helicopter-Electronics Rc-Helicopter-Enthusiasts Rc-Helicopter-Setup Rc-Helicopter-Technology Rc-Helicopter-Tips Rc-Helicopters Rc-Modeling Rc-Simulator Realdebrid Realflight Receiver Reflex-Xtr Refreshing-Breath Rehabilitation-Exercises Relations-Personnelles Relationship-Complexities Released Remote Remote-Control-Flying Reproductive-Ethics Resilience-in-Business Resilient-Women Restored-Scooters Retro-Gaming Retro-Gaming-Community Retro-Gaming-Console Retro-Scooters Reverse-Proxy Rhythms-of-Life Risk-Management Robotic Router Rx Réadaptation Rééducation Sab Sab-Raw-420 Sab-Raw-580 Sab-Raw-700 Sales-Books Sans-Publicité Santé-Articulaire Santé-Mentale Scooter-Enthusiast Scooter-Memorabilia Scooters Security-Nightmare Self-Leveling-Helicopter Server-Configuration Servo-Config Signal Simplification Skateboarding Skydiving Snk Snk-Corporation Snk-Neo-Geo Soap Social-Issues Solex Space Spams Sport Ssl-Termination Ssl/Tls Startup-Books Startup-Failure Static-Code-Generator Steam Strategic-Networking Streaming Strength-Training Success-Stories Sun Support Surrogacy-Agency Surrogacy-Journey Surrogacy-Narratives Swiftui Swiss Switzerland Sécurité Team Team-Building Team-Dynamics Technologie Teeth-Cleaning Telegram Temples-and-Shrines Tendermint Terrot Thérapie-Physique Tokyo Torvol Traefik Traitement-Des-Fissures Transmitter Transmitter-Firmware Travel Travel-Tips Trouver-Du-Sens Tunnel Turning-Setbacks-Into-Success Tutorial Tx Unconventional-Strategies Vacation Velosolex Vespa Viaferrata Video Video-Game-Review Vie-Numérique Vintage Vintage-Scooters Vintage-Two-Wheelers Vintage-Vespa Vintagegaming Vmo-Exercises Warez Web-Security Whatsapp Wind Winner Winterthur Women-Supporting-Women Wordpress Workout-Progression X1c Zurich Zyxel Zyxel-Avoid Zyxel-Not-Serious-With-Security Zyxel-Outdated Zyxel-Router-Not-Good Écosystème-Apple Équilibre
Me

Cédric Walter is a French-Swiss entrepreneur, investor, and software engineer based in Zurich, Switzerland. He spent his career developing software applications for Swiss insurance companies to handle billions of dollars in premiums. He cofounded Innoveo AG and as the software architect developed the no-code platform designed to reduce the manual coding that powers many software apps. As an active participant in the European hacking community, he works on many open source projects including blockchain. Cédric is a winner of SBHack19/21 and HackZurich 2021. His expertise include designing back end, event-based, and blockchain systems. Cédric is also the founded Disruptr GmbH, a software development company that offers full spectrum of services for businesses of all sizes. JAVA full-stack developer since 2000, in Blockchain since 2017, Certified Scrum Master 2012, Corda Certified Developer in 2019, Ethereum smart contract expert in the SWISS Blockchain Security working group Hackathons

  • HackZurich 2022 – Level Up in top 25 finalist among 134 submissions
  • SBHACK21 – SwiFi winner of best Solution on Algorand, overall Winner 3rd Prize, CV Labs Fast Track Ticket
  • HackZurich 2020 Europe’s Biggest Hackathon winner in category Migros
  • SBHACK19 – LendIt winner of Swiss biggest Blockchain Hackathon Member of the Bitcoin Association Switzerland and Cryptovalley association Switzerland, Github https://github.com/cedricwalter 99.9% most of my career code is unfortunately NOT on github 😵 PGP: DF52 ADDA C81A 08A6

PGP: DF52 ADDA C81A 08A6

Copyright information

All editorial content and graphics on our sites are protected by U.S. copyright, international treaties, and other applicable copyright laws and may not be copied without the express permission of Cedric Walter, which reserves all rights. Reuse of any of Cedric Walter editorial content and graphics for any purpose without The author ’s permission is strictly prohibited.

DO NOT copy or adapt the HTML or other code that this site creates to generate pages. It also is covered by copyright.

Reproduction without explicit permission is prohibited. All Rights Reserved. All photos remain copyright © their rightful owners. No copyright infringement is intended.

Disclaimer: The editor(s) reserve the right to edit any comments that are found to be abusive, offensive, contain profanity, serves as spam, is largely self-promotional, or displaying attempts to harbour irrelevant text links for any purpose.

Others

If you like my work or find it helpful, please consider buying me a cup of coffee ☕️. It inspires me to create and maintain more projects in the future. 🦾

It is better to attach some information or leave a message so that I can record the donation 📝 , thank you very much 🙏.

Reproduction without explicit permission is prohibited. All Rights Reserved. All photos remain copyright © their rightful owners. No copyright infringement is intended.