summaryrefslogtreecommitdiff
path: root/SETUP.md
blob: 6ec5e2a9a0c5b09ed041d1bb5d1ffc0e669e5f59 (plain)

Setting up source hosting

NB! Some system-specific strings are used which you may need to adapt depending on your local setup:

featureroot: /usr/local/share/feature/source-hosting

githost: {{githost}}

Prerequisites

Gitolite service need to know the public SSH key of its administrator. You can let it ask during install, but it may be more convenient to preconfigure that information instead.

On your local host, print your SSH public key e.g. with this command from your personal system (adapt to replace ed25519 if your SSH keypair use a different algorithm):

cat ~/.ssh/id_ed25519.pub

On the server, preconfigure git user with above public key (the whole line without newline) as $YOURKEY, and install needed packages:

echo gitolite3 gitolite3/adminkey select "$YOURKEY" | sudo debconf-set-selections
echo gitolite3 gitolite3/gituser select git | sudo debconf-set-selections
sudo apt install gitolite3 myrepos git-daemon-sysvinit cgit cmark highlight

Configure git access

On your local host, Clone the gitolite3 settings repository:

git clone git@{{githost}}:gitolite-admin

On your local host, edit the file gitolite.conf, e.g. add these likes to add repository "foobar":

FIXME

Enable hook

On the server, clone the redpill feature project for source-hosting and register with myrepos (to ease later update):

mkdir --parents /usr/local/share/redpill
cd /usr/local/share/redpill
git clone https://source.redpill.dk/source-hosting.git
mr reg

Edit the file /etc/gitolite3/gitolite.rc to have LOCAL_CODE point into the project cloned above, i.e. the line should look like this:

LOCAL_CODE =>  "/usr/local/share/redpill/source-hosting/lib/gitolite3",

Refresh gitolite setup by running this command:

sudo -u git gitolite setup

Web export

FIXME: move to separate feature

On the server, grant access for gitolite to write below /var/www with this command:

FIXME

On your local host, edit the file gitolite.conf to add FIXME to repos that should be exported for web publishing, e.g. add these likes to add repository "foobar":

FIXME

Configure web access

On the server, adapt the file /etc/default/git-daemon:

GIT_DAEMON_ENABLE=true
GIT_DAEMON_USER=gitdaemon
GIT_DAEMON_BASE_PATH=/srv/git
GIT_DAEMON_DIRECTORY=/srv/git/{{githost}}

# Additional options that are passed to the Daemon.
GIT_DAEMON_OPTIONS="--interpolated-path=/srv/git/%H/%D --user-path=public_git --export-all"

Adapt the file /etc/cgitrc:

css=/cgit-css/cgit.css
logo=/cgit-css/cgit.png

include=/usr/local/share/feature/source-hosting/source-hosting/etc/cgitrc