aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--cgit/cgitrc119
-rw-r--r--cgit/docker-compose.yml10
-rw-r--r--cgit/httpd-cgit.conf32
-rwxr-xr-xklaus/Dockerfile12
-rwxr-xr-xklaus/app.py24
-rwxr-xr-xklaus/docker-compose.yml18
-rwxr-xr-xklaus/klaus.css288
-rwxr-xr-xklaus/requirements.txt2
-rwxr-xr-xmake_repo.py24
10 files changed, 167 insertions, 365 deletions
diff --git a/README.md b/README.md
index 12ace01..b8bf04c 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,3 @@ It is recommended to make symlinks to the home directory- e.g.:
Then repositories can be created with `ssh git@git.eda.gay "./make_repo"` or removed with `ssh git@git.eda.gay "./rm_repo"`.
-## Web UI
-
-Repositories that are set to public are rendered using [klaus](https://github.com/jonashaag/klaus), using a custom CSS file and Dockerfile. This is in the `klaus/` directory.
diff --git a/cgit/cgitrc b/cgit/cgitrc
new file mode 100644
index 0000000..11536f8
--- /dev/null
+++ b/cgit/cgitrc
@@ -0,0 +1,119 @@
+enable-http-clone=1
+
+snapshots=tar.gz zip
+enable-git-config=1
+cache-size=1000
+
+root-title=Eden's personal git server
+root-desc=Warning: Bad code lies henceforth
+repository-sort=age
+
+# Start all URLs from the root mimetype.gif=image/gif
+mimetype.htm=text/html
+mimetype.html=text/html
+mimetype.ico=image/x-icon
+mimetype.jpg=image/jpeg
+mimetype.jpeg=image/jpeg
+mimetype.md=text/markdown
+mimetype.mng=video/x-mng
+mimetype.ora=image/openraster
+mimetype.pam=image/x-portable-arbitrarymap
+mimetype.pbm=image/x-portable-bitmap
+mimetype.pdf=application/pdf
+mimetype.pgm=image/x-portable-graymap
+mimetype.png=image/png
+mimetype.pnm=image/x-portable-anymap
+mimetype.ppm=image/x-portable-pixmap
+mimetype.svg=image/svg+xml
+mimetype.svgz=image/svg+xml
+mimetype.tga=image/x-tga
+mimetype.tif=image/tiff
+mimetype.tiff=image/tiff
+mimetype.webp=image/webp
+mimetype.xbm=image/x-xbitmap
+mimetype.xcf=image/x-xcf
+mimetype.xpm=image/x-xpixmap
+
+virtual-root=/
+css=/cgit-data/cgit.css
+logo=/cgit-data/cgit.png
+favicon=/cgit-data/favicon.ico
+source-filter=/usr/libexec/cgit/filters/syntax-highlighting.sh
+about-filter=/usr/libexec/cgit/filters/about-formatting.sh
+readme=:README.md
+readme=:README
+readme=:readme.md
+readme=:README.rst
+readme=:README.md
+readme=:readme.md
+readme=:README.mkd
+readme=:readme.mkd
+readme=:README.rst
+readme=:readme.rst
+readme=:README.html
+readme=:readme.html
+readme=:README.htm
+readme=:readme.htm
+readme=:README.txt
+readme=:readme.txt
+readme=:README
+readme=:readme
+readme=:INSTALL.md
+readme=:install.md
+readme=:INSTALL.mkd
+readme=:install.mkd
+readme=:INSTALL.rst
+readme=:install.rst
+readme=:INSTALL.html
+readme=:install.html
+readme=:INSTALL.htm
+readme=:install.htm
+readme=:INSTALL.txt
+readme=:install.txt
+readme=:INSTALL
+readme=:install
+
+# Show extra links for each repository on the index page
+enable-index-links=1
+
+# Show owner
+enable-index-owner=1
+
+# Enable ASCII art commit history graph on the log pages
+enable-commit-graph=1
+
+# Allow http transport git clone
+enable-http-clone=1
+
+# Show number of affected files per commit on the log pages
+enable-log-filecount=1
+
+# Show number of added/removed lines per commit on the log pages
+enable-log-linecount=1
+
+# Enable statistics per week, month and quarter
+max-stats=quarter
+
+# Sort items in the repo list case sensitively. Default value: "1"
+case-sensitive-sort=1
+
+# Specifies the maximum size of a blob to display HTML for in KBytes. Default value: "0" (limit disabled)
+max-blob-size=2048
+
+# Specifies the number of entries to list per page on the repository index page. Default value: "50".
+max-repo-count=250
+
+
+# Specifies the maximum number of repo description characters to display on the repository index page.
+# Default value: "80"
+max-repodesc-length=80
+
+# Set the default maximum statistics period. Valid values are "week", "month", "quarter" and "year".
+# If unspecified, statistics are disabled. Default value: none
+max-stats=year
+
+include=/etc/cgitrepos
+remove-suffix=1
+enable-blame=1
+clone-prefix=https://git.reaweb.uk ssh://git@git.reaweb.uk
+
diff --git a/cgit/docker-compose.yml b/cgit/docker-compose.yml
new file mode 100644
index 0000000..88c6eb9
--- /dev/null
+++ b/cgit/docker-compose.yml
@@ -0,0 +1,10 @@
+cgit:
+ image: docker.io/clearlinux/cgit
+ ports:
+ - 8022:80
+ volumes:
+ - /srv/git:/srv/git
+ - ./cgitrc:/etc/cgitrc
+ - ../../cgitrepos:/etc/cgitrepos
+ - ./httpd-cgit.conf:/etc/httpd/conf.d/httpd-cgit.conf
+ restart: unless-stopped
diff --git a/cgit/httpd-cgit.conf b/cgit/httpd-cgit.conf
new file mode 100644
index 0000000..9cc2153
--- /dev/null
+++ b/cgit/httpd-cgit.conf
@@ -0,0 +1,32 @@
+ServerName localhost
+
+# Next two lines changed for new document root
+DocumentRoot /srv/git
+<Directory "/srv/git">
+ AllowOverride None
+ Options ExecCGI FollowSymLinks
+ Require all granted
+</Directory>
+
+# cgid module is required to run the cgit binary
+LoadModule cgid_module lib/httpd/modules/mod_cgid.so
+<IfModule cgid_module>
+ ScriptSock /var/run/cgid.sock
+</IfModule>
+
+# Path to cgit stylesheet, graphics
+Alias /cgit-data /usr/share/cgit
+<Directory "/usr/share/cgit">
+ AllowOverride None
+ Options None
+ Require all granted
+</Directory>
+
+# Path to cgit binary
+# Next line changed
+ScriptAlias / /usr/libexec/cgit/cgi-bin/cgit/
+<Directory "/usr/libexec/cgit/cgi-bin">
+ AllowOverride None
+ Options None
+ Require all granted
+</Directory>
diff --git a/klaus/Dockerfile b/klaus/Dockerfile
deleted file mode 100755
index c5a901f..0000000
--- a/klaus/Dockerfile
+++ /dev/null
@@ -1,12 +0,0 @@
-FROM jonashaag/klaus:latest
-MAINTAINER Eden Attenborough "eda@e.email"
-ENV TZ=Europe/London
-RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
-
-COPY ./klaus.css /usr/lib/python3.10/site-packages/klaus/static
-COPY . /app
-WORKDIR /app
-RUN pip3 install -r requirements.txt
-ENTRYPOINT ["python3"]
-CMD ["app.py"]
-
diff --git a/klaus/app.py b/klaus/app.py
deleted file mode 100755
index 6b2205e..0000000
--- a/klaus/app.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import configparser
-import waitress
-import klaus
-import os
-
-def get_repo_paths(metadata_path):
- repo_paths = []
- for filename in os.listdir(metadata_path):
- if filename.endswith(".git.conf"):
- meta = configparser.ConfigParser()
- meta.read(os.path.join(metadata_path, filename))
- repo_name = filename[:-5]
-
- if meta.getboolean(repo_name, "visible"):
- repo_paths.append(meta.get(repo_name, "path"))
-
- return repo_paths
-
-if __name__ == "__main__":
- repositories = get_repo_paths("/srv/repos")
- print("Using repository paths: %s" % " ".join(repositories))
- app = klaus.make_app(repositories, "Eden's git server - Repositories")
- waitress.serve(app, host = "0.0.0.0", port = 80, threads = int(os.environ["APP_THREADS"]))
-
diff --git a/klaus/docker-compose.yml b/klaus/docker-compose.yml
deleted file mode 100755
index 4068b33..0000000
--- a/klaus/docker-compose.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-version: '3'
-
-services:
- klaus:
- container_name: klaus
- build:
- context: .
- dockerfile: Dockerfile
- image: jwansek/klaus
- user: "1002:1000"
- environment:
- - APP_THREADS=4
- volumes:
- - '/media/git:/srv/git:ro'
- - '/media/gitwww/repositories:/srv/repos:ro'
- ports:
- - '81:80'
- restart: always
diff --git a/klaus/klaus.css b/klaus/klaus.css
deleted file mode 100755
index b73ea2a..0000000
--- a/klaus/klaus.css
+++ /dev/null
@@ -1,288 +0,0 @@
-@charset "utf-8";
-
-body, header, #content { overflow: auto; }
-
-/* Reset */
-body { margin: 0; padding: 0; font-family: sans-serif; }
-a, a:visited { color: #003278; text-decoration: none; }
-a:hover { text-decoration: underline; }
-table { border-spacing: 0; border-collapse: collapse; }
-
-h2 > span:last-of-type { font-size: 60%; }
-h2 > code:last-of-type {
- font-size: 60%;
- margin-left: 2%;
-}
-
-.clearfloat { clear: both; }
-
-.hastooltip { cursor: help; }
-.separated-by-dots > span:not(:first-child):before { content: '·'; margin: 0 3px 0 5px; }
-
-.slash { color: #666; margin: 0 -0.2em; }
-
-.history ul, .repolist, .tree ul, .branch-selector ul {
- list-style-type: none;
- padding-left: 0;
-}
-
-/* Header */
-header { font-size: 90%; padding: 0.5%; border-bottom: 3px solid #e0e0e0; }
-header a { padding: 0.5% 0; }
-header .breadcrumbs > span:before { content: ' » '; color: #666; }
-header .slash { margin: 0 -2px; }
-
-
-/* Branch/tag selector */
-.branch-selector {
- position: absolute;
- top: 2px;
- right: 2px;
- font-size: 90%;
- background-color: #fefefe;
-}
-.branch-selector > * {
- background-color: #fcfcfc;
- position: relative;
-}
-.branch-selector > span {
- border: 1px solid #f1f1f1;
- padding: 4px 5px;
- float: right;
-}
-.branch-selector > span:after { content: "☟"; margin-left: 5px; }
-.branch-selector > span:hover { background-color: #fefefe; cursor: pointer; }
-.branch-selector div {
- z-index: 1;
- clear: both;
- display: none;
-}
-.branch-selector ul {
- margin: 0;
-}
-.branch-selector ul + ul {
- border-top: 1px solid #e0e0e0;
-}
-.branch-selector li a {
- display: block;
- padding: 4px 5px;
- border-bottom: 1px solid #f1f1f1;
-}
-.branch-selector li:first-child a { border-top: 1px solid #f1f1f1; }
-.branch-selector li a:hover { background-color: #fefefe; }
-.branch-selector li:last-child a { border: 0; }
-.branch-selector:hover { border: 1px solid #ccc; }
-.branch-selector:hover > span { border: 0; background-color: inherit; }
-.branch-selector:hover div { display: block; }
-
-/* Footer */
-footer {
- clear: both;
- font-size: 80%;
- float: right;
- color: #666;
- padding: 50px 5px 5px 0;
-}
-footer a { color: inherit; border-bottom: 1px dotted #666; }
-footer a:hover { text-decoration: none; }
-
-
-/* Container */
-#content {
- padding: 10px 15% 0 15%;
-}
-#content > div:nth-of-type(1),
-#content > div:nth-of-type(2) { float: left; }
-#content > div:nth-of-type(1) { width: 24%; }
-#content > div:nth-of-type(2) { width: 72%; margin-left: 1.5%; }
-
-
-/* Pagination */
-.pagination { float: right; margin: 0; font-size: 90%; }
-.pagination > * {
- border: 1px solid;
- padding: 2px 10px;
- text-align: center;
-}
-.pagination .n { font-size: 90%; padding: 1px 5px; position: relative; top: 1px; }
-.pagination > a { opacity: 0.6; border-color: #6491bf; }
-.pagination > a:hover { opacity: 1; text-decoration: none; border-color: #4D6FA0; }
-.pagination span { color: #999; border-color: #ccc; }
-
-
-/* Repo List */
-.repolist { margin-left: 2em; font-size: 120%; }
-.repolist li { margin-bottom: 10px; }
-.repolist li a .last-updated {
- color: #737373;
- font-size: 60%;
- margin-left: 1px;
-}
-.repolist li a .description {
- color: black;
- font-size: 75%;
- margin-left: 1px;
-}
-.repolist li a:hover { text-decoration: none; }
-.repolist li a:hover .name { text-decoration: underline; }
-
-.invalid { color: red; }
-.invalid .reason {
- color: #737373;
- font-size: 60%;
- margin-left: 1px;
-}
-
-/* Base styles for history and commit views */
-.commit {
- display: block;
- margin-bottom: 2px;
- padding: 8px 10px;
- background-color: #f9f9f9;
- border: 1px solid #e0e0e0;
-}
-.commit:hover { text-decoration: none; }
-
-.commit > span { display: block; }
-
-.commit .line1 { font-family: monospace; padding-bottom: 2px; line-height: 1.3; }
-.commit .line1 span { white-space: pre-wrap; text-overflow: hidden; }
-.commit:hover .line1 { text-decoration: underline; color: #aaa; }
-.commit:hover .line1 span { color: black; }
-
-.commit .line2 { position: relative; top: 5px; left: 1px; }
-.commit .line2 > span:first-child { float: left; }
-.commit .line2 > span:nth-child(2) { float: right; }
-.commit .line2 { color: #737373; font-size: 80%; }
-
-
-/* History View */
-.history .pagination { margin-top: -2em; }
-a.commit { color: black !important; }
-
-.tree ul { font-family: monospace; border-top: 1px solid #e0e0e0; }
-.tree li { background-color: #f9f9f9; border: 1px solid #e0e0e0; border-top: 0; }
-.tree li a {
- padding: 5px 7px 6px 7px;
- display: block;
- color: #001533;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-}
-.tree li a:before {
- margin-right: 5px;
- position: relative;
- top: 2px;
- opacity: 0.7;
- content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAPCAYAAADUFP50AAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGBhMmAbS/QqsAAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAAANBJREFUKM+Vkj2OgzAQhb8HSLupkKiQD8DPWbZMkSMgLsF9IlLmMpiKA9CncraIQGbXIPGqsec9faOx1TTNwxhz5YT6vr8lxphr13Wc1D1Zqnmecc4BIGl1LLUk4jgmTVMA1qBzDmvtxuhLEnVdr+fEb5ZleUj0lfgGn/hXh8SiKAKEF+/3F1EUhYkA4zhumlVVARfgBXzvjxoiSkK6/Bt9Q7TWHi7lM8HOVsNE7RMlMQxDkLRs078LEkPh3XfMsuzUZ1Xbts88z3/OhKZpuv8CNeMsq6Yg8OoAAAAASUVORK5CYII=);
-}
-.tree li a.dir:before {
- content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAPCAYAAADtc08vAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGBhMiMxgE1i8AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAAAYxJREFUKM+l0r1KXEEYxvH/bNS4K2RNCjsRBAlqITESI0QCuqBdWLwACSJaiZILiDcQkDRql8oUIqkkkRTRwiKVyvoRV5HFEFEX/DjomePsmfNauB4xrLAmD1PNML95eBnV0Fj/vjPRMcpfMcYAMP9jYXDzV3qSO1LSmegYfdvbV/DQ8zS+709oVzu7u78/FwQAHOeU9Y31gsjz5hYcx5lqbXsxdb23ld4eW15aGQmBaDRGZfzxXS1JvukBQCmFUoqZL9PDIWCMQWuX76tnpLIxisqjJC39SXmoM5thg1Q2xsd3XXjGFmWUlz1g6MPc0xIArV0A9o89dg7PiwJqqyoAiHieRzRaZPUCibiuGzb4J+B6Bv8F3LeBtQFeznLrH5RGAgQQEZRSiAgiEIhgrZCzAcYXLnxLzgrxirIbQGuXmvgFR2eGP0caRBEg5BciIAgieRjwrdwAB9lDnrW9Yjlzkr909boIBAiCApGwVWvdE+a+fkOvzX5STd0D86XV7a/vOzy7t/hzaXb85SVDycBfkNNgmgAAAABJRU5ErkJggg==);
-}
-
-
-/* Blob, Blame, Diff, Markup View */
-.line { display: block; }
-.linenos { background-color: #f9f9f9; text-align: right; }
-.linenos a { color: #888; }
-.linenos a:hover { text-decoration: none; }
-.highlight-line, .highlight-line .line { background-color: #fefed0; }
-.linenos a { padding: 0 6px 0 6px; }
-.markup table, .markup img, .markup pre { border: 1px solid #e0e0e0; }
-.markup table { min-width: 100%; }
-.markup img { max-width: 100%; padding: 1px; }
-.markup pre {
- padding: 10px 12px;
- background-color: #f9f9f9;
-}
-
-
-/* Blob, Blame View */
-.blobview table, .blameview table { min-width: 100%; }
-.blobview table, .blameview table { border: 1px solid #e0e0e0; }
-.blobview .code, .blameview .code { padding: 0; width: 100%; }
-.blobview .code .line, .blameview .code .line { padding: 0 5px 0 10px; }
-.blobview .code a, .blameview .code a { color: inherit; }
-.blobview .linenos, .blameview .linenos { border: 1px solid #e0e0e0; padding: 0; }
-
-
-/* Blob View */
-.blobview .markup { border: 1px solid #e0e0e0; }
-.blobview .markup h1:first-child { margin-top: 8px; }
-.blobview .markup { padding: 0 10px; }
-
-
-/* Blame View */
-.blameview .highlighttable { border-top: 0; border-bottom: 0; border-left: 0; }
-.blameview .linenos { border-top: 0; border-bottom: 0; border-left: 0; }
-.blameview .line-info a { padding: 0 6px 0 6px; }
-.blameview .line-info { background-color: #f9f9f9; }
-
-
-/* Commit View */
-.full-commit { width: 100% !important; margin-top: 10px; }
-
-.full-commit .commit { padding: 15px 20px; }
-.full-commit .commit .line1 { padding-bottom: 5px; }
-.full-commit .commit:hover .line1 { text-decoration: none; }
-.full-commit .commit .line2 > span { float: left; }
-
-.full-commit .summary { color: #737373; font-size: 80%; margin-top: 25px; }
-.full-commit .summary .additions { color: #008800; }
-.full-commit .summary .deletions { color: #ee4444; }
-
-.full-commit .file.collapsed > table { display: none; }
-
-.diff { font-family: monospace; }
-.diff .filename {
- padding: 8px 10px;
- background-color: #f9f9f9;
- border: 1px solid #e0e0e0;
- margin-top: 25px;
-}
-.diff .filename del { color: #999; }
-.diff .filename .summary { float: left; margin: -4px 15px 0 -5px; font-size: 80%; }
-.diff .filename .summary .additions { color: green; }
-.diff .filename .summary .deletions{ color: red; }
-
-.diff .togglers { float: right; }
-.diff .togglers a { opacity: 0.5; }
-.diff .file:not(.collapsed) .togglers .expand { display: none; }
-.diff .file.collapsed .togglers .collapse { display: none; }
-
-.diff table, .diff .emptydiff {
- border: 1px solid #e0e0e0;
- border-top: 0;
- background-color: #fdfdfd;
- display: block;
-}
-.diff .emptydiff {
- padding: 7px 10px;
-}
-.diff td {
- padding: 0;
- border-left: 1px solid #e0e0e0;
-}
-.diff td .line { padding: 1px 10px; display: block; min-height: 1.2em; white-space: pre-wrap; }
-.diff .linenos { font-size: 85%; padding: 0; vertical-align: top; }
-.diff .linenos a { display: block; padding-top: 1px; padding-bottom: 1px; }
-.diff td + td + td { width: 100%; }
-.diff tr:first-of-type td { padding-top: 7px; }
-.diff tr:last-of-type td { padding-bottom: 7px; }
-.diff table .del { background-color: #ffdddd; }
-.diff table .add { background-color: #ddffdd; }
-.diff table .no-newline-marker { font-size: 50%; margin-left: 5px; color: red; }
-.diff table del { background-color: #ee9999; text-decoration: none; }
-.diff table ins { background-color: #99ee99; text-decoration: none; }
-.diff .sep > td {
- height: 1.2em;
- text-align: center;
- background-color: #f9f9f9;
- border: 1px solid #e0e0e0;
-}
-.diff .sep:hover > td { background-color: #f9f9f9; }
-
-@media (max-width: 1023px) {
- #content { padding: 5px 1.5%; }
-}
diff --git a/klaus/requirements.txt b/klaus/requirements.txt
deleted file mode 100755
index dbdd421..0000000
--- a/klaus/requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-waitress
-
diff --git a/make_repo.py b/make_repo.py
index 0e2c9d1..ddd7f88 100755
--- a/make_repo.py
+++ b/make_repo.py
@@ -64,16 +64,12 @@ with ChangeCWD(repo_dir):
subprocess.run(["ln", "-s", os.path.join(os.path.dirname(conf_path), "post-receive-hook.sh"), os.path.join(repo_dir, "hooks", "post-receive")])
-repo_metadata_path = os.path.join(CONFIG.get("git", "repo_meta_path"), repo_name + ".conf")
-repo_metadata = configparser.ConfigParser()
-repo_metadata[repo_name] = {
- "name": repo_name,
- "path": repo_dir,
- "visible": not private,
- "url": repo_url
-}
-with open(repo_metadata_path, "w") as f:
- repo_metadata.write(f)
+if not private:
+ repo_metadata_path = os.path.join(CONFIG.get("git", "repo_meta_path"))
+ with open(repo_metadata_path, "a") as f:
+ f.write("repo.url=%s\n" % repo_name)
+ f.write("repo.path=%s\n" % repo_dir)
+ f.write("repo.desc=%s\n\n" % description)
if input("Would you like the repository to remain bare? Useful for making mirrors of Github repos. <y/n>: ").lower() != "y":
with tempfile.TemporaryDirectory() as tempdir:
@@ -119,14 +115,6 @@ if input("Would you like the repository to remain bare? Useful for making mirror
subprocess.run(["git", "commit", "-m", "Initialized repository"])
subprocess.run(["git", "push", "origin", "master"])
-# could do this with the docker API instead maybe
-proc = subprocess.Popen(CONFIG.get("git", "restart_ui_cmd").split(), stdout = subprocess.PIPE)
-while True:
- line = proc.stdout.readline()
- if not line:
- break
- print(line.decode())
-
print("""
Repository created. You can now clone or add remote: