Differences between revisions 1 and 19 (spanning 18 versions)
Revision 1 as of 2022-08-19 19:12:58
Size: 1937
Comment:
Revision 19 as of 2023-05-29 12:31:56
Size: 4233
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

'''Sourcehut''' is a software system providing [[Git|git]] and [[Mercurial|mercurial]] version control hosts, a bug tracker, and a simple web UI.
Line 11: Line 13:
Upstream only officially supports [[Linux/AlpineLinux|Alpine Linux 3.15]]. Upstream only officially supports [[Linux/Alpine|Alpine Linux 3.15 through 3.17]].
Line 16: Line 18:
https://mirror.sr.ht/alpine/v3.15/sr.ht https://mirror.sr.ht/alpine/v3.17/sr.ht
Line 19: Line 21:
The community package repository must be enabled. See [[Linux/AlpineLinux#Software_Installation|here]] for more details. The community package repository must be enabled. See [[Linux/Alpine/Apk|here]] for more details.
Line 28: Line 30:
Sourcehut is a modular ecosystem, with `meta.sr.ht` being the only mandatory package. For example, to run the [[Git|git]] and [[Mercurial|mercurial]] services, use `git.sr.ht` and `hg.sr.ht`, respectively. Sourcehut is a modular ecosystem, with `meta.sr.ht` being the only mandatory package (as it handles authentication and authorization). For example, to run the [[Git|git]] and [[Mercurial|mercurial]] services, use `git.sr.ht` and `hg.sr.ht`, respectively. Installation and configuration of these modular services is detailed in a corresponding section under Administration.

Install the `meta.sr.ht` package. Start and enable three services: `meta.sr.ht`, `meta.sr.ht-api`, and `meta.sr.ht-webhooks`. Finally enable the `metasrht-daily` cronjob and set it to run daily.
Line 34: Line 38:
Eli Schwartz maintains an unofficial set of packages for [[Linux/ArchLinux]]. Eli Schwartz maintains a set of packages for [[Linux/Arch|Arch Linux]].
Line 50: Line 54:
----
Line 52: Line 57:
=== Development Setup ===
Line 54: Line 58:
TODO: copy from [[https://emersion.fr/blog/2021/setting-up-sr.ht-for-local-development/]] == Configuration ==



=== Web Server ===

A reverse proxy is needed to dispatch between services; to serve static content; and to serve the HTTP [[Git|git]] frontend. See [[Sourcehut/WebServer#Configuration|Web Server]] for configuration information.



=== Mail Server ===

See [[Sourcehut/Mail#Configuration|Mail]] for configuration information.

A test email can be sent from `https://meta.example.com/privacy`.



=== Redis ===

The pools of web workers are managed through [[Redis]] queues. The connection string needs to be set in several parts of the configuration file.

{{{
[sr.ht]
redis-host=redis://localhost

[meta.sr.ht]
webhooks=redis://localhost:6379/1

[git.sr.ht]
webhooks=redis://localhost:6379/1
}}}

''(And so on.)'' Note that each service ''can'' use an independent database if desired.



=== PostgreSQL ===

Each services is backed by a [[PostgreSQL]] database. The connection string needs to be set in several parts of the configuration file.

{{{
[git.sr.ht]
connection-string=postgresql://postgres@localhost:5432/git.sr.ht?sslmode=disable
migrate-on-upgrade=yes

[meta.sr.ht]
connection-string=postgresql://postgres@localhost:5432/meta.sr.ht?sslmode=disable
migrate-on-upgrade=yes
}}}

Note that each service ''can'' use an independent database instance if desired.



=== SSH ===

See [[Sourcehut/SSH#Setup|SSH]] for configuration information.
Line 62: Line 123:
=== Build Service ===

=== Users ===

To create an admin user, try:

{{{
metasrht-manageuser -t admin -e <email> <username>
}}}

Note that admin users will permanently see a 'PRODUCTION ENVIRONMENT' banner on all pages.

With an existing admin user, users can be managed in the web UI.

Individual users then need to upload their own SSH and PGP keys, also through the web UI.



=== Git ===

=== Mercurial ===

=== Bug Tracker ===

=== Page Hosting ===

=== Mail Lists ===

=== Automated Builds ===

Sourcehut

Sourcehut is a software system providing git and mercurial version control hosts, a bug tracker, and a simple web UI.


Installation

Upstream only officially supports Alpine Linux 3.15 through 3.17.

To enable the package repository, add the following line to /etc/apk/repositories. It must be the first repository checked.

https://mirror.sr.ht/alpine/v3.17/sr.ht

The community package repository must be enabled. See here for more details.

Install the packager's key and update the package index.

wget -q -O /etc/apk/keys/[email protected] https://mirror.sr.ht/alpine/[email protected]
apk update

Sourcehut is a modular ecosystem, with meta.sr.ht being the only mandatory package (as it handles authentication and authorization). For example, to run the git and mercurial services, use git.sr.ht and hg.sr.ht, respectively. Installation and configuration of these modular services is detailed in a corresponding section under Administration.

Install the meta.sr.ht package. Start and enable three services: meta.sr.ht, meta.sr.ht-api, and meta.sr.ht-webhooks. Finally enable the metasrht-daily cronjob and set it to run daily.

Community Packages

Eli Schwartz maintains a set of packages for Arch Linux.

Add the mirror to /etc/pacman.conf:

[sr.ht]
Server = https://mirror.sr.ht/archlinux/sr.ht

Then install the packagers' keys:

sudo pacman-key --recv-keys C0AAFC1676BD998617C94C42DC59670F1EB0A189
sudo pacman-key --lsign-key C0AAFC1676BD998617C94C42DC59670F1EB0A189


Configuration

Web Server

A reverse proxy is needed to dispatch between services; to serve static content; and to serve the HTTP git frontend. See Web Server for configuration information.

Mail Server

See Mail for configuration information.

A test email can be sent from https://meta.example.com/privacy.

Redis

The pools of web workers are managed through Redis queues. The connection string needs to be set in several parts of the configuration file.

[sr.ht]
redis-host=redis://localhost

[meta.sr.ht]
webhooks=redis://localhost:6379/1

[git.sr.ht]
webhooks=redis://localhost:6379/1

(And so on.) Note that each service can use an independent database if desired.

PostgreSQL

Each services is backed by a PostgreSQL database. The connection string needs to be set in several parts of the configuration file.

[git.sr.ht]
connection-string=postgresql://postgres@localhost:5432/git.sr.ht?sslmode=disable
migrate-on-upgrade=yes

[meta.sr.ht]
connection-string=postgresql://postgres@localhost:5432/meta.sr.ht?sslmode=disable
migrate-on-upgrade=yes

Note that each service can use an independent database instance if desired.

SSH

See SSH for configuration information.


Administration

Users

To create an admin user, try:

metasrht-manageuser -t admin -e <email> <username>

Note that admin users will permanently see a 'PRODUCTION ENVIRONMENT' banner on all pages.

With an existing admin user, users can be managed in the web UI.

Individual users then need to upload their own SSH and PGP keys, also through the web UI.

Git

Mercurial

Bug Tracker

Page Hosting

Mail Lists

Automated Builds

Anecdotally the build service is the most unreliable component of the Sourcehut ecosystem.

The master server runs the builds.sr.ht package and service. Each runner corresponds to a builds.sr.ht-worker service, which depends on the builds.sr.ht-worker and builds.sr.ht-images packages.

Upstream's production architecture thoroughly encapsulates the runners.


CategoryRicottone

Sourcehut (last edited 2024-10-02 02:23:43 by DominicRicottone)