[Tile-serving] Fedora 18 ansible playbook to have mod_tile, Tirex, Nominatim, Mapnik
Bernard Fouché
bernard.fouche at kuantic.com
Thu Mar 28 14:33:12 UTC 2013
Hi List,
as mentioned on dev at openstreetmap.org, here is the complete steps I had
to follow to setup a server providing tiles and [reverse]geocoding on a
target running Fedora 18, in the event that it can be useful for someone
else.
It is incomplete because it references files like a virtual-host file of
your own, copies of some projects like Tirex or Nominatim, etc. but at
least if someone has to take a similar road (as of March 28th 2013),
then here is a guide that can help to solve the problem (I guess ansible
wizards and/or OSM specialists can do much better). Files permissions
are also probably badly handled, as postgresql users .
This script is also posted here also in the event that it can show the
real needs:
- to simplify such a setup
- to handle version numbering for the components involved.
Ansible (http://ansible.cc) syntax used here is pretty obvious, each
'step' is described following 'name:', each 'action' describes what to
do. ansible has built in modules (like 'command', 'yum', copy, etc) but
I'm not a specialist so I often use 'shell' and then type pure shell
commands.
#
# This playbook installs openstreetmap / mapnik on a target
#
---
- hosts: ... the name of the target to setup....
sudo: yes
vars:
scripts: ../../scripts
conf: ../../conf
rpm: ../../rpm
nominatim: ../../nominatim
osmosis: ../../osmosis
postgis: postgis-2.0.3-1.fc19.x86_64.rpm
# Monaco is perfect for testing; small, fast to process and full of details
openstreetmap_planet: monaco-latest.osm.bz2
tasks:
- name: Check we have latest packages (mod_tile compilation may fail
otherwise with org pkgs from install CD)
action: command yum -y update
tags:
- osm
#
# This is a very rough decision: the goal is to test a tile / geocoding
server on a local machine,
# you need to change this for a public site
#
- name: The default firewalld zone is set to 'trusted'
action: command firewall-cmd --set-default-zone trusted
tags:
- osm
#
# Postgreqsl and tiles are stored into '/data', a specific partition.
This means that to benefecit from
# this you should unmount/mount '/data' (or whatever location you use)
#
- name: Have '/data' mounted with 'noatime' to speed up postgresql /
tiles reading
action: shell sed -i -e 's/dataext4defaults/dataext4noatime/' /etc/fstab
tags:
- osm
- name: Install packages (may take time!)
action: yum name=$item state=latest
with_items:
- java
- postgresql-server
- subversion
- httpd
- php-pgsql
- php
- php-pear
- php-pear-DB
- gcc
- gcc-c++
- postgresql-contrib
- postgresql-devel
- bzip2-devel
- proj-devel
- geos-devel
- git
- libxml2-devel
- automake
- make
- libtool
- proj-epsg
- mapnik
- mapnik-devel
- mapnik-python
- proj-epsg
- boost
- boost-devel
- icu
- libicu-devel
- httpd-devel
- libtool-ltdl-devel
- perl-ExtUtils-MakeMaker
- cairomm-devel
- perl-IPC-ShareLite
- perl-JSON
- perl-GD
- perl-LWP-Online
- libtiff-devel
- mapserver-perl
tags:
- osm
- name: Enable postgresql.service
action: command systemctl enable postgresql.service
tags:
- osm
- name: Copy POSTGIS 2.0 RPM since Fedora repo hasn't correct RPM yet
($postgis)
action: copy src=$rpm/$postgis dest=/tmp
tags:
- osm
#
# Didn't find a way to update a locally installed package with yum
module: ignore errors
#
- name: Install $postgis
action: command yum -y install /tmp/$postgis
ignore_errors: True
tags:
- osm
- name: Run httpd when system boots
action: command systemctl enable httpd
tags:
- osm
- name: Make /data/nominatim
action: file path=/data/nominatim state=directory owner=postgres
group=postgres mode=777
tags:
- osm
#
# The copy of Nominatim includes a patch described here:
# https://github.com/twain47/Nominatim/issues/31
#
- name: Check if our own copy of Nominatim is already available
action: shell test -f /data/nominatim/nominatim.tgz
ignore_errors: True
register: nominatim_here
tags:
- osm
- name: Copy our own copy of Nominatim (see README.txt file in tar file)
action: copy src=$nominatim/nominatim.tgz dest=/data/nominatim
when_failed: $nominatim_here
tags:
- osm
- name: Extract nominatim
action: command chdir=/data/nominatim tar zxf nominatim.tgz
tags:
- osm
- name: Make /data/Osmosis
action: file path=/data/osmosis state=directory owner=postgres
group=postgres mode=777
tags:
- osm
- name: Make Osmosis symlink for /bin/osmosis
action: shell cd /bin ; rm -rf osmosis ; ln -s /data/osmosis/bin/osmosis
osmosis
tags:
- osm
#
# I keep also a copy of Osmosis, without any changes. At the moment osmosis
# is only needed to avoid having Nominatim stopped when using the
'--all' flag.
# I don't know if there are particular checks in Nominatim build chain for
# osmosis, so I bring it now before doing ./autogen.sh for Nominatim
#
- name: Put our own copy of Osmosis (no change from original file)
action: copy src=$osmosis/osmosis-latest.tgz dest=/data/osmosis
tags:
- osm
- name: Extract Osomosis
action: command chdir=/data/osmosis tar zxf osmosis-latest.tgz
tags:
- osm
- name: Autogen Nominatim.
action: shell chdir=/data/nominatim/Nominatim ./autogen.sh
tags:
- osm
- name: Configure Nominatim.
action: shell chdir=/data/nominatim/Nominatim ./configure
tags:
- osm
- name: Make Nominatim.
action: shell chdir=/data/nominatim/Nominatim make
tags:
- osm
#
# Nominatim base setup if to use postgresql 9.1 but we have 9.2
# Only the firt occurence of '9.1' should be changed but since the
second one is in
# comment, who cares?
#
- name: Patch Nominatim/settings/settings.php (postgresql version set to
9.2)
action: shell sed -i -e 's/9.1/9.2/'
/data/nominatim/Nominatim/settings/settings.php
tags:
- osm
#
# Nominatim base setup if to use postgis 1.5 but we have 2.0
# Only the firt occurence of '1.5' should be changed but since the
second one is in
# comment, who cares?
#
- name: Patch Nominatim/settings/settings.php (postgis version set to 2.0)
action: shell sed -i -e 's/1.5/2.0/'
/data/nominatim/Nominatim/settings/settings.php
tags:
- osm
#
# Since it was unclear for me what postgresql accounts are really used,
I decided to set up
# yet a new one: 'importer'
#
- name: Patch Nominatim/settings/settings.php (DB user for website is
'importer')
action: shell sed -i -e 's!@/nominatim!importer@/nominatim!'
/data/nominatim/Nominatim/settings/settings.php
tags:
- osm
#
# Mod_tile setup is the virtual host file loaded by httpd
#
- name: Have httpd to include a virtualhost file
action: lineinfile dest=/etc/httpd/conf/httpd.conf create=no
insertafter=EOF regexp="Include conf/virtual-hosts.conf" line="Include
conf/virtual-hosts.conf" state=present
tags:
- osm
- name: Copy our virtual host file
action: copy src=$conf/virtual-hosts.conf
dest=/etc/httpd/conf/virtual-hosts.conf owner=root mode=644
tags:
- osm
#
# It is unclear yet if this file is really needed or not. There is
'LoadTileConfigFile /etc/renderd.conf' in my
# virtual host file so I keep it at the moment.
#
- name: Copy renderd.conf which is referenced by virtual-hosts.conf
action: copy src=$conf/renderd.conf dest=/etc/renderd.conf owner=root
mode=644
tags:
- osm
#
# Setup nominatim subdir in www, to store symlinks that nominatim will
make later on
#
- name: Make /var/www/html/nominatim
action: shell mkdir -p /var/www/html/nominatim
tags:
- osm
#
# map.html comes from http://wiki.openstreetmap.org/wiki/HowTo_mod_tile
#
- name: Copy map.html into /var/www/html/nominatim
action: copy src=$conf/map.html dest=/var/www/html/nominatim owner=root
mode=644
tags:
- osm
- name: Setup /var/www/html/nominatim permissions
action: shell chown -R root:root /var/www/html/nominatim ; chmod 755
/var/www/html/nominatim
tags:
- osm
- name: Install links in website directory to nominatim code
action: shell chdir=/data/nominatim/Nominatim ./utils/setup.php
--create-website /var/www/html/nominatim
tags:
- osm
- name: Allow postgresql to look into /data/nominatim/
action: command chmod o+x /data/nominatim
tags:
- osm
- name: Allow postgresql to look into /data/nominatim/Nominatim
action: command chmod o+x /data/nominatim/Nominatim
tags:
- osm
- name: Allow postgresql to look into /data/nominatim/Nominatim/module
action: command chmod o+x /data/nominatim/Nominatim/module
tags:
- osm
- name: Make /data/pgsql/data
action: file path=/data/pgsql/data state=directory owner=postgres
group=postgres mode=700
tags:
- osm
- name: Test if /var/lib/pgsql is a symlink
action: command test -L /var/lib/pgsql
register: test_pgsql_symlink
ignore_errors: True
tags:
- osm
- name: Build symlink /var/lib/pgsql to /data/pgsql
action: shell cd /var/lib ; rm -rf pgsql ; ln -s /data/pgsql pgsql
when_failed: $test_pgsql_symlink
ignore_errors: True
tags:
- osm
#
# initdb fails if the database already exists, but we want to run the
ansible playbook many times
# in a row, to accept errors here.
#
- name: Initialize postgresql-server database
action: command chdir=/tmp sudo -u postgres initdb -D
/var/lib/pgsql/data -EUNICODE
when_failed: $test_pgsql_symlink
tags:
- osm
#
# The following tuning is supposed to be okay for a 32GB system (of
course the tuning info didn't mention any information about the versions
of the involved components).
# However using F18 with 6 cores on a VM given 32GB, I've seen some
swapping. My VM currently uses 40GB (and still swaps a bit during
importation!)
#
- name: Tune postgresql.conf (step 1)
action: shell sed -i -e 's/#* *shared_buffers.*=.*/shared_buffers = 24GB
\# tuned by ansible (import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
- name: Tune postgresql.conf (step 2)
action: shell sed -i -e 's/#*
*maintenance_work_mem.*=.*/maintenance_work_mem = 10GB \# tuned by
ansible (import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
- name: Tune postgresql.conf (step 3)
action: shell sed -i -e 's/#* *work_mem.*=.*/work_mem = 50MB \# tuned by
ansible (import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
- name: Tune postgresql.conf (step 4)
action: shell sed -i -e 's/#*
*effective_cache_size.*=.*/effective_cache_size = 24GB \# tuned by
ansible (import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
- name: Tune postgresql.conf (step 5)
action: shell sed -i -e 's/#*
*synchronous_commit.*=.*/synchronous_commit = off \# tuned by ansible
(import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
- name: Tune postgresql.conf (step 6)
action: shell sed -i -e 's/#*
*checkpoint_segments.*=.*/checkpoint_segments = 100 \# tuned by ansible
(import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
- name: Tune postgresql.conf (step 7)
action: shell sed -i -e 's/#*
*checkpoint_timeout.*=.*/checkpoint_timeout = 10min \# tuned by ansible
(import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
- name: Tune postgresql.conf (step 8)
action: shell sed -i -e 's/#*
*checkpoint_completion_target.*=.*/checkpoint_completion_target = 0.9 \#
tuned by ansible (import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
- name: Tune postgresql.conf (step 9)
action: shell sed -i -e 's/#* *fsync.*=.*/fsync = off \# tuned by
ansible (import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
- name: Tune postgresql.conf (step 10)
action: shell sed -i -e 's/#* *full_page_writes.*=.*/full_page_writes =
off \# tuned by ansible (import setup)/' /data/pgsql/data/postgresql.conf
tags:
- osm
#
# The shared memory setup of the kernel must be modified accordingly,
hence a small tuning file is uploaded
#
- name: The previous postgresql tuning requires tuning in the kernel
(copy conf file)
action: copy src=$conf/postgresql-import-ansible.conf
dest=/etc/sysctl.d/postgresql-import-ansible.conf owner=root mode=644
tags:
- osm
- name: Apply kernel tuning conf change
action: command sysctl --system
tags:
- osm
#
# Nominatim documents the need for a symlink, but obviously it doesn't
fit well Fedora. I made a dirty work-around
# with 3 symlinks, this could be probably cleaned up.
#
- name: Make symlink required by Nominatim (official)
action: command ln -fs /usr/share/pgsql/contrib/postgis-64.sql
/usr/share/pgsql/contrib/postgis-2.0/postgis.sql
tags:
- osm
- name: Make symlink required by Nominatim (ours 1)
action: command ln -fs /usr/share/pgsql /usr/share/postgresql
tags:
- osm
- name: Make symlink required by Nominatim (ours 2)
action: command ln -fs /usr/share/pgsql /usr/share/postgresql/9.2
tags:
- osm
- name: Start postgresql
action: service name=postgresql state=running
tags:
- osm
- name: Create DB 'gis', accept error if already created
action: shell sudo -u postgres createdb -EUNICODE gis
ignore_errors: True
tags:
- osm
# Is this user really used? don't know yet
- name: Create 'apache' user for DB, accept error if already created
action: shell sudo -u postgres createuser -S -D -R apache
ignore_errors: True
tags:
- osm
# user 'www-data' unused at the moment (?)
- name: Create 'www-data' user for DB, accept error if already created
action: shell sudo -u postgres createuser -S -D -R www-data
ignore_errors: True
tags:
- osm
#
# This is the 'usual' script importing for instance
/usr/share/pgsql/contrib/postgis-64.sql
# and granting privileges to apache (don't know if this is really needed)
#
- name: Copy script that setup rights for pgsql
action: copy src=$scripts/psqlconf.sh dest=/tmp/psqlconf.sh mode=555
owner=postgres
tags:
- osm
- name: Run script that setup rights for pgsql
action: shell sudo -u postgres /tmp/psqlconf.sh
tags:
- osm
- name: Have /data/osm to hold OSM data and scripts
action: file path=/data/osm state=directory owner=postgres
group=postgres mode=755
tags:
- osm
#
# I copy files from www.geofabrik.de to a local repo to avoid
# downloading them each time from Germany and overloading geofabrik servers.
#
- name: Test if OSM data file is already on target
action: command test -f /data/osm/$openstreetmap_planet
ignore_errors: True
register: has_osm_data
tags:
- osm
- name: Fetch OSM data from ... whatever repo you use ....
action: command chdir=/data/osm wget http://... whatever repo you
use.../$openstreetmap_planet
when_failed: $has_osm_data
tags:
- osm
- name: Make an 'importer' Linux user if not already available
action: user name=importer state=present
tags:
- osm
- name: Make an 'importer' postgresql user if not already available
action: shell sudo -u postgres createuser -s importer
ignore_errors: True
tags:
- osm
#
# Should change --all option to something more accurate since 'all'
implies 'createdb nominatim'
#
- name: Import OSM data with OSM2PGSQL for NOMINATIM (may fail if
nominatim db already exists)
action: shell sudo -u importer /data/nominatim/Nominatim/utils/setup.php
--osm-file /data/osm/$openstreetmap_planet --all
register: nominatim_1
ignore_errors: True
tags:
- osm
- name: Drop nominatim db if previous step failed
action: shell sudo -u postgres dropdb nominatim
when_failed: $nominatim_1
tags:
- osm
- name: New attempt to import OSM data with OSM2PGSQL for NOMINATIM
action: shell sudo -u importer /data/nominatim/Nominatim/utils/setup.php
--osm-file /data/osm/$openstreetmap_planet --all
when_failed: $nominatim_1
tags:
- osm
#
# If a huge import has been done, all the RAM declared to postgresql has
been allocated during the process.
#
- name: Stop postgresql (to release RAM)
action: service name=postgresql state=stopped
tags:
- osm
- name: Start postgresql
action: service name=postgresql state=running
tags:
- osm
#
# I apply what I've read everywhere, not knowing exactly what's this
information is.
#
- name: Add special phrases (step 1-1)
action: shell chdir=/tmp sudo -u importer
/data/nominatim/Nominatim/utils/specialphrases.php --countries
>/tmp/specialphrases_countries.sql
tags:
- osm
- name: Add special phrases (step 1-2)
action: shell chdir=/tmp sudo -u importer psql -d nominatim -f
/tmp/specialphrases_countries.sql
tags:
- osm
- name: Add special phrases (step 2-1)
action: shell chdir=/tmp sudo -u importer
/data/nominatim/Nominatim/utils/specialphrases.php --wiki-import
>/tmp/specialphrases_wiki.sql
tags:
- osm
- name: Add special phrases (step 2-2)
action: shell chdir=/tmp sudo -u importer psql -d nominatim -f
/tmp/specialphrases_wiki.sql
tags:
- osm
- name: Checkout Mapnik data from SVN (we'll use only data from it not
code since we have the mapnik RPM)
action: shell chdir=/data/osm svn co
http://svn.openstreetmap.org/applications/rendering/mapnik
tags:
- osm
- name: Test if coastline data (1) is already available
action: shell test -f /data/osm/world_boundaries-spherical.tgz
ignore_errors: True
register: world_boundaries_spherical
tags:
- osm
- name: Download coastline data (1)
action: shell chdir=/data/osm wget
http://tile.openstreetmap.org/world_boundaries-spherical.tgz
when_failed: $world_boundaries_spherical
tags:
- osm
- name: Test if coastline data (2) is already available
action: shell test -f /data/osm/processed_p.tar.bz2
ignore_errors: True
register: processed_pl
tags:
- osm
- name: Download coastline data (2)
action: shell chdir=/data/osm wget
http://tile.openstreetmap.org/processed_p.tar.bz2
when_failed: $processed_pl
tags:
- osm
- name: Test if coastline data (3) is already available
action: shell test -f /data/osm/shoreline_300.tar.bz2
ignore_errors: True
register: shoreline_300
tags:
- osm
- name: Download coastline data (3)
action: shell chdir=/data/osm wget
http://tile.openstreetmap.org/shoreline_300.tar.bz2
when_failed: $shoreline_300
tags:
- osm
- name: Test if file required since 2010 (1) is already available
action: shell test -f /data/osm/ne_10m_populated_places.zip
ignore_errors: True
register: 10m_populated_places
tags:
- osm
- name: Supplementary file required since 2010 (1)
action: shell chdir=/data/osm wget
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip
when_failed: $10m_populated_places
tags:
- osm
- name: Test if file required since 2010 (2) is already available
action: shell test -f /data/osm/110m_cultural.zip
ignore_errors: True
register: 110m_admin_0_boundary_lines
tags:
- osm
- name: Supplementary file required since 2010 (2)
action: shell chdir=/data/osm wget
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/110m_cultural.zip
when_failed: $110m_admin_0_boundary_lines
tags:
- osm
- name: Have /data/osm/mapnik to hold OSM data and scripts
action: file path=/data/osm state=directory owner=postgres
group=postgres mode=755
tags:
- osm
#
# Should find some test to avoid uncompressing these archives each time
#
- name: Extract world_boundaries-spherical.tgz
action: shell chdir=/data/osm/mapnik tar xvzf
/data/osm/world_boundaries-spherical.tgz
tags:
- osm
- name: Extract processed_p.tar.bz2
action: shell chdir=/data/osm/mapnik tar xvjf
/data/osm/processed_p.tar.bz2 -C world_boundaries
tags:
- osm
- name: Extract shoreline_300.tar.bz2
action: shell chdir=/data/osm/mapnik tar xvjf
/data/osm/shoreline_300.tar.bz2 -C world_boundaries
tags:
- osm
- name: Extract ne_10m_populated_places.zip
action: shell chdir=/data/osm/mapnik unzip -o
/data/osm/ne_10m_populated_places.zip -d world_boundaries
tags:
- osm
- name: Extract 110m_cultural.zip
action: shell chdir=/data/osm/mapnik unzip -o
/data/osm/110m_cultural.zip -d world_boundaries
tags:
- osm
#
# I just don't remember where I found these :-( Anyway the Fedora mapnik
RPM don't have any
# font bundled with them (Fedora policy: don't bundle fonts, have
separated font packages)
# It is probably possible to find them in a better way than keeping a copy.
#
- name: Copy fonts for mapnik (where did I get them :-( ?)
action: copy src=$rpm/mapnikfonts.tgz dest=/tmp
tags:
- osm
- name: Extract mapnik fonts
action: shell chdir=/data/osm/mapnik tar zxf /tmp/mapnikfonts.tgz
tags:
- osm
#
# Would it be possible to combine both mapnik/nominatim run of osm2pgsql
in a single one?
#
- name: Import data for Mapnik with OSM2PGSQL
action: shell sudo -u importer
/data/nominatim/Nominatim/osm2pgsql/osm2pgsql --slim -S
/data/nominatim/Nominatim/osm2pgsql/default.style -C 12000
/data/osm/$openstreetmap_planet
tags:
- osm
#
# Probably unneeded, I had to setup this to use some software, I don't
remember which one
#
- name: make /usr/bin/apxs2 a link to /bin/apxs
action: shell ln -fs /bin/apxs /usr/bin/apxs2
tags:
- osm
#
# Using rev 29418, no official version numbering for mod_tile...
#
- name: Get mod_tile source code (only for mod_tile, not renderd)
action: shell chdir=/data svn co
http://svn.openstreetmap.org/applications/utils/mod_tile/
tags:
- osm
- name: Autogen mod_tile.
action: shell chdir=/data/mod_tile ./autogen.sh
tags:
- osm
- name: Configure mod_tile.
action: shell chdir=/data/mod_tile ./configure
tags:
- osm
- name: Make mod_tile.
action: shell chdir=/data/mod_tile make
tags:
- osm
#
# It is unclear if these two steps are required or if the second one is
enough
#
- name: Install mod_tile (step 1/3)
action: shell chdir=/data/mod_tile make install
tags:
- osm
- name: Install mod_tile (step 2/3)
action: shell chdir=/data/mod_tile make install-mod_tile
tags:
- osm
- name: Install mod_tile (step 3/3)
action: shell chdir=/data/mod_tile ldconfig
tags:
- osm
- name: Have httpd to load module mod_tile
action: copy src=$conf/mod_tile.conf dest=/etc/httpd/conf.d/mod_tile.conf
tags:
- osm
- name: Provide legacy SQL function to GIS database
action: shell sudo -u postgres psql -d gis <
/usr/share/pgsql/contrib/postgis-2.0/legacy.sql
tags:
- osm
- name: Generate osm.xml file
action: shell chdir=/data/osm/mapnik ./generate_xml.py --dbname gis
--user importer --accept-none
tags:
- osm
- name: add a Tirex user
action: user name=tirex state=present
tags:
- osm
#
# Ours is 29418 with two changes: one to remove '-l[agg]' from the
output of 'mapnik-config',
# the second to avoid including mapnik/expression.php .
#
- name: bring our copy of Tirex
action: copy src=$rpm/tirex.tgz dest=/data owner=tirex mode=644
tags:
- osm
- name: Untar Tirex archive
action: shell chdir=/data tar zxf tirex.tgz
tags:
- osm
- name: Give /data/tirex to user tirex
action: shell chown -R tirex:tirex /data/tirex
tags:
- osm
- name: Make Tirex
action: shell sudo -u tirex chdir=/data/tirex make
tags:
- osm
- name: Install Tirex
action: shell chdir=/data/tirex make install
tags:
- osm
- name: Tirex install sets things we don't need in /etc/tirex, remove them
action: shell chdir=/etc/tirex/renderer rm -rf *.conf mapserver test wms
tags:
- osm
#
# The copied configuration only uses mapnik renderer, for a map named
# default, having tiles in /data/tiles/default
#
- name: Copy our Tirex configuration
action: copy src=$conf/tirex.conf.tar dest=/data owner=root
tags:
- osm
- name: Store Tirex configuration
action: shell chdir=/ tar xf /data/tirex.conf.tar
tags:
- osm
- name: Make /data/tiles/default (default is the name of the map, dunno
where to change this)
action: file path=/data/tiles/default state=directory owner=root mode=777
tags:
- osm
- name: Remove symlink /var/lib/mod_tile
action: shell rm -f /var/lib/mod_tile
tags:
- osm
- name: Make symlink from /var/lib/mod_tile to /data/tiles
action: shell ln -fs /data/tiles /var/lib/mod_tile
tags:
- osm
- name: Have directory /var/lib/tirex
action: file path=/var/lib/tirex state=directory owner=tirex mode=755
tags:
- osm
- name: Make symlink from /var/lib/mod_tile to /data/tiles
action: shell ln -fs /data/tiles /var/lib/mod_tile
tags:
- osm
- name: Make /var/log/tirex directory
action: file path=/var/log/tirex state=directory owner=tirex mode=755
tags:
- osm
#
# Fedora is using systemctl. One needs a '.service' script defining a
'simple' service
# (set using RemainAfterExit=yes), which runs a bash script that makes
/var/run/tirex
# (that disappears at reboot) and fires tirex-master and
tirex-backend-manager.
#
- name: Copy systemd service file that starts Tirex
action: copy src=$scripts/tirex.service
dest=/usr/lib/systemd/system/tirex.service
tags:
- osm
- name: Copy Tirex sh script that does the real invocations of Tirex at boot
action: copy src=$scripts/run_tirex.sh dest=/data/tirex/run_tirex.sh
owner=root mode=755
tags:
- osm
- name: Tell systemctl to reload files
action: command systemctl --system daemon-reload
tags:
- osm
- name: Enable systemd service file that starts Tirex
action: command systemctl enable tirex
tags:
- osm
- name: Allow use of /bin/tirex-master and /bin/tirex-backend-manager
with sudo and no tty (step 1)
action: lineinfile dest=/etc/sudoers create=no insertafter=EOF
regexp="Cmnd_AliasNOTTYCMDSTIREX = /bin/tirex-master,
/bin/tirex-backend-manager" line="Cmnd_AliasNOTTYCMDSTIREX =
/bin/tirex-master, /bin/tirex-backend-manager" state=present
tags:
- osm
- name: Allow use of /bin/tirex-master and /bin/tirex-backend-manager
with sudo and no tty (step 2)
action: lineinfile dest=/etc/sudoers create=no insertafter=EOF
regexp="Defaults!NOTTYCMDSTIREX!requiretty"
line="Defaults!NOTTYCMDSTIREX!requiretty" state=present
tags:
- osm
- name: Start systemd service file that calls tune file
action: service name=tirex state=started
tags:
- osm
#
# At this point, if http wasn't already running, start it.
# I should add cleanup steps to remove differents files.
#
Bernard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20130328/a92328a8/attachment-0001.html>
More information about the Tile-serving
mailing list