2020-03-26 15:25:20 +01:00
|
|
|
---
|
|
|
|
title: Hacking on SourceHut
|
|
|
|
toc: false
|
|
|
|
---
|
|
|
|
|
2020-11-02 19:37:28 +01:00
|
|
|
This document provides information for those interested in hacking on or
|
|
|
|
contributing to SourceHut.
|
2020-03-26 15:25:20 +01:00
|
|
|
|
2020-11-02 19:37:28 +01:00
|
|
|
# Installation
|
2020-03-26 15:25:20 +01:00
|
|
|
|
2020-11-02 19:37:28 +01:00
|
|
|
Here are some tips to expedite the installation procedure:
|
2020-03-26 15:25:20 +01:00
|
|
|
|
2020-11-02 19:37:28 +01:00
|
|
|
* A PostgreSQL database and Redis server are always required.
|
2022-05-04 10:49:11 +02:00
|
|
|
* Some services require (or may optionally make use of) an S3-compatible
|
|
|
|
storage backend. Minio is recommended for this purpose.
|
2020-11-02 19:37:28 +01:00
|
|
|
* Generally, you can skip the webhooks daemons unless you need them.
|
2022-05-12 10:04:02 +02:00
|
|
|
* Always prefer [package installations][1] for obtaining dependencies.
|
2020-11-02 19:37:28 +01:00
|
|
|
* You can *usually* get away without configuring the outgoing mail settings,
|
|
|
|
but you may still have to generate a PGP key to get things started up.
|
|
|
|
* You can skip setting up a reverse proxy and use our development servers via
|
|
|
|
`python3 run.py` instead.
|
2022-05-04 10:49:11 +02:00
|
|
|
* Some services depend on other services. Some such integrations are optional,
|
|
|
|
but all services depend on meta.sr.ht.
|
|
|
|
|
2022-05-12 10:04:02 +02:00
|
|
|
[1]: /installation.md#installing-from-packages "SourceHut docs: Installing from packages"
|
|
|
|
|
2022-05-04 10:49:11 +02:00
|
|
|
## Dev dependencies
|
|
|
|
|
|
|
|
In addition to the runtime dependencies of our packages, building
|
|
|
|
packages from source requires additional build-time dependencies:
|
|
|
|
|
|
|
|
* `sassc` for CSS pre-processing
|
2023-03-15 21:32:18 +01:00
|
|
|
* `minify` for minifying CSS
|
2022-05-04 10:49:11 +02:00
|
|
|
* `go` for compiling the Go APIs
|
2023-03-15 21:32:19 +01:00
|
|
|
* `make` for making
|
2022-05-04 10:49:11 +02:00
|
|
|
|
|
|
|
## Generic instructions
|
|
|
|
|
|
|
|
Do this once, when starting with meta.sr.ht:
|
|
|
|
|
2022-08-04 16:54:43 +02:00
|
|
|
* Check out [meta.sr.ht](https://git.sr.ht/~sircmpwn/meta.sr.ht) and
|
|
|
|
[core.sr.ht](https://git.sr.ht/~sircmpwn/core.sr.ht). Make sure to clone with
|
|
|
|
`--recurse-submodules`.
|
2022-05-04 10:49:11 +02:00
|
|
|
* Copy meta.sr.ht's `config.example.ini` to `config.ini` and configure
|
|
|
|
everything following the instructions in the comments.
|
2022-08-04 16:54:43 +02:00
|
|
|
|
|
|
|
When filling in the `config.ini` file, remember the following:
|
|
|
|
|
|
|
|
* Some of the comments will ask you to run programs such as `srht-keygen` —
|
|
|
|
these can be found in the core.sr.ht repository.
|
|
|
|
* If you do not have SSL enabled for Postgres, be sure to add `?sslmode=disable`
|
|
|
|
to the end of your Postgres URL.
|
2022-05-04 10:49:11 +02:00
|
|
|
|
2022-11-14 10:16:47 +01:00
|
|
|
Then, for each `SERVICE` (e.g. `meta.sr.ht`):
|
2022-05-04 10:49:11 +02:00
|
|
|
|
|
|
|
* `export SRHT_PATH=/path/to/core.sr.ht/srht`
|
|
|
|
* `export PYTHONPATH=/path/to/core.sr.ht:/path/to/$SERVICE`
|
|
|
|
* `make all`
|
|
|
|
|
2022-08-04 16:54:43 +02:00
|
|
|
To avoid conflicts with the `email` package, you should now `unset PYTHONPATH`.
|
|
|
|
|
|
|
|
Note that core.sr.ht is not a service, but merely a repository of code shared
|
|
|
|
between services.
|
|
|
|
|
2022-05-04 10:49:11 +02:00
|
|
|
For each service *except* meta.sr.ht:
|
|
|
|
|
|
|
|
* Copy the service's section(s) from its `config.example.ini` into meta.sr.ht's
|
|
|
|
`config.ini`, modifying it according to the comments.
|
|
|
|
* `ln -s /path/to/meta.sr.ht/config.ini config.ini`
|
|
|
|
|
2022-05-11 21:24:53 +02:00
|
|
|
For each `SERVICE`:
|
|
|
|
|
2022-11-14 10:16:47 +01:00
|
|
|
* `createdb $SERVICE` (e.g. `createdb meta.sr.ht`)
|
2022-11-14 10:16:46 +01:00
|
|
|
* `psql -d $SERVICE -f schema.sql` (e.g. `psql -d meta.sr.ht -f schema.sql`)
|
2022-05-11 21:24:53 +02:00
|
|
|
|
2022-05-04 10:49:11 +02:00
|
|
|
To run a service:
|
|
|
|
|
2022-08-04 16:54:43 +02:00
|
|
|
* `./api/api` (must be run before the following command)
|
|
|
|
* `python3 run.py`
|
|
|
|
|
|
|
|
For the APIs to be able to talk to each other, you need to correctly register
|
|
|
|
each service as a client. You will find more instructions on the
|
|
|
|
meta.example.org/oauth page, as well as in the [OAuth
|
|
|
|
Reference](https://man.sr.ht/meta.sr.ht/oauth-api.md). After you have created
|
|
|
|
the OAuth clients, find each respective database entry in the `oauthclient`
|
|
|
|
table, and set the `preauthorized` column to `TRUE` for each one.
|
2020-11-02 19:37:28 +01:00
|
|
|
|
|
|
|
# Sending Patches
|
2020-03-26 15:25:20 +01:00
|
|
|
|
|
|
|
We use [git send-email](https://git-send-email.io) and discuss patches (and
|
|
|
|
other development topics) on the
|
|
|
|
[sr.ht-dev](https://lists.sr.ht/~sircmpwn/sr.ht-dev) list. Please send your
|
|
|
|
patches and development questions there.
|