Pagure on FreeBSD in Bastille powered Jail - Part 1

> posts > 2021 > Mar

Published: | Deutsch

A few months ago I started experimenting with FreeBSD and Jails managed by Bastille.

And tbh, I love it, simple, lightweight, it's just fun to work with, but that's a different Story for future Posts ;)

More important, I wanted to start self-host my Git repositories and to use Github, Gitlab, Codeberg and Notabug primary as Mirror. That should improve the visibility, compared to only self-hosting and help to reach potential contributors, independent of the Platform.

So I decided to setup Pagure, it's written in Python and seem to be the only Solution, that support pull requests from remote repositories.

But just installing the RPM Packages on a Supported OS like openSUSE or Fedora would be too easy ;)

This Project was therefore the perfect candidate, to get some more Hands on Experience with FreeBSD and Bastille.

I created a new Jail, mounted the Ports Tree from my FreeBSD Host and connected to the new Instance.

bastille create pagure 12.2-RELEASE bastille0
bastille mount pagure /usr/ports /usr/ports nullfs rw 0 0
bastille console pagure

Based on the Pagure Documentation and some research, I installed the following packages:

pkg install git libgit2 python3-3_3 apache24-2.4.46 py37-pip-20.2.3 py37-wheel-0.30.0_1 wget py37-pillow-7.0.0 py37-Flask-1.1.2 vim-tiny

The available libgit2 Port was to old and due to some further dependencies, an official update wasn't available yet, so I had to update it on my own. Further reading:


--- Makefile.orig       2021-03-10 23:58:49.921923000 +0100
+++ Makefile    2021-03-11 00:13:22.452236000 +0100
@@ -6,7 +6,7 @@
 # Tools/scripts/ devel/libgit2

 PORTNAME=      libgit2
 CATEGORIES=    devel

@@ -37,7 +37,7 @@
 .if ${SSL_DEFAULT} == base
        @${REINPLACE_CMD} -e "/LIBGIT2_PC_REQUIRES.*openssl/ d" \
-               ${WRKSRC}/cmake/Modules/SelectHTTPSBackend.cmake
+               ${WRKSRC}/cmake/SelectHTTPSBackend.cmake


Patch applied, compiled and installed:

patch -u -b Makefile -i Makefile.patch
make makesum
make install clean

Pagure Release 5.13.2 build and installed

mkdir src
cd src
git clone
cd pagure
git checkout -b 5.13.2 e1a8b5e4a2a347ab29de7cc21d9d2c89f55dd076

python3 build
python3 install

I wrote a little helper Script, to create some necessary folder structures and copy config files to the right location.

mkdir -p /usr/local/etc/pagure
mkdir -p /usr/local/share/pagure

cp pagure/files/pagure.cfg.sample /usr/local/etc/pagure/pagure.cfg
cp pagure/files/alembic.ini /usr/local/etc/pagure/alembic.ini
cp pagure/files/pagure-apache-httpd.conf /usr/local/etc/apache24/Includes/pagure.conf
cp pagure/files/pagure.wsgi /usr/local/share/pagure/pagure.wsgi
cp pagure/ /usr/local/share/pagure/

mkdir -p /usr/local/www/apache24/data/releases
chown git:git /usr/local/www/apache24/data/releases

mkdir -p /usr/local/git/repositories/{docs,forks,tickets,requests,remotes}

Dedicated Git User and Group created, would be cool in one single command, but that's not yet implemented

pw group add -n git
pw user add -n git -d /usr/local/git -c "Pagure Git User" -g git

That's all I have so far, unfortunately there wasn't enough time to finish the Installation.

Next Step based on the Pagure Install Guide is to set specific ACLs, but the syntax between Linux and FreeBSD differ, first I have to figure out how to adapt them.

Also there might be further adjustments required until Pagure is working as expected and behave similar as on a Linux system.

As soon I find some time to proceed, I will publish Part 2.

[ Show Source | Download PDF ]