Installing Pagure.md 3.8 KB

This document is a reference for installing Pagure.

We're gonna use the user "git":

adduser git
su - git

Download Pagure into /home/git/pagure following the instructions at https://pagure.io/pagure#manually. Create a Python virtual environment in /home/git/pagure_env.

Create a local folder for storing all the stuff relevant to this instance. It will contain repositories, configuration files, etc.:

mkdir /home/git/pagure_local
cp pagure/files/alembic.ini pagure_local
cp pagure/pagure/files/pagure.cfg.sample pagure_local/config.py
vim pagure_local/alembic.ini
vim pagure_local/config.py

Make sure to edit pagure_local/alembic.ini and pagure_local/config.py before moving on. Pagure defaults to gitolite3 backend. Make sure to replace GIT_AUTH_BACKEND with either "pagure_authorized_keys" or "pagure". More info.

Now we need to initialize the Pagure database:

source pagure_env/bin/activate
cd pagure
python createdb.py --config ../pagure_local/config.py --initial ../pagure_local/alembic.ini

Now we need to do a couple of changes in pagure/hooks/files/hookrunner. This script is automatically set up by Pagure as a repository hook (inside .git repositories) and is triggered when PUSHing. These changes are required to initialize the correct virtual environment (it's probably not necessary if using a global installation of python instead of Python's virtualenv):

- change #! path to the python binary in the virtual environment
- change sys.insert(0, '/path/to/your/pagure')
- add this ENVVAR
    if 'FORGEFED_WORKER' not in os.environ:
        os.environ['FORGEFED_WORKER'] = "false"

Install Redis. It's used by Pagure as the broker for server-workers communication. In Debian just install Redis from the package manager.

We also need to install postfix because new users can only register via email confirmation. A basic configuration is available on Debian simply by installing the postfix package.

Now install the forgefed plugin, which has its own instructions (read the README).

Pagure has a main thread running the web app, and separate "worker" threads executing various tasks (for example projects forking happens asynchronously). There are some helper scripts in this repository for running Pagure. Look into the scripts directory.

Other

There is another document with instructions for Fedora here.

Deprecated

The following instructions were used for installing Pagure with Gitolite. However Gitolite is being progressively removed from Pagure in favor of a custom backend, so these instructions are only here for reference.

Create the ~/bin folder. In Debian, this should be immediately available in PATH at the next login. Otherwise it should be added to ~/.profile, ~/.bashrc or similar files:

mkdir ~/bin

Create a ssh key for the user that will administer Gitolite, and copy the .pub key to /home/git/git.pub

ssh-keygen

Install Gitolite after switching to tag 3.6.7. Newer versions do not work for some reason... With newer versions, when a user creates a new repository Gitolite will not pick it up from the conf/gitolite.conf file so it cannot be used via SSH. https://github.com/sitaramc/gitolite#server-requirements

Prevent Gitolite from changing the link of the update hook in the users' repos:

vim ~/bin/lib/Gitolite/Conf/Store.pm

Comment out this line:

# override/propagate gitolite defined hooks for all repos
ln_sf( "$rc{GL_ADMIN_BASE}/hooks/common", "*", "$repo.git/hooks" );

SPDX-FileCopyrightText: 2020-2021 zPlus zplus@peers.community SPDX-License-Identifier: GPL-2.0-only