💾 Archived View for rawtext.club › ~abrahms › gemlog › sr-ht-hacking.gmi captured on 2023-07-10 at 14:44:13. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-05)

-=-=-=-=-=-=-

Hacking on sr.ht

This is a guide I'm building on how to hack on sr.ht. One doesn't really exist and I figure I'll puzzle it out and post about it.

Despite being a python project, the system doesn't work with pip or virtualenv. Instead, they encourage folks to install things globally in an Alpine system. As part of this I'm setting up a container for this purpose via LXC. I've installed LXC using [these instructions].

Setup the container:

lxc launch images:alpine/3.12 a1

Add their repository to your alpine image and get the latest info.

echo 'https://mirror.sr.ht/alpine/v3.12/sr.ht' > /tmp/repo
cat /etc/apk/repositories >> /tmp/repo
mv /tmp/repo /etc/apk/repositories
apk update

Add their package signing key

wget -q -O /etc/apk/keys/alpine@sr.ht.rsa.pub https://mirror.sr.ht/alpine/alpine@sr.ht.rsa.pub

Install some dependency packages.

apk add postgresql redis make sassc gcc python3-dev musl-dev zlib-dev jpeg-dev gnupg

And also everything listed in the [apk build file].

apk add py-setuptools nodejs-npm git py3-alembic py3-celery py3-humanize py3-mistletoe py3-pgpy py3-sqlalchemy-utils py3-bleach py3-cryptography py3-flask py3-html5lib   py3-prometheus-client py3-psycopg2 py3-pygments py3-redis py3-requests py3-soupsieve py3-sqlalchemy  py3-beautifulsoup4

Download the source code and the git submodules.

git clone https://git.sr.ht/~sircmpwn/core.sr.ht
cd core.sr.ht
git submodule update --init

Build & setup the core repo

python3 setup.py build
python3 setup.py develop

Get meta

git clone https://git.sr.ht/~sircmpwn/meta.sr.ht
cd meta.sr.ht
python setup.py build
python setup.py develop

Setup your databases

rc-service postgresql start
rc-service redis start
psql --user postgres --host localhost
# At the prompt, type:
create database "meta.sr.ht";

You need a GPG key to theoretically sign emails. Accept all defaults. No password.

gpg --quick-generate-key meta
gpg --export -a > /etc/sr.ht/gpg.pub
gpg --export-secret-key -a > /etc/sr.ht/gpg.priv

Config:

mkdir /etc/sr.ht/
cp config.example.ini /etc/sr.ht/config.ini
../core.sr.ht/srht-keygen service
../core.sr.ht/srht-keygen network
../core.sr.ht/srht-keygen webhook
vi /etc/sr.ht/config.ini # add in the keys you've generated

Your redis-host should be set to `redis://localhost `.

You'll also want to set the `global-domain ` key to the IP address you'll be hosting it at, as the default configuration doesn't work with IP address hosting.

these instructions

apk build file