summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Brill <egore911@egore911.de>2012-08-16 01:04:12 +0200
committerChristoph Brill <egore911@egore911.de>2012-08-16 01:04:12 +0200
commitfa61fa598b101291a3f83018bbb304311e038530 (patch)
tree44a2c9f4422ae3fa7b85bc8ba68735bb6a3b2f39
parent4e8cd45deb1794b7f76755c2cb94ae3b8e159f9a (diff)
mod_tile-9999.ebuild, +files/renderd.service, +files/tileserver_vhost.include
Add support for systemd and install a vhost include.
-rw-r--r--sci-geosciences/mod_tile/ChangeLog4
-rw-r--r--sci-geosciences/mod_tile/Manifest8
-rw-r--r--sci-geosciences/mod_tile/files/renderd.service13
-rw-r--r--sci-geosciences/mod_tile/files/tileserver_vhost.include112
-rw-r--r--sci-geosciences/mod_tile/metadata.xml3
-rw-r--r--sci-geosciences/mod_tile/mod_tile-9999.ebuild19
6 files changed, 153 insertions, 6 deletions
diff --git a/sci-geosciences/mod_tile/ChangeLog b/sci-geosciences/mod_tile/ChangeLog
index fbfbbac..06d88ff 100644
--- a/sci-geosciences/mod_tile/ChangeLog
+++ b/sci-geosciences/mod_tile/ChangeLog
@@ -2,6 +2,10 @@
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+ 15 Aug 2012; Christoph Brill <egore911@egore911.de> mod_tile-9999.ebuild,
+ +files/renderd.service, +files/tileserver_vhost.include, metadata.xml:
+ Add support for systemd and install a vhost include.
+
04 Jun 2012; Christoph Brill <egore911@egore911.de> +files/88_mod_tile.conf,
mod_tile-9999.ebuild:
Add configuration file and rely on sci-geosciences/mapnik-stylesheets for the
diff --git a/sci-geosciences/mod_tile/Manifest b/sci-geosciences/mod_tile/Manifest
index f156acf..afc6177 100644
--- a/sci-geosciences/mod_tile/Manifest
+++ b/sci-geosciences/mod_tile/Manifest
@@ -1,5 +1,7 @@
AUX 88_mod_tile.conf 60 SHA256 c2ebd537ba6e229b14ce6e12446e3c5795bcaa3601a988a5a92891a4ea4da207 SHA512 ebfb5629b328edefed253f6510d468beac5fecc2abbc6015574e52a64ca0e5b5a46a0b9c387defea94023f21f1bd7bb711b6273055895015af2abf7f92f99b9b WHIRLPOOL 77f8dafa24e7a708e8bf9b1a04ac4aa51f3280a1ce40fa980a32c2559515ebaeb2b90977c100a66513dba5499061117a6d4ff83ac1e2a13e4f5c8933c5fffad8
AUX mod_tile-9999-use-external-iniparser.patch 1080 SHA256 5c210ef78edb588f731db7f69fd2f183d70e167bf22489a782843bda4a8f4f03 SHA512 09590a4ab773c634622143657e2939acdfc7acfe3a7f8c31a767b6e79e409b4b86a9e8846b407c50d9ce923662b20ee724e32da8b6382ee3c36f6f503ec85dbc WHIRLPOOL 8a84ee7ca432960e2b02fe066d3fa97f9c4c10b30454bf3585b959e042e07b3cadc4eea978ed389ce850e2f09dd4dc882de025767a8dd14b68ccaf5099a523af
-EBUILD mod_tile-9999.ebuild 1114 SHA256 0b40295fdeceb438eb7b8030b0be4bee0defd87223cb7742b02862329debfeab SHA512 23852b8bfa6058900bbb7aa177a46329887d31c9ed4a22382d9cf7ab1702df0882533f613f87fc4ec2c525899efc1a76e58e790ac85479e0fec6200c84f482be WHIRLPOOL dfef64fa2a8a191a5944e385d940e4b2c07ef9ea791d18e6d0c78a90600e096ad9dc84237f8329b6ab0d3f7f72d449b3faadf668de42a83111572fd77628fe41
-MISC ChangeLog 527 SHA256 0f1f3c4b8da90758aae7ae9f1043071060ba8e2aa8a121a2c03ba880e9d0c4f4 SHA512 be25f4b849a7587f197a6fca0108532a413400d1ccf458cf7e22841acee103d87a9a8b496a5e27bd04691d3212d9bdb6106a46530fe1b9ae421a4c88f1c82b03 WHIRLPOOL 8477016f7a73ab7011ee9f95994afa16c20eaa1f858104e4e66e2107cecc85c84995b30cc2fbad0fdd6e5c6c7190f3056d30335f943cffbdac11c5c71185f543
-MISC metadata.xml 204 SHA256 e808030aad62dfe3e81350c1c879870c3d406c50e908ddc3f521480aec65e8d5 SHA512 4e3e5b3211b0bd063a20b73fc3489bcb4f483990dc0eeb4c677a969f653b72b182e266bdf370669ab83713a9a2b1e26ae6eb703e219d9931c5220d51fb9f5f02 WHIRLPOOL 17bb47a871a62dbb7e5baf653d0e099928ba21409fd66c270f762e528ac1a6323e660c5e3ad8c72847a737ffd105f1d7528ad856608f9f9ac48bb5e55ab13d24
+AUX renderd.service 232 SHA256 c2f1836d800d746463375281f58078c5a8f97562d416c9ab7a382ecddf1b07db SHA512 e100f84836fdf4629f37a16bf62538ff9d87b63c0f7b3970077e8d828c8596856bf61978b0096770c2f1c9b3b9ee7009268f851c27fb474fadebf58484cd1a08 WHIRLPOOL 8d2adaca6d56fb426f38e89c8d4ad22fca9197bdf0612c2cf50fe4e1c735bb5e880ee38ec18ac9babf53405e02f5d81d6c909eb81ab6aef346572d6123485105
+AUX tileserver_vhost.include 5957 SHA256 99174c4a84cddaac2b9a5ab456cc39c5befa0c13b386111d3588449ab3f960f7 SHA512 bd4a4be4d946126bce9f67222d3101f1e037e0a2f8579fdd6b24e213208d327156fbf7f4ca1e337823bb656060ff1d3b855819e1edc0d59173a5d876057e53c5 WHIRLPOOL c1f2552b84b0fbbd3c546cf78b396c25a728471c0b922c02bc963c6baa917fafcf6c3b79d8a9cb3cb6e437d4719f898e83b6b972a9cbf47284dbfb3d396af395
+EBUILD mod_tile-9999.ebuild 1568 SHA256 6d6726959dba97b72b1b39874dbf56430e5476e70f6ca2aa8e0f2792ead1751d SHA512 663aa4de0b4be51c372272ead84ad5297c235df1a9fb9749b84184b4d0f9bf48b75a3573d3aa30229e24ad421ee730bc5b303ea56d1ae2be94124cec2ff4eeee WHIRLPOOL ef1477cfadea245db6ddfe11d244b807ba52e7f3308d1745599d98b3c8f4af8ea08944ebe30d1666c3d448dba34953844fda6893c1ab754dfd91208785e66ce6
+MISC ChangeLog 732 SHA256 94da82517e21dbc731ef622df506ee6f28531dad850be291f0f3e427ea209a18 SHA512 cbcf66af9bade36b03d3a98e81e28c5e4c2547bec54cc02fc30f3b6cad5af96016e5ae433a2d45602f74e5da9608c035de731e1ed68a3f92cfb1a67c510136bf WHIRLPOOL d37d06b250a3036eca3f2505cb63f521b4498608fcbf9a148d9f070456c6e821ec2d34b379f670a9fdca31c50880cbb4f6aed4f58a83e092aff292a29ecc8152
+MISC metadata.xml 287 SHA256 4e61713053ad6c18a1b799e0fa3e6b9da381e3160e7f8cdde8ba77af6e9149ec SHA512 c8d2fedee6911f5eab1ee2b199c3e105e2c7f2220b004b7f038853cd7e538ee70dda994a96eebf2c3eadcc96f2a24c11adf7faf379fe596f989269e34404f248 WHIRLPOOL 9a0d33de67549846a03989faf496c21d5b5de93f2e31464a4c5de4858f0ca34af082000c03aae211ac87b8512ff8c06075ce6f01c6a88466d9a2d2b411b532e9
diff --git a/sci-geosciences/mod_tile/files/renderd.service b/sci-geosciences/mod_tile/files/renderd.service
new file mode 100644
index 0000000..cb41e6c
--- /dev/null
+++ b/sci-geosciences/mod_tile/files/renderd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Rendering daemon for Openstreetmap tiles
+
+[Service]
+User=apache
+Group=apache
+
+Type=forking
+ExecStart=/usr/bin/renderd -c /etc/renderd.conf
+ExecStop=/bin/kill -s QUIT $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sci-geosciences/mod_tile/files/tileserver_vhost.include b/sci-geosciences/mod_tile/files/tileserver_vhost.include
new file mode 100644
index 0000000..2848e92
--- /dev/null
+++ b/sci-geosciences/mod_tile/files/tileserver_vhost.include
@@ -0,0 +1,112 @@
+# You can manually configure each tile set with AddTileConfig or AddTileMimeConfig.
+# The first argument is the URL path relative to this virtual host
+# under which a tile set is served. The second argument specifies the
+# name of the tile set. This is used in the communication with renderd
+# and is the directory under which (meta)tiles are stored on disk.
+#
+# By default (AddTileConfig) mod_tile assumes you are serving png files, however,
+# mod_tile can also serve arbitrary other tile types such as javascript vector tiles,
+# assuming the backend render daemon can handle the file type.
+# To this purpose AddTileMimeConfig takes a 3rd agument, the file extension and it
+# will guess the correct mimetype from it. If the mime type is not set correctly automatically,
+# you need to use the configuration file route, where you can specify the mimetype and file extension
+# independently.
+#
+# AddTileConfig /folder/ TileSetName
+# AddTileMimeConfig /folder2/ TileSetName2 js
+
+# Alternatively (or in addition) you can load all the tile sets defined in the configuration file into this virtual host
+LoadTileConfigFile /etc/renderd.conf
+
+# Timeout before giving up for a tile to be rendered
+ModTileRequestTimeout 3
+
+# Timeout before giving up for a tile to be rendered that is otherwise missing
+ModTileMissingRequestTimeout 10
+
+# If tile is out of date, don't re-render it if past this load threshold (users gets old tile)
+ModTileMaxLoadOld 2
+
+# If tile is missing, don't render it if past this load threshold (user gets 404 error)
+ModTileMaxLoadMissing 5
+
+# Socket where we connect to the rendering daemon
+ModTileRenderdSocketName /var/run/renderd/renderd.sock
+
+##
+## Options controlling the cache proxy expiry headers. All values are in seconds.
+##
+## Caching is both important to reduce the load and bandwidth of the server, as
+## well as reduce the load time for the user. The site loads fastest if tiles can be
+## taken from the users browser cache and no round trip through the internet is needed.
+## With minutely or hourly updates, however there is a trade-off between cacheability
+## and freshness. As one can't predict the future, these are only heuristics, that
+## need tuning.
+## If there is a known update schedule such as only using weekly planet dumps to update the db,
+## this can also be taken into account through the constant PLANET_INTERVAL in render_config.h
+## but requires a recompile of mod_tile
+
+## The values in this sample configuration are not the same as the defaults
+## that apply if the config settings are left out. The defaults are more conservative
+## and disable most of the heuristics.
+
+
+##
+## Caching is always a trade-off between being up to date and reducing server load or
+## client side latency and bandwidth requirements. Under some conditions, like poor
+## network conditions it might be more important to have good caching rather than the latest tiles.
+## Therefor the following config options allow to set a special hostheader for which the caching
+## behaviour is different to the normal heuristics
+##
+## The CacheExtended parameters overwrite all other caching parameters (including CacheDurationMax)
+## for tiles being requested via the hostname CacheExtendedHostname
+#ModTileCacheExtendedHostname cache.tile.openstreetmap.org
+#ModTileCacheExtendedDuration 2592000
+
+# Upper bound on the length a tile will be set cacheable, which takes
+# precedence over other settings of cacheing
+ModTileCacheDurationMax 604800
+
+# Sets the time tiles can be cached for that are known to by outdated and have been
+# sent to renderd to be rerendered. This should be set to a value corresponding
+# roughly to how long it will take renderd to get through its queue. There is an additional
+# fuzz factor on top of this to not have all tiles expire at the same time
+ModTileCacheDurationDirty 900
+
+# Specify the minimum time mod_tile will set the cache expiry to for fresh tiles. There
+# is an additional fuzz factor of between 0 and 3 hours on top of this.
+ModTileCacheDurationMinimum 10800
+
+# Lower zoom levels are less likely to change noticeable, so these could be cached for longer
+# without users noticing much.
+# The heuristic offers three levels of zoom, Low, Medium and High, for which different minimum
+# cacheing times can be specified.
+
+#Specify the zoom level below which Medium starts and the time in seconds for which they can be cached
+ModTileCacheDurationMediumZoom 13 86400
+
+#Specify the zoom level below which Low starts and the time in seconds for which they can be cached
+ModTileCacheDurationLowZoom 9 518400
+
+# A further heuristic to determine cacheing times is when was the last time a tile has changed.
+# If it hasn't changed for a while, it is less likely to change in the immediate future, so the
+# tiles can be cached for longer.
+# For example, if the factor is 0.20 and the tile hasn't changed in the last 5 days, it can be cached
+# for up to one day without having to re-validate.
+ModTileCacheLastModifiedFactor 0.20
+
+## Tile Throttling
+## Tile scrappers can often download large numbers of tiles and overly staining tileserver resources
+## mod_tile therefore offers the ability to automatically throttle requests from ip addresses that have
+## requested a lot of tiles.
+## The mechanism uses a token bucket approach to shape traffic. I.e. there is an initial pool of n tiles
+## per ip that can be requested arbitrarily fast. After that this pool gets filled up at a constant rate
+## The algorithm has to metrics. One based on overall tiles served to an ip address and a second one based on
+## the number of requests to renderd / tirex to render a new tile.
+
+## Overall enable or disable tile throttling
+ModTileEnableTileThrottling Off
+## Parameters (poolsize in tiles and topup rate in tiles per second) for throttling tile serving.
+ModTileThrottlingTiles 10000 1
+## Parameters (poolsize in tiles and topup rate in tiles per second) for throttling render requests.
+ModTileThrottlingRenders 128 0.2
diff --git a/sci-geosciences/mod_tile/metadata.xml b/sci-geosciences/mod_tile/metadata.xml
index 1188c23..57b2983 100644
--- a/sci-geosciences/mod_tile/metadata.xml
+++ b/sci-geosciences/mod_tile/metadata.xml
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
+<use>
+ <flag name="systemd">Install systemd service unit for renderd</flag>
+</use>
<maintainer>
<email>egore911@egore911.de</email>
</maintainer>
diff --git a/sci-geosciences/mod_tile/mod_tile-9999.ebuild b/sci-geosciences/mod_tile/mod_tile-9999.ebuild
index 3fd3ef5..d408fbd 100644
--- a/sci-geosciences/mod_tile/mod_tile-9999.ebuild
+++ b/sci-geosciences/mod_tile/mod_tile-9999.ebuild
@@ -4,7 +4,7 @@
EAPI=4
-inherit apache-module subversion autotools
+inherit apache-module subversion autotools systemd
DESCRIPTION="a raster tiles service for example to use within a slippy map"
HOMEPAGE="http://wiki.openstreetmap.org/wiki/Mod_tile"
@@ -14,14 +14,15 @@ ESVN_REPO_URI="http://svn.openstreetmap.org/applications/utils/mod_tile/"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
-IUSE=""
+IUSE="systemd"
DEPEND=">=sci-geosciences/mapnik-2.0
media-libs/freetype:2
>=dev-libs/icu-4.2
dev-libs/iniparser
sci-geosciences/mapnik-stylesheets"
-RDEPEND="${DEPEND}"
+RDEPEND="${DEPEND}
+ systemd? ( sys-apps/systemd )"
APACHE2_MOD_CONF="88_${PN}"
@@ -44,4 +45,16 @@ src_compile() {
src_install() {
default
apache-module_src_install
+ insinto ${APACHE_VHOSTS_CONFDIR}
+ doins "${FILESDIR}"/tileserver_vhost.include
+ if use systemd; then
+ insinto $(systemd_get_unitdir)
+ doins "${FILESDIR}"/renderd.service
+ fi
+}
+
+pkg_postinst() {
+ einfo "The module was automatically enabled and can be used after restarting the apache"
+ einfo "webserver. A vhost include is provided as well. You can add it to your vhosts to"
+ einfo "get the default setup"
}