Telodendria: The terminal branches of an axon.
Telodendria is a Matrix homeserver implementation written from scratch in ANSI C. It is designed to be lightweight and simple, yet functional. Telodendria differentiates itself from other Matrix homeserver implementations because it:
Telodendria is on Matrix! Check out the official Matrix rooms:
Room | Description |
---|---|
#telodendria-releases:bancino.net
|
Get notified of new releases. |
#telodendria-general:bancino.net
|
General discussion and support for Telodendria. |
#telodendria-issues:bancino.net
|
Report issues with Telodendria. |
#telodendria-patches:bancino.net
|
Submit code patches to the Telodendria project. |
Telodendria is distributed as source tarballs, in true Unix
fashion. If you want, you can verify the checksum of your download,
and check the signature. To check the signature, you'll need
signify
, and the signify public key:
telodendria-signify.pub.
If your operating system has an official package or port of Telodendria, you should prefer to use that instead of manually downloading the source and building it. If your operating system's package or port is too out of date for your tastes, please contact the package's maintainers to notify them, or offer to update the package yourself.
Version | Download | Checksum | Signature |
---|---|---|---|
No downloads here yet. See the Project Status for more information. |
You can check out the change log here.
Telodendria is designed to be light enough that it can be built from source on just about any operating system. It only has the following requirements, all of which should be already available to you on a sufficiently complete operating system:
chroot()
system call (which is available in all
UNIX-like operating systems, but is not POSIX.) Because Telodendria
is written in ANSI C and sticks almost entirely to POSIX.1c features, it
should compile on almost any compiler and operating system with minimal
effort, but the following compilers and operating systems are known to work:
-Wl,-static -Wl,-gc-sections
from LDFLAGS
)
on OpenBSD.
find
, stat
,
env
, and compliant sh
-like shell.
If everything went well, that will produce build/telodendria
,
which you can then place wherever you want, and run as a system daemon.
See the contrib
folder for configuration examples.
If you're going to be doing more than just building the code, see
The Build Script for full documentation on
what the td
script can do.
Telodendria is designed to be extremely configurable. As such, it has
a fairly extensive configuration file. The configuration file is passed to
the Telodendria binary with the -c
option, and is
typically called /etc/telodendria.conf
. It uses OpenBSD-style
syntax, and consists of the following options.
There are example configuration files in the contrib
folder of
every source tarball, and in the CVS repository.
listen [hostname] [port]
The address to listen on. It is recommended to only listen on
localhost
, and then configure a reverse proxy such as
relayd(8)
in front of it, because Telodendria does
not implement TLS. Note that Telodendria doesn't provide multiple
ports for the various services it offers. All APIs are made available over
the same port.
[hostname]
should be a host name, an IPv4 address, or
an IPv6 address, if your operating system supports IPv6. [port]
should be a decimal port number or a service name. Refer to your system's
getaddrinfo()
manual page for acceptable values for both of
these parameters.
The listen
directive is entirely optional; if it is omitted,
then Telodendria will listen on localhost
, port
8008
by default.
server-name [name]
Configure the domain name of your homeserver. Note that Matrix servers cannot be migrated to other domains, so once this is set, it should never change, unless you want unexpected things to happen, or you want to start over.
[name]
should be a DNS name that everyone on the network
can resolve. This directive is required.
chroot [directory]
Change the root to the specified directory as soon as possible. Note that
all other paths and files specified in the configuration file must be
accessible from this directory. This only works if Telodendria is
running as root
. If it isn't, then a warning is printed to the
log, and no chroot
call is made. In that case, Telodendria
will still change into the specified directory, so that other paths can be
made relative to this one.
This directive is required. It is expected that the server data and logs will live here.
id [uid] [gid]
The effective UNIX user and group to drop to after binding to the socket and
changing the filesystem root. This only works if Telodendria is running as
root
, and is used as a security mechanism. If Telodendria is
started as a non-privileged user, then a warning is printed to the log if that
user does not match what's specified here.
This directive is required, even if Telodendria is unable to switch to this user. It can be used as a sanity check to make sure the permissions are working properly.
data-dir [directory]
The data directory in which Telodendria will write all user and event information. Telodendria doesn't use a database like other Matrix homeserver implementations; it uses a flat-file directory structure, similar to how an SMTP server uses Maildirs to deliver email.
This directive is required. [directory]
should be a path relative
to the chroot
directory. Don't depend on the chroot
option working, because there are many legitimate cases when Telodendria
will not be started as root
, thus causing the chroot to fail.
federation [true|false]
Whether to enable federation with other Matrix homeservers or not. Matrix by
its very nature is a federated protocol, but if you just want your own internal
chat server with no contact with the outside, then you can use this option to
disable federation. It is highly recommended to set this to true
,
however, if you wish to be able to communicate with users on other Matrix
servers.
This directive is required, though it may be made optional at some point in the future.
registration [true|false]
Whether or not to enable new user registration or not. For security and anti-spam
reasons, you can set this to false
. If you do, you can still add users
via the administrator API.
In an ideal world, everyone would run their own homeserver, so no public
registration would ever be required. But unfortunately, not everyone has the means
to run their own homeserver, especially because of the fact that public IPv4 addresses
are becoming increasingly harder to come by. If you would like to provide a service
for those that are unable to run their own homeserver, you can set this to true
,
which will allow anyone to create an account.
Telodendria should be capable of handling a large amount of users without difficulty or security issues. This directive is required.
log [file|stdout]
The log configuration. Telodendria uses its own logging facility, which can output to either standard output or a file. A number of child directives can be added to this directive to customize the log output:
level [error|warning|task|message|debug]
The level of messages to log at. Each level shows all the levels above it. For
example, setting the level to error
will show only errors, while
setting the level to warning
will show warnings and errors.
task
shows tasks, warnings, and errors, and so on.
timestampFormat [format|none|default]
If you want to custom ize the timestamp format shown in the log, or disable
the timestamp functionality altogether, you do so via this option. Acceptable
values are none
, default
, or a formatter string as
described by your system's strftime()
manual.
color [true|false]
Whether or not to enable colored output on TTYs. Note that ANSI color sequences will not be written to a log file, only a real terminal, so this option only applies if the log is being written to a standard output which is connected to a terminal.
threads [count]
How many worker threads to sping up to handle requests. This should generally be less than the total CPU core count, to prevent overloading the system. The most efficient number of threads ultimately depends on the configuration of the machine running Telodendria, so you may just have to play around with different values here to see which gives the best performance.
Telodendria is a very ambitious project. There's a lot that needs to happen yet before it is usable. At the moment, there's nothing that even remotely ressembles a Matrix homeserver here; I'm still getting off the ground and building a foundation.
But just because there's nothing here yet doesn't mean you should go away! I could always use help, so you are more than welcome to help out if you want things to go quicker. Please see the Contributing section for details on how you can get involved.
-c file -Vh
)Canonical JSON
\u
escapesThis documentation needs just a little work. Here's the things on my list for that:
indent(1)
instead.anoncvs
account is just anoncvs
.make.sh
recipes, and what they domsg-error
div)li
elements.div
s for notes and warnings.
I want a lightweight Matrix homeserver designed specifically for
OpenBSD and other Unix-like operating systems. I want a homeserver
that can be developed in vi(1)
and compiled with the
built-in C compiler. I want it to function entirely on a base OS
install without having to install any extra packages whatsoever.
I've found that as far as these priorities are concerned, the
existing homeserver implementations fall tremendously short. This
project aims to point out that existing homeserver implementations
are way over-engineered and written in such a way that many programs
and libraries have to be pulled in to use them.
I also want to learn how Matrix works, and I want to understand the code I'm running on my server, which is why I'm writing every component from scratch, even the HTTP server.
Telodendria is written entirely in portable ANSI C. It depends on no third-party C libraries other than the standard POSIX C library. The only thing you need to run it is a reverse proxy with HTTPS support, such asrelayd(8)
, and a directory that data can be
written to. Everything Telodendria needs to run itself is compiled
into a single static binary, and the source code can be built
anywhere, right out of the box. This makes it suitable for running
in a chroot(8)
environment.
Telodendria doesn't use a database like all the other homeservers.
Instead, it operates more like email: it uses a flat-file data
structure similar to Maildir to store data. The advantage of this is
that it saves server maintainers from also having to maintain a
database. It greatly simplifies the process of getting a Matrix
homeserver up and running, and it makes it highly portable. It also is
extremely easy to back up and restore with base tools; just
tar(1)
up the directory, and you're good to go.
Telodendria is developed and tested on OpenBSD, but you'll find that it should just run on any POSIX operating system without modification.
The goals of this project are generally divided into user goals, and developer goals, depending on who they impact the most. This isn't an exhaustive list, but it is a list of things that I want to prioritize, because other server implementations lack them.
The user goals are as follows:
The developer goals are as follows:
chroot(8)
. You'll even notice that
the documentation is written in HTML directly, not Markdown, to remove
the dependency on a Markdown parser and renderer.
Telodendria is designed to be fairly straightforward, but that
doesn't mean there won't be hiccups along the way. If you are struggling
to get Telodendria up and running, you're more than welcome to
reach out for support. Just join the
#telodendria-general:bancino.net
Matrix channel. Before
you do though, make sure you're running the latest version of
Telodendria and you've thoroughly read through all the
relevant documentation.
Telodendria is an open source project. As such, it welcomes contributions. There are many ways you can contribute, and any way you can is greatly appreciated.
If—after you've reached out to
#telodendria-general:bancino.net
—it has been
determined that there is a problem with Telodendria, it should
be reported to #telodendria-issues:bancino.net
. There it
can be discussed further. The issues room serves as the official
issue tracker of Telodendria; although severe issues may be copied
into a TODO
file in the CVS repository just so they
don't get lost.
The primary language used to write Telodendria code is ANSI C. Yes, that's the original C standard from 1989. The reason this standard is chosen, and the reason that it will not be changed, is because the original C is the most portable. Other languages you'll find in the Telodendria repository are shell scripts and HTML. If you have any experience at all with any of these languages, your contributions are valuable. Please follow the guidelines in this section to ensure the contribution workflow goes as smoothly as possible.
If you'd like to hack on Telodendria, you'll need the following tools in addition to the tools required to build the source:
cvs
for checking out and updating a local copy
of the source code.indent
for formatting your code before generating
patchespatch
for applying patches to your local copy of the
source code.Note that all of these tools are built into OpenBSD. While you of course don't have to use OpenBSD to develop Telodendria, it may make the process a little easier. In fact, these tools were chosen precisely because they were built into OpenBSD, the operating system I use.
You can download an official release tarball if you would really like, but the preferred way is to check out the source code from CVS. This makes generating patches a lot easier.
If you already checkout out the code previously, make sure you update your local copy before you start developing:
You should now have the latest Telodendria source code. Follow the Code Style as you make your changes.
In general, these are the conventions used by the code base. This guide may be slightly outdated or subject to change, however. The source code itself is the absolute source of truth, so as long as you make your code look like the code surrounding it, you should be fine.
CamelCase
. This is preferred to snake_case
because it is more compact.
lowerCamelCase
. This is preferred
to snake_case
because it is more compact.
enum
s and struct
s are always
typedef
-ed to their same name. The typedef
occurs in the public API header, and the actual declaration occurs in
the implementation file.
.c
file that
has a matching header file. The header file should only export public
symbols, everything else in the .c
file should be
static
.
As far as actually formatting the code goes, such as where to put
brackets and whether you use tabs or spaces, use indent(1)
to take care of all of that. The root of the repository has a
.indent.pro
file that should automatically be loaded by
indent(1)
to set the correct rules. If you don't have
access to a working indent(1)
, just indicate in your patch
that I should run indent(1)
on the code after applying it.
I'll likely run my indent(1)
on the code anyway though,
just to make sure the spacing is consistent, if nothing else.
Telodendria uses a custom build script called td
,
for Telodendria developer. The td
script is not only
a build script, however. It does all kinds of cool things like
format the source code, and generate patch files. td
is
the only supported way to develop Telodendria.
I opted to write a custom build script instead of just using
make
, because I felt that there is really no way to make
a truly portable Makefile
that could do everything I
need. I was doing a lot of research on the differences between the
GNU and BSD versions of make
, and I felt it just wasn't
worth it when I could write a small POSIX script that would run on
both GNU systems and BSD systems without a fuss. I also wanted a way
to automate more than just building code. I wanted a system
versatile enough that I could define arbitrary recipes to do whatever
I want. I didn't want to be limited by the Makefile
syntax.
The td
script is fairly intuitive. It operates somewhat
like make
, in that it has recipes that you specify
on the command line. To start using it, just run the following
command in your Telodendria directory:
Note: You will have to run the above command every time you start a new terminal session, as nothing is persisted to your system. I believe in non-invasive, fully self-contained tooling, so it is up to you to hook the Telodendria tools into your environment if you want them to persist.
If you're going to be submitting patches, you should also configure
a .env
file in the project directory root, which
td
will include automatically for you. For the best
experience, you'll want at least these values:
If you don't provide these values, td
will deduce them
from your environment. It uses your system username and hostname to
create the MXID
, and reads the password database to
get your configured display name. It also uses vi
as
the default editor, which may not be suitable for all developers.
You can invoke td
recipes with the following syntax:
Multiple recipes can be invoked in a single run of td
.
At the moment, recipes are run unconditionally; that is, even if parts
of a recipe fail, all following recipes still run.
Here is a complete list of recipes currently supported by
td
, and a description of what they do. Some recipes can
alter their behavior based on certain environment variables. Those
variables are also documented here.
build
: Build the source code, and generate the
build/telodendria
binary. This is the default
recipe; that is, it runs if no recipes are given as arguments to
td
. The build recipe is incremental; it only rebuilds
sources that have been modified since the last build, which makes
builds faster. This recipe makes use of many environment variables:
CFLAGS
: Compiler flags to generate object files.LDFLAGS
: Compiler flags to link the output binaryCC
: The compiler to use.PROG
: The name of the output binaryDEFINES
: Global preprocessor definitionsINCLUDES
: Header directories to make availableDEBUG
: If set to "1", append some debug flags to
CFLAGS
, and wipe out any LDFLAGS
that
would cause the output binary to be optimized. Also appends "-debug"
to PROG
.TELODENDRIA_VERSION
also makes its way into the output
binary, but it is primarily used for generating releases.
run
: Run a built Telodendria binary with the
development configuration in contrib/
. This recipe can
be used for quick testing during development. It is not the
recommended way to run Telodendria in a production environment;
it should be used only for development.
clean
: Remove the build/
directory, which
effectively cleans the source tree. Note that build
does
not place anything outside of build/
, so this is
functionally equivalent to running rm -r build
.
format
: Make sure the source code copyright headers are
up to date, and format the source code using the system's
indent(1)
command. This should be run before generating
patch files, to ensure that the code follows the project conventions.
Note that the provided .indent.pro
assumes an OpenBSD
indent
, which may cause the GNU implementation to choke.
test
: Run all of the unit tests, and report the results.
It is highly recommended to ensure that the tests all pass before
submitting a patch, because patches that break the tests are likely
to be rejected.
site
: Deploy the Telodendria website by copying the
required files to a web root. The web root is defined by the
TELODENDRIA_PUB
environment variable. This is mainly
used to deploy the official website, but it can be used to set up a
local development site if absolutely neccessary.
release
: Generate a release tarball, checksum and sign it,
and push it into the web root. The web root is defined by the
TELODENDRIA_PUB
environment variable. You may also have
to set CVSROOT
to the official CVS repository of
Telodendria. If you want to create a release tarball for an
older version, set TELODENDRIA_VERSION
. If you want to
generate a release tarball for the latest code, set
CVS_TAG
to HEAD
. If you want to sign the
generated tarball, set TELODENDRIA_SIGNIFY_SECRET
to a
signify
private key file. This is mainly used to deploy
releases to the official website, but it can be used to independently
mirror Telodendria releases from the official CVS repository.
patch
: Generate a formatted patch file. The
Telodendria project isn't super picky about how patches look
as long as they apply cleanly, but this recipe generates patches in
the format we like them. It makes them easy to read. This recipe will
use the EDITOR
variable to open your formatted patch in
your preferred editor. If no EDITOR
is specified, then
vi
is used. For more details on how this recipe works,
read Submitting Patches. This
recipe also makes use of PATCHSET
, MXID
,
and DISPLAY_NAME
.
diff
: Generate a temporary preview patch that is
opened in the default pager. This recipe uses the PAGER
variable to preview patches. If no PAGER
is set, then
less -F
is used as the default. This can be used for
quickly previewing patches. Setting PATCHSET
allows you
to only preview certain changes; see
Submitting Patches for more
information on how PATCHSET
works.
Any environment variables noted above that td
recipes
use can be specified in a .env
file in the root of the
Telodendria
directory. This saves you from constantly
having to set the environment variables in your shell, as well as
from having to pollute your user environment with Telodendria
variables. td
will automatically include the
.env
file on every run.
td
will source the .env
file, which means
it executes it like a shell script. Any shell code inside of
.env
will be executed every time td
is
run.
Telodendria aims at remaining as minimal as possible. This doesn't just mean minimal code, it also means a minimal development process, which is why Telodendria doesn't use GitHub, GitLab, or even SourceHut. Instead, the contribution workflow operates on submitting patch files to a public Matrix room, sort of like the OpenBSD project operates on patch files sent to a public mailing list.
If you're not used to manually creating and submitting patches instead of
opening a "pull request," you should be pleased to hear that submitting
patches is fairly easy to do if you've got the CVS sources checked out.
In fact, I find it easier than having to make a GitHub account, forking
a project repository, and then making a pull request for it. Once you
have made your changes in your local copy of the code, and you've
configured your environment using the instructions in
The Build Script, just run the
patch
recipe:
This will automatically generate a patch file for all your changes,
and then open it in your preferred editor.
You can also generate a patch for only certain files and directories.
To do that, set PATCHSET
, like this:
As you'll notice, the top of the patch file should have some email-style headers that look like this:
As much information as possible should be filled out for you, such as
the date. An attempt to fill out the From
header was also
made, but the information there can be made more accurate by setting
MXID
to your Matrix ID, and DISPLAY_NAME
to
your real name in your environment, or the .env
file.
The Subject
should very briefly describe what the patch
is about. Below these headers, write a more in-depth description of
the patch.
Then, send the resulting patch file to
#telodendria-patches:bancino.net
, so it can be
discussed and reviewed by the community. If you don't have a Matrix
account, and you really don't want to create one—ignoring
how odd it is that you are trying to contribute to a Matrix
homeserver project—you can email your patches to
jordan@bancino.net. However,
the preferred way of submitting patches is to the official Matrix room,
so I will upload your patch there along with your email address. If you
are going to send patches via email, they must be plain text emails,
and the patch must be in the main body of the email. No MIME, base64, or
printed-quotable garbage. I will silently reject emails that are not
purely plain text. I should be able to write a raw copy of your message to
an mbox
file, and then apply it onto my code right from
there, with no further processing. If you're going to be a regular contributor,
it would just be easier to create a Matrix account. It doesn't have to be
on my public homeserver, but it certainly can be. Note that the discussion and
ultimately the decision on what to do with your patch will all happen in
the Matrix room, so if you submit patches using email, you'll miss out on
any feedback.
Try to keep your patches on topic—make one patch file per feature or bug fix being implemented. It is okay if your patches depend on previous patches, just indicate that in the patch. Note that it may take a while for patches to be committed, and some patches may not be committed at all. In either case, all sent patches are queued from the Matrix room into the public patch directory, so they can be referenced easier in the future. If you want to reference a submitted patch in a Matrix message or email, it might be a good idea to link to it in the public patch directory.
The public patch directory works as follows: when you send your patch to the
Matrix room, it is downloaded by the Telodendria Bot and placed in the
ingress/
directory, named as the message ID. Then, it is
assigned a Telodendria patch ID and copied to the p/
directory as just ${id}.patch
. This is a permanent link that will
always reference your patch. Then, your patch is symlinked to the
queue/
directory. I have a script that automatically ingresses
patches and queues them for me, and I'll use this to review patches.
If your patch is accepted, the queue symlink will be moved to the
accepted/
directory and the patch is committed to the official
CVS repository. If you patch is rejected for some reason, its symlink will
be moved to the rejected/
directory. Regardless of the state
of your patch, it will always remain permalinked in the p/
directory, and when it is accepted or rejected, Telodendria Bot will
send a message.
You're always welcome to inquire about rejected patches, and request they be reviewed again, or you can use them as a starting point for future patches.
All of the code for Telodendria is licensed under a modified
MIT license. Please consult the src/header.txt
file for
the actual license text. The Telodendria license text differs
from the MIT license in the following ways:
The documentation for Telodendria is also licensed under the
modified MIT license that lives in src/header.txt
. Whether
you obtain the documentation by printing, or otherwise downloading
this page, or by checking it out from the CVS source, it is licensed
the same as the code.
The Telodendria logo, however, belongs solely to the Telodendria project. It must only be used to represent the official Telodendria project, and may only appear in official Telodendria media. If Telodendria is forked, the logo must be removed from the project and optionally replaced by a different one. The logo may not be modified in any way or for any purpose.
Telodendria would not be possible without the support of the following people:
At this time, Telodendria does not have any tagged releases because it is not yet functional as a Matrix homeserver. Please check out the Project Status to see where things are currently at.