aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeer <himbeerserverde@gmail.com>2024-02-17 18:25:37 +0100
committerHimbeer <himbeerserverde@gmail.com>2024-02-17 18:25:37 +0100
commitdcb2272e45b5c70ea6c69167a8957ee7cc6e0217 (patch)
treeadf1c42e8130dcf8f0e9a6e1a4da78881f9e406b
parent3a8bafb03a656dad9b782fcd7025f0da6e4aba99 (diff)
undocker www, merging gitweb and httpmux
-rw-r--r--Dockerfile2
-rw-r--r--README.md29
-rw-r--r--compose.yml21
-rwxr-xr-xinstall.sh8
-rw-r--r--lib.sh6
-rw-r--r--static/himbeerlogo.pngbin0 -> 18523 bytes
-rw-r--r--sys/etc/caddy/Caddyfile (renamed from Caddyfile)23
-rw-r--r--sys/etc/cgitrc71
-rwxr-xr-xuninstall.sh8
9 files changed, 136 insertions, 32 deletions
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 6e478b9..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,2 +0,0 @@
-FROM caddy:2.7.4-alpine
-COPY static/ /srv/caddy
diff --git a/README.md b/README.md
index 4c90315..3ddd3ec 100644
--- a/README.md
+++ b/README.md
@@ -3,15 +3,32 @@
Himbeerserver v3, formerly known as
[www.himbeerserver.de](https://github.com/HimbeerserverDE/www.himbeerserver.de).
-This is a simple static markdown website powered by caddy.
+This is a simple static markdown website and cgit instance powered by caddy.
No JavaScript is used, but there is a global CSS stylesheet.
-Unlike the previous v3 this build is designed to run in a container.
-Packaging for distro package managers again is not planned.
+The `sys` directory contains the filesystem structure to copy to the rootfs.
+This repository should be cloned to `/srv/www`.
+The `install.sh` script contains symlinks for configuration files to `/srv/www`,
+overwriting existing files.
+The `uninstall.sh` script removes them again without restoring the original files.
+
+## Required system packages
+
+Alpine:
+
+```
+apk add caddy-openrc cgit python3 py3-markdown py3-pygments
+```
+
+## Required caddy plugins
+
+cgit requires regular CGI (not fastcgi):
+
+```
+caddy add-package github.com/aksdb/caddy-cgi/v2
+```
## HTTPS
-This image does not support HTTPS and is not exposed to the internet.
-You should use [httpmux](https://github.com/HimbeerserverDE/httpmux)
-to handle this.
+This configuration handles HTTPS setup automatically.
diff --git a/compose.yml b/compose.yml
deleted file mode 100644
index ac34450..0000000
--- a/compose.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-networks:
- httpsvc:
- name: httpsvc
- external: true
-services:
- www:
- build: .
- container_name: www
- networks:
- - httpsvc
- volumes:
- - type: bind
- source: Caddyfile
- target: /etc/caddy/Caddyfile
- - www_config:/config
- - www_data:/data
- restart: unless-stopped
-volumes:
- www_config:
- www_data:
- external: true
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..e26db42
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+source /srv/www/lib.sh
+
+FILES=$(get_files)
+for FILE in ${FILES}; do
+ ln -sf "/srv/www/sys/${FILE}" "/${FILE}"
+done
diff --git a/lib.sh b/lib.sh
new file mode 100644
index 0000000..0512bc8
--- /dev/null
+++ b/lib.sh
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+get_files() {
+ FILES=(etc/cgitrc etc/caddy/Caddyfile)
+ return ${FILES}
+}
diff --git a/static/himbeerlogo.png b/static/himbeerlogo.png
new file mode 100644
index 0000000..48751ac
--- /dev/null
+++ b/static/himbeerlogo.png
Binary files differ
diff --git a/Caddyfile b/sys/etc/caddy/Caddyfile
index 29ada01..165aa31 100644
--- a/Caddyfile
+++ b/sys/etc/caddy/Caddyfile
@@ -1,9 +1,11 @@
{
- auto_https off
+ order cgi before respond
}
-http://himbeerserver.de {
- root * /srv/caddy
+himbeerserver.de {
+ reverse_proxy /_matrix/* localhost:8008
+
+ root * /srv/www/static
file_server
templates
@@ -44,3 +46,18 @@ http://himbeerserver.de {
}
}
}
+
+www.himbeerserver.de {
+ redir {scheme}://himbeerserver.de{uri} permanent
+}
+
+git.himbeerserver.de {
+ handle_path /cgit/* {
+ root * /usr/share/webapps/cgit
+ file_server
+ }
+
+ handle {
+ cgi * /usr/share/webapps/cgit/cgit.cgi
+ }
+}
diff --git a/sys/etc/cgitrc b/sys/etc/cgitrc
new file mode 100644
index 0000000..34113a6
--- /dev/null
+++ b/sys/etc/cgitrc
@@ -0,0 +1,71 @@
+css=/usr/share/websapps/cgit/cgit.css
+logo=/srv/www/static/himbeerlogo.png
+favicon=/srv/www/static/favicon.ico
+
+enable-index-links=1
+enable-index-owner=0
+enable-commit-graph=1
+enable-blame=1
+enable-log-filecount=1
+enable-log-linecount=1
+
+branch-sort=age
+repository-sort=age
+
+clone-url=git://himbeerserver.de/$CGIT_REPO_URL https://git.himbeerserver.de/$CGIT_REPO_URL
+root-title=HimbeerGit
+root-desc=Mirrors of several of my GitHub projects.
+
+##
+## List of common mimetypes
+##
+mimetype.gif=image/gif
+mimetype.html=text/html
+mimetype.jpg=image/jpeg
+mimetype.jpeg=image/jpeg
+mimetype.pdf=application/pdf
+mimetype.png=image/png
+mimetype.svg=image/svg+xml
+
+# Enable syntax highlighting
+source-filter=/usr/lib/cgit/filters/syntax-highlighting.py
+
+# Format markdown, restructuredtext, manpages, text files, and html files
+# through the right converters
+about-filter=/usr/lib/cgit/filters/about-formatting.sh
+
+##
+## Search for these files in the root of the default branch of repositories
+## for coming up with the about page:
+##
+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
+
+robots=noindex, nofollow
+include=/srv/git/repos.list
diff --git a/uninstall.sh b/uninstall.sh
new file mode 100755
index 0000000..3fbaaad
--- /dev/null
+++ b/uninstall.sh
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+source /srv/www/lib.sh
+
+FILES=$(get_files)
+for FILE in ${FILES}; do
+ rm "/${FILE}"
+done