Skip to content

Commit

Permalink
Merge branch 'master' into feature/debian-independent-build
Browse files Browse the repository at this point in the history
  • Loading branch information
woodpeck authored Sep 22, 2021
2 parents ae3b749 + bc04a2c commit ce14408
Show file tree
Hide file tree
Showing 45 changed files with 139 additions and 111 deletions.
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ install: build
for program in bin/*; do \
install -m 755 ${INSTALLOPTS} $$program $(DESTDIR)/usr/bin/; \
done
install -m 755 ${INSTALLOPTS} -d $(DESTDIR)/usr/lib/tirex/backends
install -m 755 ${INSTALLOPTS} backends/test $(DESTDIR)/usr/lib/tirex/backends
install -m 755 ${INSTALLOPTS} backends/wms $(DESTDIR)/usr/lib/tirex/backends
install -m 755 ${INSTALLOPTS} backends/tms $(DESTDIR)/usr/lib/tirex/backends
install -m 755 ${INSTALLOPTS} backends/mapserver $(DESTDIR)/usr/lib/tirex/backends
install -m 755 ${INSTALLOPTS} backends/openseamap $(DESTDIR)/usr/lib/tirex/backends
install -m 755 ${INSTALLOPTS} backends/test $(DESTDIR)/usr/libexec/tirex-backend-test
install -m 755 ${INSTALLOPTS} backends/wms $(DESTDIR)/usr/libexec/tirex-backend-wms
install -m 755 ${INSTALLOPTS} backends/tms $(DESTDIR)/usr/libexec/tirex-backend-tms
install -m 755 ${INSTALLOPTS} backends/mapserver $(DESTDIR)/usr/libexec/tirex-backend-mapserver
install -m 755 ${INSTALLOPTS} backends/openseamap $(DESTDIR)/usr/libexec/tirex-backend-openseamap
install -m 755 ${INSTALLOPTS} -d $(DESTDIR)/etc/tirex
install -m 644 ${INSTALLOPTS} etc/tirex.conf.dist $(DESTDIR)/etc/tirex/tirex.conf
install -m 755 ${INSTALLOPTS} -d $(DESTDIR)/etc/tirex/renderer
Expand Down
49 changes: 21 additions & 28 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@

Tirex Tile Rendering System
===========================
# Tirex Tile Rendering System

Tirex is a bunch of tools that let you run a tile server. A tile server
is a web server that hands out pre-rendered map raster images to clients.

The web page for Tirex is at http://wiki.openstreetmap.org/wiki/Tirex .
See there for more information.

PREREQUISITES
-------------
## PREREQUISITES

You'll need the following Perl modules to run Tirex:

Expand All @@ -20,63 +17,59 @@ You'll need the following Perl modules to run Tirex:

You'll need a C++ compiler and build tools to compile the Mapnik backend.

BUILDING
--------
## BUILDING

To build Tirex run

make
make

in the main directory. This will compile the mapnik backend and create
the man pages for the Perl modules.

Call 'make clean' to cleanup after a 'make'.

INSTALLING
----------
## INSTALLING

To install Tirex call

make install
make install

as root user. This will install the main parts of Tirex including the
tirex-master, tirex-backend-manager and the Mapnik backend.

This will not install the example map, or the munin or nagios plugins.
To install those, call

make install-example-map
make install-munin
make install-nagios
make install-example-map
make install-munin
make install-nagios

respectively. You can also install everything with

make install-all
make install-all

DEBIAN/UBUNTU
-------------
## DEBIAN/UBUNTU

To create Debian/Ubuntu packages you need the package 'devscripts'
installed. Call

make deb
make deb

to create the packages. The following packages will be created in the parent
directory:

tirex-core
tirex-backend-mapnik
tirex-backend-wms
tirex-backend-mapserver
tirex-example-map
tirex-munin-plugin
tirex-nagios-plugin
tirex-syncd
tirex-core
tirex-backend-mapnik
tirex-backend-wms
tirex-backend-mapserver
tirex-example-map
tirex-munin-plugin
tirex-nagios-plugin
tirex-syncd

Call 'make deb-clean' to cleanup after a 'make deb'.

TESTS
-----
## TESTS

Call 'prove' in the main directory to run Perl unit tests. You need Test::More
(Debian/Ubuntu: libtest-simple-perl) and Test::Harness (Debian/Ubuntu:
Expand Down
5 changes: 2 additions & 3 deletions backend-mapnik/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INSTALLOPTS=-g root -o root
CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CXXFLAGS = $(CFLAGS) `mapnik-config --cflags`
CXXFLAGS = `mapnik-config --cflags` $(CFLAGS)
CXXFLAGS += -Wall -Wextra -pedantic -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -Wold-style-cast
LDFLAGS= `mapnik-config --libs --ldflags --dep-libs`

Expand All @@ -11,5 +11,4 @@ clean:
rm -f backend-mapnik *.o

install:
install -m 755 ${INSTALLOPTS} -d $(DESTDIR)/usr/lib/tirex/backends/
install -m 755 ${INSTALLOPTS} backend-mapnik $(DESTDIR)/usr/lib/tirex/backends/mapnik
install -m 755 ${INSTALLOPTS} backend-mapnik $(DESTDIR)/usr/libexec/tirex-backend-mapnik
27 changes: 23 additions & 4 deletions bin/tirex-status
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,20 @@ sub duration
my $m = "";
if($milli && $seconds)
{
$m = sprintf(".%03d", $seconds%1000);
$m = sprintf(".%03d", $seconds%1000) if $seconds < 60000;
$seconds = int($seconds/1000);
}

if($seconds >= 3600)
if($seconds >= 86400)
{
my $d = int($seconds/86400);
$seconds -= $d*86400;
my $h = int($seconds/3600);
$seconds -= $h*3600;
my $minutes = int($seconds/60);
return sprintf("%dd+%d:%02d:%02d%s", $d, $h, $minutes, $seconds-$minutes*60, $m);
}
elsif($seconds >= 3600)
{
my $h = int($seconds/3600);
$seconds -= $h*3600;
Expand Down Expand Up @@ -201,10 +210,20 @@ sub format_stats
my $stats = shift;

my $text = " Statistics:\n";
foreach my $statkey (sort keys %$stats)
foreach my $statkey (sort keys %$stats, "mean_render_time")
{
my $statvalue = $stats->{$statkey};
if (ref($statvalue) eq '')
if ($statkey eq "mean_render_time")
{
foreach my $map (sort keys %{$stats->{"count_rendered"}})
{
$text .= " $statkey" . "[$map]=";
my $n = scalar(@{$stats->{"count_rendered"}{$map}}) - 1;
$text .= join(', ', map { my $c=$stats->{"count_rendered"}{$map}[$_]; duration($c ? ($stats->{"sum_render_time"}{$map}[$_] / $c) : 0, 1)} (0 .. $n));
$text .= "\n";
}
}
elsif (ref($statvalue) eq '')
{
$text .= " $statkey=$statvalue\n";
}
Expand Down
8 changes: 8 additions & 0 deletions bin/tirex-tiledir-check
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ Write list of tiles to FILE. See below for format.
Write stats about tiles to FILE. See below for format.
=item B<-z>, B<--minz=i>
Start processing at min. zoom level i (default=0)
=item B<-Z>, B<--maxz=i>
Stop processing at max. zoom level i (default=19)
=back
=head1 DESCRIPTION
Expand Down
6 changes: 3 additions & 3 deletions bin/tirex-tiledir-stat
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ my $BLOCKSIZE = 512;

if (scalar(@ARGV) == 0)
{
$ARGV[0] = Tirex::Config::get('stats_dir', '/var/lib/tirex/stats') . '/tiles.stats';
$ARGV[0] = Tirex::Config::get('stats_dir', '/var/cache/tirex/stats') . '/tiles.stats';
}
my $json = join('', <>);
$json =~ s/\n\}\n\n\{/,/g; # join individual files
Expand Down Expand Up @@ -188,7 +188,7 @@ Use the config directory DIR instead of /etc/tirex.
=head1 DESCRIPTION
Read a JSON stats file generated by tirex-tiledir-check and output a nicely
formatted table with the data. Reads F</var/lib/tirex/stats/tiles.stats>
formatted table with the data. Reads F</var/cache/tirex/stats/tiles.stats>
if no stats file is given on the command line.
=head1 FILES
Expand All @@ -199,7 +199,7 @@ if no stats file is given on the command line.
The configuration file.
=item F</var/lib/tirex/stats/tiles.stats>
=item F</var/cache/tirex/stats/tiles.stats>
Default statistics file location.
Expand Down
2 changes: 1 addition & 1 deletion debian/tirex-backend-mapnik.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
usr/lib/tirex/backends/mapnik
usr/libexec/tirex-backend-mapnik
etc/tirex/renderer/mapnik.conf
2 changes: 1 addition & 1 deletion debian/tirex-backend-mapserver.install
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
usr/lib/tirex/backends/mapserver
usr/libexec/tirex-backend-mapserver
usr/share/perl5/Tirex/Backend/Mapserver.pm
usr/share/man/man3/Tirex::Backend::Mapserver.3pm
etc/tirex/renderer/mapserver.conf
Expand Down
2 changes: 1 addition & 1 deletion debian/tirex-backend-tms.install
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
usr/lib/tirex/backends/tms
usr/libexec/tirex-backend-tms
usr/share/perl5/Tirex/Backend/TMS.pm
usr/share/man/man3/Tirex::Backend::TMS.3pm
etc/tirex/renderer/tms.conf
Expand Down
2 changes: 1 addition & 1 deletion debian/tirex-backend-wms.install
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
usr/lib/tirex/backends/wms
usr/libexec/tirex-backend-wms
usr/share/perl5/Tirex/Backend/WMS.pm
usr/share/man/man3/Tirex::Backend::WMS.3pm
etc/tirex/renderer/wms.conf
Expand Down
4 changes: 2 additions & 2 deletions debian/tirex-core.install
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ usr/share/perl5
etc/tirex/tirex.conf
etc/tirex/renderer/test.conf
etc/tirex/renderer/test/checkerboard.conf
debian/etc/logrotate.d/tirex-master etc/logrotate.d
usr/lib/tirex/backends/test
etc/logrotate.d/tirex-master
usr/libexec/tirex-backend-test
6 changes: 3 additions & 3 deletions debian/tirex-core.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ if ! getent passwd tirex >/dev/null; then
adduser --group --system --no-create-home --shell /bin/bash --home /var/lib/tirex tirex
fi

for dir in /var/run/tirex /var/log/tirex /var/lib/tirex /var/lib/tirex/stats /var/lib/tirex/tiles /var/lib/tirex/tiles/test; do
for dir in /var/run/tirex /var/log/tirex /var/lib/tirex /var/cache/tirex/stats /var/lib/tirex/tiles /var/lib/tirex/tiles/test; do
[ -d $dir ] || mkdir -p $dir && chown tirex:tirex $dir
done

dpkg-statoverride --list /var/log/tirex >/dev/null || \
dpkg-statoverride --update --add tirex adm 0750 /var/log/tirex
dpkg-statoverride --list /var/run/tirex >/dev/null || \
dpkg-statoverride --update --add tirex root 0755 /var/run/tirex
dpkg-statoverride --list /run/tirex >/dev/null || \
dpkg-statoverride --update --add tirex root 0755 /run/tirex

#DEBHELPER#
2 changes: 1 addition & 1 deletion debian/tirex-core.tirex-backend-manager.init
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Mapnik rendering daemon for Tirex"
NAME=tirex-backend-manager
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/tirex/$NAME.pid
PIDFILE=/run/tirex/$NAME.pid
DAEMON_ARGS=""
SCRIPTNAME=/etc/init.d/$NAME

Expand Down
2 changes: 1 addition & 1 deletion debian/tirex-core.tirex-backend-manager.simple-init
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Mapnik rendering daemon for Tirex"
NAME=tirex-backend-manager
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/tirex/$NAME.pid
PIDFILE=/run/tirex/$NAME.pid
DAEMON_ARGS=""
SCRIPTNAME=/etc/init.d/$NAME

Expand Down
2 changes: 1 addition & 1 deletion debian/tirex-core.tirex-master.init
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DESC="Tirex master server"
NAME=tirex-master
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
PIDFILE=/var/run/tirex/$NAME.pid
PIDFILE=/run/tirex/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
Expand Down
2 changes: 1 addition & 1 deletion debian/tirex-core.tirex-master.simple-init
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DESC="Tirex master server"
NAME=tirex-master
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
PIDFILE=/var/run/tirex/$NAME.pid
PIDFILE=/run/tirex/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
Expand Down
2 changes: 1 addition & 1 deletion debian/tirex-example-map.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -e

[ -d /var/lib/tirex/tiles/example ] || mkdir -p /var/lib/tirex/tiles/example && chown tirex:tirex /var/lib/tirex/tiles/example
[ -d /var/cache/tirex/tiles/example ] || mkdir -p /var/cache/tirex/tiles/example && chown tirex:tirex /var/cache/tirex/tiles/example

#DEBHELPER#
2 changes: 1 addition & 1 deletion debian/tirex-syncd.init
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DESC="Tirex sync server"
NAME=tirex-syncd
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
PIDFILE=/var/run/tirex/$NAME.pid
PIDFILE=/run/tirex/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
Expand Down
2 changes: 1 addition & 1 deletion debian/tirex-syncd.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/usr/bin/tirex-syncd
/usr/libexec/tirex-syncd
/usr/share/man/man1/tirex-syncd.1
2 changes: 1 addition & 1 deletion etc/renderer/mapnik.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
name=mapnik

# path to executable of renderer
path=/usr/lib/tirex/backends/mapnik
path=/usr/libexec/tirex-backend-mapnik

# UDP port where the master can contact this renderer
# must be individual for each renderer
Expand Down
2 changes: 1 addition & 1 deletion etc/renderer/mapserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
name=mapserver

# path to executable of renderer
path=/usr/lib/tirex/backends/mapserver
path=/usr/libexec/tirex-backend-mapserver

# UDP port where the master can contact this renderer
# must be individual for each renderer
Expand Down
2 changes: 1 addition & 1 deletion etc/renderer/mapserver/msdemo.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
name=msdemo

# tile directory
tiledir=/var/lib/tirex/tiles/msdemo
tiledir=/var/cache/tirex/tiles/msdemo

# minimum zoom level allowed (default 0)
minz=0
Expand Down
2 changes: 1 addition & 1 deletion etc/renderer/openseamap.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
name=openseamap

# path to executable of renderer
path=/usr/lib/tirex/backends/openseamap
path=/usr/libexec/tirex-backend-openseamap

# UDP port where the master can contact this renderer
# must be individual for each renderer
Expand Down
2 changes: 1 addition & 1 deletion etc/renderer/openseamap/openseamap.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
name=openseamap

# tile directory
tiledir=/var/lib/tirex/tiles/openseamap
tiledir=/var/cache/tirex/tiles/openseamap

# minimum zoom level allowed (default 0)
#minz=0
Expand Down
2 changes: 1 addition & 1 deletion etc/renderer/test.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
name=test

# path to executable of renderer
path=/usr/lib/tirex/backends/test
path=/usr/libexec/tirex-backend-test

# UDP port where the master can contact this renderer
# must be individual for each renderer
Expand Down
4 changes: 2 additions & 2 deletions etc/renderer/test/checkerboard.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
name=test

# tile directory
tiledir=/var/lib/tirex/tiles/test
tiledir=/var/cache/tirex/tiles/test

# minimum zoom level allowed (default 0)
#minz=0

# maximum zoom level allowed (default 17)
maxz=10
maxz=20

#-----------------------------------------------------------------------------
# Backend specific configuration
Expand Down
Loading

0 comments on commit ce14408

Please sign in to comment.