From 8b00228bbf202f6982c4228892beede22bb27cca Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 14 Sep 2021 14:07:45 -0400 Subject: cgit --- cgit.html | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ index.html | 1 + pix/cgit.svg | 58 +++++++++++++++++++++++ rss.xml | 106 ++++++++++++++++++++++++++++++++++++++++- xmpp.html | 4 +- 5 files changed, 317 insertions(+), 3 deletions(-) create mode 100644 cgit.html create mode 100644 pix/cgit.svg diff --git a/cgit.html b/cgit.html new file mode 100644 index 0000000..2ca026d --- /dev/null +++ b/cgit.html @@ -0,0 +1,151 @@ + + + + + Setting up Cgit – LandChad.net + + + + + + + + +
+

Setting up Cgit

+ +
+
+

+ Once you have your server hosting your git repositories, you might want to allow others to browse + your repositories on the web. Cgit is a Free Software that allows browsing git repositories through + the web.

+ +

+ Note that Cgit is a read-only frontend for Git repositories and doesn't have issues, pull requests + or user management. If that's what you want, consider installing Gitea instead.

+ +

Installing cgit and fcgiwrap

+

Install fcgiwrap

+

+ NGINX doesn't have the capability to run CGI scripts by itself, it depends on an intermediate layer + like fcgiwrap to run CGI scripts like cgit:

+ +
apt install fcgiwrap
+ +

And now we can install cgit itself with:

+ +
apt install cgit
+ +

Setting up NGINX

+

+ You should have an NGINX server running with a TLS certificate by now. Add the following configuration + to your server to pass the requests to Cgit, while serving static files directly:

+ +

+server {
+	listen 443 ssl;
+	listen [::]:443 ssl;
+    ssl_certificate /etc/ssl/nginx/git.example.org.crt;
+    ssl_certificate_key /etc/ssl/nginx/git.example.org.key;
+    server_name git.example.org;
+
+	root /usr/share/cgit ;
+	try_files $uri @cgit ;
+
+	location @cgit {
+		include fastcgi_params;
+		fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
+		fastcgi_param PATH_INFO $request_uri;
+		fastcgi_param QUERY_STRING $query_string;
+		fastcgi_pass unix:/run/fcgiwrap.socket;
+	}
+}
+		
+ +

Then get NGINX to reload your configuration.

+ +

Configuring cgit

+

You've got cgit up and running now, but you'll probably see it without any style and without any repository. + To change this, we need to configure Cgit to our liking, by editing /etc/cgitrc. +

+ +

+css=/cgit.css
+logo=/cgit.svg
+virtual-root=/
+
+# Title and description shown on top of each page
+root-title=Chad's git server
+root-desc=A web interface to LandChad's git repositories, powered by Cgit
+
+# The location where git repos are stored on the server
+scan-path=/srv/git/
+		
+ +

This configuration assumes you followed the git hosting guide and store your repositories + on the /srv/git/ directory.

+ +

Cgit's configuration allows changing many settings, as documented on the cgitrc(5) manpage installed with + Cgit.

+ +

Changing the displayed repository owner

+ +

Cgit's main page shows each repo's owner, which is "git" in case you followed the git hosting guide, but you + might want to change the name to yours. Cgit shows the owner's system name, so you need to modify the git + user + to give it your name:

+ +

+usermod -c "Your Name" git
+		
+ +

Changing the repository description

+ +

Navigate to your bare repository on the server and edit the description file inside it

+ +

Displaying the repository idle time

+ +

To do this, we need to create a post-receive hook for each repository that updates the file cgit uses + to determine the idle time. Inside your repository, create a file hooks/post-receive and add + the following contents:

+ +

+#!/bin/sh
+
+agefile="$(git rev-parse --git-dir)"/info/web/last-modified
+
+mkdir -p "$(dirname "$agefile")" &&
+git for-each-ref \
+	--sort=-authordate --count=1 \
+	--format='%(authordate:iso8601)' \
+	>"$agefile"
+		
+ +

And give it execution permissions with:

+ +
chmod +x hooks/post-receive
+ +

Next time you push to that repository, the idle time should reset and show the correct value.

+ +

Contribution

+ +
+ + + + diff --git a/index.html b/index.html index f5bd05e..b5e9663 100644 --- a/index.html +++ b/index.html @@ -74,6 +74,7 @@ img { border: none ;}
Nextcloud
Setting up a Nextcloud Instance (file hosting and more)
Jitsi logo Jitsi
Free and easy video conferencing
git
Version control software on your own server
+
Cgit
A hyperfast web frontend for git repositories
Gitea
A fully-featured git and issue tracking site
IRC
Installing and managing a classic internet relay chat server
RSS Bridge
Creating RSS feeds for social media sites
diff --git a/pix/cgit.svg b/pix/cgit.svg new file mode 100644 index 0000000..72eafa6 --- /dev/null +++ b/pix/cgit.svg @@ -0,0 +1,58 @@ + + + + + + diff --git a/rss.xml b/rss.xml index 72a66ab..393aeb2 100644 --- a/rss.xml +++ b/rss.xml @@ -15,6 +15,110 @@ + +Setting up Cgit +https://landchad.net/cgit.html +https://landchad.net/cgit.html +Tue, 14 Sep 2021 14:06:48 -0400 + +

Setting up Cgit

+ + +
+

+ Once you have your server hosting your git repositories, you might want to allow others to browse + your repositories on the web. Cgit is a Free Software that allows browsing git repositories through + the web.

+

+ Note that Cgit is a read-only frontend for Git repositories and doesn't have issues, pull requests + or user management. If that's what you want, consider installing Gitea instead.

+

Installing cgit and fcgiwrap

+

Install fcgiwrap

+

+ NGINX doesn't have the capability to run CGI scripts by itself, it depends on an intermediate layer + like fcgiwrap to run CGI scripts like cgit:

+
apt install fcgiwrap
+

And now we can install cgit itself with:

+
apt install cgit
+

Setting up NGINX

+

+ You should have an NGINX server running with a TLS certificate by now. Add the following configuration + to your server to pass the requests to Cgit, while serving static files directly:

+

+server {
+	listen 443 ssl;
+	listen [::]:443 ssl;
+    ssl_certificate /etc/ssl/nginx/git.example.org.crt;
+    ssl_certificate_key /etc/ssl/nginx/git.example.org.key;
+    server_name git.example.org;
+	root /usr/share/cgit ;
+	try_files $uri @cgit ;
+	location @cgit {
+		include fastcgi_params;
+		fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
+		fastcgi_param PATH_INFO $request_uri;
+		fastcgi_param QUERY_STRING $query_string;
+		fastcgi_pass unix:/run/fcgiwrap.socket;
+	}
+}
+		
+

Then get NGINX to reload your configuration.

+

Configuring cgit

+

You've got cgit up and running now, but you'll probably see it without any style and without any repository. + To change this, we need to configure Cgit to our liking, by editing /etc/cgitrc. +

+

+css=/cgit.css
+logo=/cgit.svg
+virtual-root=/
+# Title and description shown on top of each page
+root-title=Chad's git server
+root-desc=A web interface to LandChad's git repositories, powered by Cgit
+# The location where git repos are stored on the server
+scan-path=/srv/git/
+		
+

This configuration assumes you followed the git hosting guide and store your repositories + on the /srv/git/ directory.

+

Cgit's configuration allows changing many settings, as documented on the cgitrc(5) manpage installed with + Cgit.

+

Changing the displayed repository owner

+

Cgit's main page shows each repo's owner, which is "git" in case you followed the git hosting guide, but you + might want to change the name to yours. Cgit shows the owner's system name, so you need to modify the git + user + to give it your name:

+

+usermod -c "Your Name" git
+		
+

Changing the repository description

+

Navigate to your bare repository on the server and edit the description file inside it

+

Displaying the repository idle time

+

To do this, we need to create a post-receive hook for each repository that updates the file cgit uses + to determine the idle time. Inside your repository, create a file hooks/post-receive and add + the following contents:

+

+#!/bin/sh
+agefile="$(git rev-parse --git-dir)"/info/web/last-modified
+mkdir -p "$(dirname "$agefile")" &&
+git for-each-ref \
+	--sort=-authordate --count=1 \
+	--format='%(authordate:iso8601)' \
+	>"$agefile"
+		
+

And give it execution permissions with:

+
chmod +x hooks/post-receive
+

Next time you push to that repository, the idle time should reset and show the correct value.

+

Contribution

+ +
+ +]]>
+
+ + Self hosting https://landchad.net/selfhosting.html @@ -340,7 +444,7 @@ systemctl start calibre-server

Dependencies and Installation

First, install some dependencies:

-
apt install gpg apt-transport-https nginx python-certbot-nginx
+
apt install gpg apt-transport-https nginx python3-certbot-nginx

Jitsi has its own package repository, so let's add it.

curl https://download.jitsi.org/jitsi-key.gpg.key | gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg
 echo 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list
diff --git a/xmpp.html b/xmpp.html
index 21841df..71fdbd4 100644
--- a/xmpp.html
+++ b/xmpp.html
@@ -51,10 +51,10 @@ Find the line that says admins = { } and to this we can specify one
 

# To add one admin:
-admins = { "chad@example.org" }
+admins = { "chad@example.org" }
 
 # We can add more than one by separating them by commas. (This file is written in Lua.)
-admins = { "chad@example.org", "chadmin@example.org" }
+admins = { "chad@example.org", "chadmin@example.org" }

Note that we have not created these accounts yet, we will do this below. -- cgit v1.2.3