mod_tile icon indicating copy to clipboard operation
mod_tile copied to clipboard

merging per-server and per-virtualhost config is buggy

Open woodpeck opened this issue 7 years ago • 6 comments

When you have some configuration options inside a <VirtualHost>...</VirtualHost> block in Apache, and some others outside (e.g. in a Debian-type "conf_enabled/tileserver.conf" file), then things break and mod_tile reverts to default settings for some things. This is likely due to an issue with create_tile_config and merge_tile_config which I need to debug further.

woodpeck avatar Aug 28 '18 10:08 woodpeck

Subscribing because I had to debug a problem caused by this. The config was like this, with a /etc/apache2/confs-enabled/tileserver.conf for many mod_tile directives, but inside a <VirtualHost> there was a few AddTileConfig directives.

The tile server worked for the first ~100 tile requests, and then it seemed to look for /var/run/renderd/renderd.sock. Since we don't use renderd, it causes 404s for all tiles. The solution was to put ModTileRenderdSocketName in the <VirtualHost> too.

amandasaurus avatar Mar 03 '21 10:03 amandasaurus

This bug can be reproduced with this apache config:

ModTileRenderdSocketName /run/tirex/modtile.sock
ModTileTileDir /var/cache/tirex/tiles
AddTileConfig /tiles/test test

<VirtualHost *:80>
		DocumentRoot /var/www/html
		LogLevel tile:debug

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined
		
		#AddTileConfig /tiles/test3 test 
</VirtualHost>

Running tirex with just a test config.

Get the tile works fine

sudo systemctl reload apache2 ; sudo rm /var/cache/tirex/tiles/test/0/0/0/0/0/0.meta  ; curl localhost/tiles/test/0/0/0.png

Uncomment the #AddTileConfig and it will break and lose the socket name

amandasaurus avatar Sep 19 '21 12:09 amandasaurus

in the create_tile_config, mod_tile will fill the the config with the default hard coded values, and then the apache directives will set them. so in the above case, the virtualhost will get a freshly created config, and that will be merged with the serverwide config and the hardcoded renderd socket name will be used

amandasaurus avatar Sep 19 '21 12:09 amandasaurus

I think if you put any config directives in a VirtualHost section, then any config options that you have set outside that are lost and replaced with the compiled in default values.

amandasaurus avatar Sep 19 '21 13:09 amandasaurus

@amandasaurus It'd probably help to know what OS you'd hit the problem on - my recollection (albeit from some time ago) is that Ubuntu is that significantly different from Debian in how Apache conf files are set up by default, which has a knock-on effect of "what includes what from where".

SomeoneElseOSM avatar Sep 19 '21 13:09 SomeoneElseOSM

this bug is visible on debian & ubuntu. Sorry for the comment spam, I am writing things down here because previously we have forgotten what the problem was.

amandasaurus avatar Sep 19 '21 13:09 amandasaurus