As an open source project, you are encouraged to install SourceHut on your own infrastructure or deploy it locally to hack on it and contribute improvements upstream. This document familiarizes you with the internals of SourceHut and the installation and deployment of the software on your own systems.
SourceHut is a distributed system of "mini-services", such as git, builds, todo, and so on. You can deploy all of these services or a subset of them as your use-case requires. The only service which is required is meta.sr.ht, which provides account management and authentication for the other services.
The following components are common to most services:
Some services only have an API (e.g. pages.sr.ht), others only have a frontend (e.g. man.sr.ht). Many services also have various other components, such as the build workers that power builds.sr.ht, the SSH pipeline common to git.sr.ht, hg.sr.ht, and builds.sr.ht, or the email ingress for lists.sr.ht. Many services have cronjobs and various ancillary executables for various purposes, or have other unique requirements which are documented on their respective pages.
SourceHut requires the following software to be available and configured by the user separately from the rest of SourceHut:
The installation, configuration, and maintenance of these prerequisites is out of scope for this documentation.
At small scales, you can install all SourceHut services on a single server. The server requirements scale depending on your use-case -- SourceHut's software is generally lightweight but you will need to consider, for example, how much git storage you require and what kind of traffic you expect. A basic installation for up to several dozen users including, for example, the following services:
Can be supported by virtually any small VPS. The following services present more challenges to deploy:
All of our services run on Alpine Linux in production. Alpine is strongly recommended for most production deployments of SourceHut, and is the only officially supported environment. You can learn about our third-party Alpine Linux package repository here.
If you run a production instance of SourceHut you are strongly encouraged to subscribe to the sr.ht-admins mailing list. This is a low-volume mailing list which notifies downstream sysadmins of important information for the maintenance of their instance, such as upgrades which require manual intervention, or notice of security vulnerabilities.
The high-level installation process is generally as follows for each service:
git.sr.ht)/etc/sr.ht/service git.sr.ht-api start)Each service may have unique steps or requirements for the complete installation. Consult the documentation for each service here:
An example config.ini file is provided in the source code repository for each
service. These configurations can be merged if you run more than one service on
a single server. Each example configuration is commented throughout -- you are
encouraged to read the example from start to finish and fill in the necessary
fields and adapt it to your own use-case.
Each service requires a PostgreSQL database and a user with ownership and all
necessary permissions that apply to its database. To initialize the database,
run sourcehut-migrate $service init.
Database migrations are also provided by the
sourcehut-migrate package, which is based on brant;
see sourcehut-migrate -h for its usage. Migrations are generally handled
automatically during package upgrades if [$service]migrate-on-upgrade is set
to "yes".
We use nginx in production as a reverse proxy for SourceHut services. You can see how we configure it in the sr.ht-nginx repository for reference.
chat.sr.ht is built almost entirely out of third-party software, namely soju and gamja. We apply some downstream patches to soju to support SourceHut accounts for authentication -- browse our patches here.
We accept contributions for all of SourceHut's code on the sr.ht-dev mailing list, where we accept patches prepared with git send-email. This is also where we handle most of our development discussions and proposals.
While we recognize that it is pretty annoying to get SourceHut up and running to test small changes, we still expect that all contributors test their changes prior to submitting patches.
Please note that we do not accept code authored by or assisted by an LLM or other AI tool in SourceHut's various codebases.
commit 90bf271c0b6c13987072198b9044c63fbb176477 Author: Michael Forney <mforney@mforney.org> Date: 2026-10-30T16:53:15-07:00 builds.sr.ht/compatibility: NetBSD was updated to 11.0 and 10.2