From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- www-servers/h2o/files/h2o.conf | 30 ++++++++++++++++++++++ www-servers/h2o/files/h2o.initd | 51 +++++++++++++++++++++++++++++++++++++ www-servers/h2o/files/h2o.logrotate | 8 ++++++ www-servers/h2o/files/h2o.service | 13 ++++++++++ 4 files changed, 102 insertions(+) create mode 100644 www-servers/h2o/files/h2o.conf create mode 100644 www-servers/h2o/files/h2o.initd create mode 100644 www-servers/h2o/files/h2o.logrotate create mode 100644 www-servers/h2o/files/h2o.service (limited to 'www-servers/h2o/files') diff --git a/www-servers/h2o/files/h2o.conf b/www-servers/h2o/files/h2o.conf new file mode 100644 index 000000000000..ccca5dd2de51 --- /dev/null +++ b/www-servers/h2o/files/h2o.conf @@ -0,0 +1,30 @@ +# see /usr/share/doc/h2o/index.html for detailed documentation +# see h2o --help for command-line options and settings + +user: h2o +pid-file: /run/h2o.pid +access-log: /var/log/h2o/access.log +error-log: /var/log/h2o/error.log + +# httpoxy mitigation (https://httpoxy.org) +# see https://github.com/h2o/h2o/pull/996 +setenv: + HTTP_PROXY: "" + +listen: 80 + +#listen: +# port: 443 +# ssl: +# minimum-version: TLSv1.2 +# certificate-file: /etc/h2o/server.crt +# key-file: /etc/h2o/server.key + +hosts: + "localhost:80": + paths: + "/": + file.dir: /var/www/localhost/htdocs + "/doc": + file.dir: /usr/share/doc/h2o/ + file.index: [ 'index.html' ] diff --git a/www-servers/h2o/files/h2o.initd b/www-servers/h2o/files/h2o.initd new file mode 100644 index 000000000000..ad598a5f6199 --- /dev/null +++ b/www-servers/h2o/files/h2o.initd @@ -0,0 +1,51 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +extra_commands="configtest" +extra_started_commands="reload" +description="An optimized HTTP/1.x, HTTP/2 server" +description_configtest="Run H2O' internal config check" +description_reload="Reload the H2O configuration or upgrade the binary without losing connections" + +: ${config:="/etc/h2o/h2o.conf"} +pidfile=$(grep pid-file "${config}" | cut -d' ' -f2) + +name="H2O" +command="/usr/bin/h2o" +command_args="-m daemon -c ${config}" +required_files="$config" + +depend() { + use net + after logger +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ]; then + configtest || return 1 + fi +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ]; then + configtest || return 1 + fi +} + +reload() { + configtest || return 1 + ebegin "Refreshing ${name} configuration" + kill -HUP $(cat ${pidfile}) &>/dev/null + eend $? "Failed to reload ${name}" +} + +configtest() { + ebegin "Checking ${name} configuration" + + if ! ${command} -c ${config} -t &>/dev/null; then + ${command} -c ${config} -t + fi + + eend $? "Failed, please correct the errors above" +} diff --git a/www-servers/h2o/files/h2o.logrotate b/www-servers/h2o/files/h2o.logrotate new file mode 100644 index 000000000000..b901bcfacb19 --- /dev/null +++ b/www-servers/h2o/files/h2o.logrotate @@ -0,0 +1,8 @@ +/var/log/h2o/*.log { + missingok + delaycompress + sharedscripts + postrotate + test -r $(grep pid-file "/etc/h2o/h2o.conf" | cut -d' ' -f2) && kill -HUP $(pidof h2o) + endscript +} diff --git a/www-servers/h2o/files/h2o.service b/www-servers/h2o/files/h2o.service new file mode 100644 index 000000000000..fe32c45cd90f --- /dev/null +++ b/www-servers/h2o/files/h2o.service @@ -0,0 +1,13 @@ +[Unit] +Description=An optimized HTTP/1.x, HTTP/2 server +After=network-online.target nss-lookup.target remote-fs.target + +[Service] +Type=simple +ExecStart=/usr/bin/h2o -c /etc/h2o/h2o.conf -m master +SyslogLevel=notice +PrivateTmp=true +LimitNOFILE=infinity + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3