summaryrefslogtreecommitdiff
path: root/user/tipidee
diff options
context:
space:
mode:
Diffstat (limited to 'user/tipidee')
-rw-r--r--user/tipidee/APKBUILD88
-rw-r--r--user/tipidee/httpd.run19
-rw-r--r--user/tipidee/httpsd.run23
-rw-r--r--user/tipidee/logger.run5
-rw-r--r--user/tipidee/tipidee.conf18
-rw-r--r--user/tipidee/tipidee.confd33
-rw-r--r--user/tipidee/tipidee.initd64
-rw-r--r--user/tipidee/tipidee.post-deinstall3
-rw-r--r--user/tipidee/tipidee.post-install3
-rw-r--r--user/tipidee/tipidee.pre-install7
10 files changed, 263 insertions, 0 deletions
diff --git a/user/tipidee/APKBUILD b/user/tipidee/APKBUILD
new file mode 100644
index 000000000..a4b9a855b
--- /dev/null
+++ b/user/tipidee/APKBUILD
@@ -0,0 +1,88 @@
+# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
+pkgname=tipidee
+pkgver=0.0.6.0
+pkgrel=0
+pkgdesc="The skarnet.org web server"
+url="https://skarnet.org/software/tipidee/"
+arch="all"
+options="!check" # No test suite.
+license="ISC"
+_skalibs_version=2.14.4
+_execline_version=2.9.7
+_s6_version=2.13.2
+_s6net_version=2.7.1
+depends="execline>=$_execline_version s6>=$_s6_version s6-networking>=$_s6net_version"
+depends_dev="skalibs-dev>=$_skalibs_version"
+makedepends="$depends_dev"
+subpackages="tipidee-dev tipidee-libs tipidee-doc tipidee-openrc"
+source="
+ https://skarnet.org/software/tipidee/tipidee-$pkgver.tar.gz
+ httpd.run
+ httpsd.run
+ logger.run
+ tipidee.conf
+ tipidee.confd
+ tipidee.initd
+ "
+install="
+ tipidee.pre-install
+ tipidee.post-install
+ tipidee.post-deinstall
+ "
+pkggroups="tipidee"
+pkgusers="tipideelog tipideed"
+
+build() {
+ ./configure \
+ --enable-shared \
+ --disable-allstatic \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --with-pkgconfig \
+ --enable-pkgconfig \
+ --libexecdir="/usr/lib/$pkgname"
+ make
+}
+
+_makeservicedir() {
+ name="http${1}d-${2}"
+ fn="$pkgdir/var/lib/tipidee/services/$name"
+ mkdir -p "$fn/log"
+ echo 3 > "$fn/log/notification-fd"
+ sed -e "s/@S@/${1}/g; s/@V@/${2}/g;" "$srcdir/logger.run" > "$fn/log/run"
+ chmod 0755 "$fn/log/run"
+ echo 3 > "$fn/notification-fd"
+ sed -e "s/@V@/${2}/g;" "$srcdir/http${1}d.run" > "$fn/run"
+ chmod 0755 "$fn/run"
+ fn="$pkgdir/var/log/$name"
+ mkdir -p "$fn"
+ chown tipideelog:tipidee "$fn"
+ chmod 02700 "$fn"
+}
+
+package() {
+ mkdir -p "$pkgdir/usr/share/doc" "$pkgdir/var/lib/tipidee/docroot"
+ make DESTDIR="$pkgdir" install
+ for i in '' s ; do for j in 4 6 ; do
+ _makeservicedir "$i" "$j"
+ done ; done
+ install -m 0644 -D "$srcdir/tipidee.conf" "$pkgdir/etc/tipidee.conf"
+ install -m 0644 -D "$srcdir/tipidee.confd" "$pkgdir/etc/conf.d/tipidee"
+ install -m 0755 -D "$srcdir/tipidee.initd" "$pkgdir/etc/init.d/tipidee"
+ cp -a "$builddir/doc" "$pkgdir/usr/share/doc/$pkgname"
+}
+
+dev() {
+ default_dev
+
+ # default_dev please stop being stupid
+ mv "$subpkgdir/usr/bin/tipidee-config" "$pkgdir/usr/bin/tipidee-config"
+}
+
+sha512sums="1a8ae1f7293fc7a1db1f0f4dd0752388f58e134c3f0847a768cf56e2e5a21b7d037f71f3d9e4ff16ab986c699d39827e53b467c8b13b0b9dad41b6fd742c9a5c tipidee-0.0.6.0.tar.gz
+560048b2b767053770e37ce3fd69540f2fad23236f012da115c1f985240f42d0bb7809630d8991e39169e255e3d36ebfdc85f895d16675119a95d3a6e64fd2b2 httpd.run
+1c9333785c63662039580504dd36af21d05eb9972e6770af17e87e062bd7d9fa67695f4120221e241e10503ca0fb3b5347f032b6c1eef309f2ff8cd636266f2b httpsd.run
+b5af306fe7040f966b13da84bfb0c4b528683c03205519d08fe429ee826ffad27c9ddb32be8c8bf8b42ce7964ef15572e3c66a96494aed833ee951c769f81bd2 logger.run
+bb2681a3000133724bb8fd4918bc3209ea676c2e4f96ad8b298d8e7302aeebd6876341ea205f2d808f34e4c9b5c138bba032694c6069c17026b0ddf23702f9ba tipidee.conf
+7a999200ad21b2b0737ce82136bc8e055d7ab4a865b7727e6dc8df0eaeea6ace11eb5756b64231ce7938d11b5ec218944173ea1df3db059d033bf3f848c9a608 tipidee.confd
+5001d079b1ca7920d163cc2d58a5855e2740e72ed85df25414b4719c52133bd0f2f9e69c63c57f31645159189fc046c7d213048fc1cbd0f640336e43874e4482 tipidee.initd"
diff --git a/user/tipidee/httpd.run b/user/tipidee/httpd.run
new file mode 100644
index 000000000..8619bd856
--- /dev/null
+++ b/user/tipidee/httpd.run
@@ -0,0 +1,19 @@
+#!/bin/execlineb -S1
+
+fdmove -c 2 1
+emptyenv -p
+fdmove 1 3
+envfile /etc/conf.d/tipidee
+unexport HTTP
+unexport HTTPS
+multisubstitute
+{
+ importas -uSi TIPIDEED_IPv@V@
+ importas -uSi TIPIDEED_ROOT
+ importas -uSD1000 TIPIDEED_CONCURRENCY
+ importas -uSD10 TIPIDEED_LOCAL_CONCURRENCY
+}
+s6-envuidgid tipideed
+cd ${TIPIDEED_ROOT}
+s6-tcpserver -1 -U -c ${TIPIDEED_CONCURRENCY} -C ${TIPIDEED_LOCAL_CONCURRENCY} -- ${TIPIDEED_IPv@V@} 80
+tipideed
diff --git a/user/tipidee/httpsd.run b/user/tipidee/httpsd.run
new file mode 100644
index 000000000..bfc3eebd0
--- /dev/null
+++ b/user/tipidee/httpsd.run
@@ -0,0 +1,23 @@
+#!/bin/execlineb -S1
+
+fdmove -c 2 1
+emptyenv -p
+fdmove 1 3
+envfile /etc/conf.d/tipidee
+unexport HTTP
+unexport HTTPS
+multisubstitute
+{
+ importas -uSi TIPIDEED_IPv@V@
+ importas -uSi TIPIDEED_ROOT
+ importas -uSi KEYFILE
+ importas -uSi CERTFILE
+ importas -uSD1000 TIPIDEED_CONCURRENCY
+ importas -uSD10 TIPIDEED_LOCAL_CONCURRENCY
+}
+s6-envuidgid tipideed
+export TLS_UID 65534
+export TLS_GID 65534
+cd ${TIPIDEED_ROOT}
+s6-tlsserver -1 -U -K 5000 -c ${TIPIDEED_CONCURRENCY} -C ${TIPIDEED_LOCAL_CONCURRENCY} -- ${TIPIDEED_IPv@V@} 443
+tipideed
diff --git a/user/tipidee/logger.run b/user/tipidee/logger.run
new file mode 100644
index 000000000..3f1785703
--- /dev/null
+++ b/user/tipidee/logger.run
@@ -0,0 +1,5 @@
+#!/bin/execlineb -S1
+
+s6-setuidgid tipideelog
+exec -c
+s6-log -d3 -- t s1000000 /var/log/http@S@d-@V@
diff --git a/user/tipidee/tipidee.conf b/user/tipidee/tipidee.conf
new file mode 100644
index 000000000..40bba13f9
--- /dev/null
+++ b/user/tipidee/tipidee.conf
@@ -0,0 +1,18 @@
+# This is where the behaviour of the tipidee web server is
+# configured.
+# See https://skarnet.org/software/tipidee/tipidee.conf.html
+# for the full documentation of the syntax.
+
+# The defaults work well, but here are some example directives that
+# you can uncomment if you find them applicable to your setup.
+
+# global read_timeout 60000
+# global write_timeout 60000
+# global cgi_timeout 5000
+# index-file index.html index.cgi
+# log start ip hostname request resource answer answer_size
+# custom-header always Strict-Transport-Security max-age=63072000; includeSubDomains; preload
+#
+# domain example.com
+# nph-prefix nph-
+# cgi /cgi-bin/
diff --git a/user/tipidee/tipidee.confd b/user/tipidee/tipidee.confd
new file mode 100644
index 000000000..d47fb589f
--- /dev/null
+++ b/user/tipidee/tipidee.confd
@@ -0,0 +1,33 @@
+# Configuration for the tipidee web server.
+
+# The IPs you want the tipidee server to listen on.
+# Comment to disable.
+TIPIDEED_IPv4=0.0.0.0
+TIPIDEED_IPv6=::
+
+# Serve plaintext HTTP? true or false
+HTTP=true
+
+# Serve HTTPS? true or false
+HTTPS=false
+
+# If HTTPS is true, KEYFILE should point to
+# your private key, and CERTFILE should point to your certificate.
+# KEYFILE=
+# CERTFILE=
+
+# Total authorized concurrent connections. Don't go above 5000 or so.
+TIPIDEED_CONCURRENCY=1000
+
+# Authorized concurrent connections *per IP*.
+TIPIDEED_LOCAL_CONCURRENCY=10
+
+# The server root. Make sure this directory exists, is readable by
+# the tipideed user, and does *not* belong to the tipideed user.
+# The documents need to be stored under subdirectories of TIPIDEED_ROOT,
+# one subdirectory per virtual domain you're serving.
+TIPIDEED_ROOT=/var/lib/tipidee/docroot
+
+# Also check the /etc/tipidee.conf file for detailed configuration of
+# logging, document attributes, etc.
+# Run tipidee-config after editing /etc/tipidee.conf.
diff --git a/user/tipidee/tipidee.initd b/user/tipidee/tipidee.initd
new file mode 100644
index 000000000..f196bcd23
--- /dev/null
+++ b/user/tipidee/tipidee.initd
@@ -0,0 +1,64 @@
+#!/sbin/openrc-run
+
+description="Start/stop the tipidee services"
+
+depend()
+{
+ after net
+ after localmount
+}
+
+_get_services()
+{
+ list=
+ if "$HTTP" ; then
+ if test -n "$TIPIDEED_IPv4" ; then
+ list="httpd-4"
+ fi
+ if test -n "$TIPIDEED_IPv6" ; then
+ list="$list httpd-6"
+ fi
+ fi
+ if "$HTTPS" ; then
+ if test -n "$TIPIDEED_IPV4" ; then
+ list="httpsd-4"
+ fi
+ if test -n "$TIPIDEED_IPV6" ; then
+ list="$list httpsd-6"
+ fi
+ fi
+ echo $list
+}
+
+stop()
+{
+ ebegin "Stopping the tipidee services"
+ for i in `_get_services` ; do
+ s6-svunlink /run/service "$i"
+ done
+ eend $?
+}
+
+start()
+{
+ ebegin "Starting the tipidee services"
+ for i in `_get_services` ; do
+ s6-svlink -t10000 /run/service "/var/lib/tipidee/services/$i"
+ done
+ eend $?
+}
+
+status()
+{
+ for i in `_get_services` ; do
+ echo -n "${i}: "
+ s6-svstat "/run/service/${i}"
+ done
+}
+
+restart()
+{
+ for i in `_get_services` ; do
+ s6-svc -rwR "/run/service/$i"
+ done
+}
diff --git a/user/tipidee/tipidee.post-deinstall b/user/tipidee/tipidee.post-deinstall
new file mode 100644
index 000000000..9912c9503
--- /dev/null
+++ b/user/tipidee/tipidee.post-deinstall
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+
+rm -f /etc/tipidee.conf.cdb
diff --git a/user/tipidee/tipidee.post-install b/user/tipidee/tipidee.post-install
new file mode 100644
index 000000000..425ab5aaa
--- /dev/null
+++ b/user/tipidee/tipidee.post-install
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+
+tipidee-config
diff --git a/user/tipidee/tipidee.pre-install b/user/tipidee/tipidee.pre-install
new file mode 100644
index 000000000..e92fd1d0a
--- /dev/null
+++ b/user/tipidee/tipidee.pre-install
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+groupadd -r -- tipidee 2>/dev/null
+useradd -r -d / -M -N -s /sbin/nologin -g tipidee -c tipideelog -- tipideelog 2>/dev/null
+useradd -r -d / -M -N -s /sbin/nologin -g tipidee -c tipideed -- tipideed 2>/dev/null
+
+exit 0