add default configs and s6-overlay
Some checks failed
/ release-and-build (push) Failing after 14s

This commit is contained in:
2026-02-24 17:10:16 +01:00
parent 05e77cf79c
commit 98e6dc77ee
24 changed files with 194 additions and 61 deletions

View File

@@ -0,0 +1,21 @@
#!/bin/sh
# make sure we never run 2 rsync at the same time
lockfile="/tmp/alpine-mirror.lock"
if [ -z "$flock" ] ; then
exec env flock=1 flock -n $lockfile "$0" "$@"
fi
src=rsync://rsync.alpinelinux.org/alpine/
dest=/app/www/alpine/
exclude="--exclude v2.* --exclude v3.23 --exclude v3.1 --exclude v3.2 --exclude v3.3 --exclude v3.4 --exclude v3.5 --exclude v3.6 --exclude v3.7 --exclude v3.8 --exclude v3.9 --exclude v3.10 --exclude v3.11 --exclude v3.12 --exclude v3.13 --exclude v3.14 --exclude v3.15 --exclude>
mkdir -p "$dest"
/usr/bin/rsync \
--archive \
--update \
--hard-links \
--delete \
--delete-after \
--delay-updates \
--timeout=600 \
$exclude \
"$src" "$dest"

View File

@@ -0,0 +1,25 @@
server.document-root = "/app/www/alpine"
server.port = 80
server.username = "pi"
server.groupname = "users"
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png",
".css" => "text/css",
".js" => "application/x-javascript",
".svg" => "image/svg+xml"
)
dir-listing.activate = "enable"
server.modules += ( "mod_access", "mod_accesslog", "mod_setenv" )
index-file.names = ( "index.html" )
server.event-handler = "linux-sysepoll"
setenv.add-response-header += (
"Cache-Control" => "must-revalidate"
)

View File

@@ -0,0 +1,4 @@
[alpine]
path = /app/www/alpine
comment = My Alpine Linux Mirror
RSYNC_OPTS="--bwlimit=500"

34
root/defaults/stats Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/sh
output="/app/www/.stats"
nic="eth0"
generate_index() {
cat <<-EOF
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="cache-control" content=no-cache">
<meta http-equiv="refresh" content="3000">
<title>Alpine Linux mirror statistics</title>
</head>
<body>
<table border="0">
<tr><td><img src="summary.png" alt="summary"></td><td><img src="hours.png" alt="hours"></td></tr>
<tr><td rowspan="2"><img src="days.png" alt="days"></td><td><img src="top10.png" alt="top10"></td></tr>
<tr><td><img src="months.png" alt="months"></td></tr>
</table>
</body>
</html>
EOF
}
if [ ! -f "$output"/index.html ]; then
mkdir -p $output
generate_index > "$output"/index.html
fi
for type in hours days months top10 summary hsummary vsummary; do
vnstati --${type} -i $nic -o $output/${type}.png
done

View File

@@ -0,0 +1,16 @@
#!/usr/bin/with-contenv bash
echo "Start: init-lighttpd-config run script"
mkdir -p /config /app/www
if [ ! -f /config/lighttpd.conf ]; then
echo "Copy default-config..."
cp /defaults/lighttpd.conf /config/lighttpd.conf
fi
echo "Set permissions to PUID: ${PUID:-911} and PGID: ${PGID:-1000}"
chown -R "${PUID:-911}:${PGID:-1000}" /config
chown -R "${PUID:-911}:${PGID:-1000}" /app/www
echo "Finish: init-lighttpd-config"

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-lighttpd-config/run

View File

@@ -0,0 +1,16 @@
#!/usr/bin/with-contenv bash
echo "Start: init-rsync-config run script"
mkdir -p /config /app/www
if [ ! -f /config/rsyncd.conf ]; then
echo "Copy default-config..."
cp /defaults/rsyncd.conf /config/rsyncd.conf
fi
echo "Set permissions to PUID: ${PUID:-911} and PGID: ${PGID:-1000}"
chown -R "${PUID:-911}:${PGID:-1000}" /config
chown -R "${PUID:-911}:${PGID:-1000}" /app/www
echo "Finish: init-rsync-config"

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-rsync-config/run

View File

@@ -0,0 +1,12 @@
#!/usr/bin/with-contenv bash
echo "Start: init-vnstat-config run script"
mkdir -p /config /app/www
if [ ! -f /etc/periodic/15min/stats ]; then
echo "Copy default-config..."
cp /defaults/stats /etc/periodic/15min/stats
fi
echo "Finish: init-vnstat-config"

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-vnstat-config/run

View File

@@ -0,0 +1,3 @@
init-lighttpd-config
init-rsync-config
init-vnstat-config

View File

@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bash
exec crond -f

View File

@@ -0,0 +1 @@
longrun

View File

@@ -0,0 +1 @@
init-lighttpd-config

View File

@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bash
exec lighttpd -D -f /config/lighttpd.conf

View File

@@ -0,0 +1 @@
longrun