Also use renderd_config for mod_tile (#440)

Follow-up to #391 & #400
This commit is contained in:
Hummeltech
2024-06-19 09:20:50 -07:00
committed by GitHub
parent 9873dde1e8
commit e89046b5ee
8 changed files with 791 additions and 1341 deletions

View File

@ -149,9 +149,10 @@ test: gen_tile_test renderd_config_test renderd_test render_expired_test render_
all-local: all-local:
$(APXS) -c $(DEF_LDLIBS) $(AM_CFLAGS) \ $(APXS) -c $(DEF_LDLIBS) $(AM_CFLAGS) \
$(subst -pthread,-Wc$(COMMA)-pthread,$(GLIB_CFLAGS)) \ $(subst -pthread,-Wc$(COMMA)-pthread,$(GLIB_CFLAGS)) \
-I@srcdir@/includes $(AM_LDFLAGS) $(STORE_LDFLAGS) \ -I@srcdir@/includes $(AM_LDFLAGS) $(STORE_LDFLAGS) $(INIPARSER_LDFLAGS) \
@srcdir@/src/mod_tile.c \ @srcdir@/src/mod_tile.c \
@srcdir@/src/g_logger.c \ @srcdir@/src/g_logger.c \
@srcdir@/src/renderd_config.c \
@srcdir@/src/store.c \ @srcdir@/src/store.c \
@srcdir@/src/store_file.c \ @srcdir@/src/store_file.c \
@srcdir@/src/store_file_utils.c \ @srcdir@/src/store_file_utils.c \
@ -167,9 +168,10 @@ install-mod_tile:
$(APXS) -S LIBEXECDIR=$(DESTDIR)`$(APXS) \ $(APXS) -S LIBEXECDIR=$(DESTDIR)`$(APXS) \
-q LIBEXECDIR` -c -i $(DEF_LDLIBS) $(AM_CFLAGS) \ -q LIBEXECDIR` -c -i $(DEF_LDLIBS) $(AM_CFLAGS) \
$(subst -pthread,-Wc$(COMMA)-pthread,$(GLIB_CFLAGS)) \ $(subst -pthread,-Wc$(COMMA)-pthread,$(GLIB_CFLAGS)) \
-I@srcdir@/includes $(AM_LDFLAGS) $(STORE_LDFLAGS) \ -I@srcdir@/includes $(AM_LDFLAGS) $(STORE_LDFLAGS) $(INIPARSER_LDFLAGS) \
@srcdir@/src/mod_tile.c \ @srcdir@/src/mod_tile.c \
@srcdir@/src/g_logger.c \ @srcdir@/src/g_logger.c \
@srcdir@/src/renderd_config.c \
@srcdir@/src/store.c \ @srcdir@/src/store.c \
@srcdir@/src/store_file.c \ @srcdir@/src/store_file.c \
@srcdir@/src/store_file_utils.c \ @srcdir@/src/store_file_utils.c \

View File

@ -1,4 +1,4 @@
.TH RENDERD.CONF 5 "2024-03-16" "mod_tile v0.7.1" .TH RENDERD.CONF 5 "2024-06-06" "mod_tile v0.7.1"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.SH NAME .SH NAME
@ -14,7 +14,7 @@ This manual page documents briefly the \fBrenderd.conf\fR configuration file.
.PP .PP
The default location is \fB'/etc/renderd.conf'\fR (macro definition \fB'RENDERD_CONFIG'\fR). The default location is \fB'/etc/renderd.conf'\fR (macro definition \fB'RENDERD_CONFIG'\fR).
.PP .PP
All option names are \fBcase-insensitive\fR unless otherwise specified. All option names are \fBcase-insensitive\fR.
.SH RENDERD .SH RENDERD
@ -100,37 +100,32 @@ There must be at least one \fB[map]\fR section.
\fB[map]\fR section names can be anything else, but they must all be unique. \fB[map]\fR section names can be anything else, but they must all be unique.
.TP .TP
.B ASPECTX .B aspectx
Specify the X aspect to be used by \fBmod_tile\fR. Specify the X aspect to be used by \fBmod_tile\fR.
Only used by \fBmod_tile\fR. Only used by \fBmod_tile\fR.
The default value is \fB'1'\fR. The default value is \fB'1'\fR.
This option name is \fBcase-sensitive\fR.
.TP .TP
.B ASPECTY .B aspecty
Specify the Y aspect to be used by \fBmod_tile\fR. Specify the Y aspect to be used by \fBmod_tile\fR.
Only used by \fBmod_tile\fR. Only used by \fBmod_tile\fR.
The default value is \fB'1'\fR. The default value is \fB'1'\fR.
This option name is \fBcase-sensitive\fR.
.TP .TP
.B ATTRIBUTION .B attribution
Specify the data attribution to be provided by \fBmod_tile\fR as \fBTileJSON\fR (via \fB{URI}/tile-layer.json\fR). Specify the data attribution to be provided by \fBmod_tile\fR as \fBTileJSON\fR (via \fB{URI}/tile-layer.json\fR).
Only used by \fBmod_tile\fR. Only used by \fBmod_tile\fR.
The default value is \fB'&copy;<a href=\\\\\\"http://www.openstreetmap.org/\\\\\\">OpenStreetMap</a> and <a href=\\\\\\"http://wiki.openstreetmap.org/wiki/Contributors\\\\\\">contributors</a>, <a href=\\\\\\"http://opendatacommons.org/licenses/odbl/\\\\\\">(ODbL)</a>'\fR (macro definition \fB'DEFAULT_ATTRIBUTION'\fR). The default value is \fB'&copy;<a href=\\\\\\"http://www.openstreetmap.org/\\\\\\">OpenStreetMap</a> and <a href=\\\\\\"http://wiki.openstreetmap.org/wiki/Contributors\\\\\\">contributors</a>, <a href=\\\\\\"http://opendatacommons.org/licenses/odbl/\\\\\\">(ODbL)</a>'\fR (macro definition \fB'DEFAULT_ATTRIBUTION'\fR).
This option name is \fBcase-sensitive\fR.
.TP .TP
.B CORS .B cors
Specify the CORS configuration for \fBmod_tile\fR. Specify the CORS configuration for \fBmod_tile\fR.
Only used by \fBmod_tile\fR. Only used by \fBmod_tile\fR.
This option name is \fBcase-sensitive\fR.
.TP .TP
.B DESCRIPTION .B description
Specify the description to be provided by \fBmod_tile\fR as \fBTileJSON\fR (via \fB{URI}/tile-layer.json\fR). Specify the description to be provided by \fBmod_tile\fR as \fBTileJSON\fR (via \fB{URI}/tile-layer.json\fR).
Only used by \fBmod_tile\fR. Only used by \fBmod_tile\fR.
This option name is \fBcase-sensitive\fR.
.TP .TP
.B htcphost .B htcphost
@ -143,28 +138,24 @@ Specify the IP address/hostname of the Host to be used by \fBrenderd\fR for HTCP
Only used by \fBrenderd\fR. Only used by \fBrenderd\fR.
.TP .TP
.B MAXZOOM .B maxzoom
Specify the maximum zoom level for this section. Specify the maximum zoom level for this section.
The default value is \fB'20'\fR (macro definition \fB'MAX_ZOOM'\fR). The default value is \fB'20'\fR (macro definition \fB'MAX_ZOOM'\fR).
This option name is \fBcase-sensitive\fR.
.TP .TP
.B MINZOOM .B minzoom
Specify the minimum zoom level for this section. Specify the minimum zoom level for this section.
The default value is \fB'0'\fR. The default value is \fB'0'\fR.
This option name is \fBcase-sensitive\fR.
.TP .TP
.B PARAMETERIZE_STYLE .B parameterize_style
Specify the parameterization style/function to be used for this section. Specify the parameterization style/function to be used for this section.
The value of \fB'language'\fR seems to be the only one supported. The value of \fB'language'\fR seems to be the only one supported.
This option name is \fBcase-sensitive\fR.
.TP .TP
.B SERVER_ALIAS .B server_alias
Specify a URL alias of this server to be provided by \fBmod_tile\fR as \fBTileJSON\fR (via \fB{URI}/tile-layer.json\fR). Specify a URL alias of this server to be provided by \fBmod_tile\fR as \fBTileJSON\fR (via \fB{URI}/tile-layer.json\fR).
Only used by \fBmod_tile\fR. Only used by \fBmod_tile\fR.
This option name is \fBcase-sensitive\fR.
.TP .TP
.B scale .B scale
@ -173,10 +164,9 @@ Only used by \fBrenderd\fR.
The default value is \fB'1.0'\fR. The default value is \fB'1.0'\fR.
.TP .TP
.B TILEDIR .B tiledir
Specify the directory path into which tiles will be written by \fBrenderd\fR. Specify the directory path into which tiles will be written by \fBrenderd\fR.
The default value is \fB'/var/cache/renderd/tiles'\fR (macro definition \fB'RENDERD_TILE_DIR'\fR). The default value is \fB'/var/cache/renderd/tiles'\fR (macro definition \fB'RENDERD_TILE_DIR'\fR).
This option name is \fBcase-sensitive\fR.
.TP .TP
.B tilesize .B tilesize
@ -185,14 +175,12 @@ Only used by \fBrenderd\fR.
The default value is \fB'256'\fR. The default value is \fB'256'\fR.
.TP .TP
.B TYPE .B type
Specify the tile configuration (in the format \fB'<extension> <mime-type> <output-format>'\fR) for this section (e.g. \fB'png image/png png256'\fR). Specify the tile configuration (in the format \fB'<extension> <mime-type> <output-format>'\fR) for this section (e.g. \fB'png image/png png256'\fR).
This option name is \fBcase-sensitive\fR.
.TP .TP
.B URI .B uri
Specify the URI prefix with which tiles can be accessed for this section. Specify the URI prefix with which tiles can be accessed for this section.
This option name is \fBcase-sensitive\fR.
.TP .TP
.B xml .B xml

View File

@ -92,54 +92,54 @@ typedef struct stats_data {
} stats_data; } stats_data;
typedef struct { typedef struct {
const char *store;
char xmlname[XMLCONFIG_MAX];
char baseuri[PATH_MAX];
char fileExtension[PATH_MAX];
char mimeType[PATH_MAX];
const char *description;
const char *attribution;
const char *cors;
char **hostnames; char **hostnames;
int noHostnames; const char *attribution;
int minzoom; const char *baseuri;
int maxzoom; const char *cors;
const char *description;
const char *fileExtension;
const char *mimeType;
const char *store;
const char *xmlname;
int aspect_x; int aspect_x;
int aspect_y; int aspect_y;
int enableOptions; int enableOptions;
int maxzoom;
int minzoom;
int noHostnames;
} tile_config_rec; } tile_config_rec;
typedef struct { typedef struct {
apr_array_header_t *configs; apr_array_header_t *configs;
apr_time_t very_old_threshold;
const char *cache_extended_hostname;
const char *renderd_socket_name;
const char *tile_dir;
double cache_duration_last_modified_factor;
int cache_duration_dirty;
int cache_duration_low_zoom;
int cache_duration_max;
int cache_duration_medium_zoom;
int cache_duration_minimum;
int cache_extended_duration;
int cache_level_low_zoom;
int cache_level_medium_zoom;
int delaypool_render_size;
int delaypool_tile_size;
int enable_bulk_mode;
int enable_dirty_url;
int enable_global_stats;
int enable_status_url;
int enable_tile_throttling;
int enable_tile_throttling_xforward;
int max_load_missing;
int max_load_old;
int mincachetime[MAX_ZOOM_SERVER + 1];
int renderd_socket_port;
int request_timeout; int request_timeout;
int request_timeout_priority; int request_timeout_priority;
int max_load_old; long delaypool_render_rate;
int max_load_missing; long delaypool_tile_rate;
apr_time_t veryold_threshold;
int cache_duration_dirty;
int cache_duration_max;
int cache_duration_minimum;
int cache_duration_low_zoom;
int cache_level_low_zoom;
int cache_duration_medium_zoom;
int cache_level_medium_zoom;
double cache_duration_last_modified_factor;
char renderd_socket_name[PATH_MAX];
int renderd_socket_port;
char tile_dir[PATH_MAX];
char cache_extended_hostname[PATH_MAX];
int cache_extended_duration;
int mincachetime[MAX_ZOOM_SERVER + 1];
int enableGlobalStats;
int enableTileThrottling;
int enableTileThrottlingXForward;
int delaypoolTileSize;
long delaypoolTileRate;
int delaypoolRenderSize;
long delaypoolRenderRate;
int bulkMode;
int enableStatusUrl;
int enableDirtyUrl;
} tile_server_conf; } tile_server_conf;
typedef struct tile_request_data { typedef struct tile_request_data {

View File

@ -77,10 +77,12 @@ set(mod_tile_SRCS
${COMMON_SRCS} ${COMMON_SRCS}
${STORE_SRCS} ${STORE_SRCS}
mod_tile.c mod_tile.c
renderd_config.c
) )
set(mod_tile_LIBS set(mod_tile_LIBS
${APR_LIBRARIES} ${APR_LIBRARIES}
${COMMON_LIBRARIES} ${COMMON_LIBRARIES}
${INIPARSER_LIBRARIES}
${STORE_LIBRARIES} ${STORE_LIBRARIES}
) )
add_library(mod_tile SHARED ${mod_tile_SRCS}) add_library(mod_tile SHARED ${mod_tile_SRCS})

File diff suppressed because it is too large Load Diff

View File

@ -1020,6 +1020,14 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH})
if [ \"\${TILE_DEFAULT_TILEJSON_VERSION}\" != \"2.0.0\" ]; then if [ \"\${TILE_DEFAULT_TILEJSON_VERSION}\" != \"2.0.0\" ]; then
exit 1; exit 1;
fi fi
TILE_DEFAULT_TILEJSON_TILES_0=$(echo \"\${TILE_DEFAULT_TILEJSON_OUTPUT}\" | ${JQ_EXECUTABLE} -r .tiles[0])
if [ \"\${TILE_DEFAULT_TILEJSON_TILES_0}\" != \"http://localhost/tiles/${DEFAULT_MAP_NAME}/{z}/{x}/{y}.png\" ]; then
exit 1;
fi
TILE_DEFAULT_TILEJSON_TILES_1=$(echo \"\${TILE_DEFAULT_TILEJSON_OUTPUT}\" | ${JQ_EXECUTABLE} -r .tiles[1])
if [ \"\${TILE_DEFAULT_TILEJSON_TILES_1}\" != \"http://alias/tiles/${DEFAULT_MAP_NAME}/{z}/{x}/{y}.png\" ]; then
exit 1;
fi
" "
WORKING_DIRECTORY tests WORKING_DIRECTORY tests
) )
@ -1062,33 +1070,33 @@ set(DIRECTIVES
set(DIRECTIVE_ERRORS set(DIRECTIVE_ERRORS
"AddTileConfig error, URL path not defined" "AddTileConfig error, URL path not defined"
"AddTileConfig error, name of renderd config not defined" "AddTileConfig error, name of renderd config not defined"
"The configured zoom level lies outside of the range supported by this server" "AddTileConfig error, the configured zoom level lies outside of the range supported by this server"
"LoadTileConfigFile takes one argument, load an entire renderd config file" "LoadTileConfigFile takes one argument, load an entire renderd config file"
"LoadTileConfigFile error, unable to open config file" "LoadTileConfigFile error, unable to open config file"
"ModTileCacheDurationDirty needs integer argument" "ModTileCacheDurationDirty argument must be an integer"
"ModTileCacheDurationLowZoom needs integer argument" "ModTileCacheDurationLowZoom second argument must be an integer"
"ModTileCacheDurationLowZoom needs integer argument" "ModTileCacheDurationLowZoom first argument must be an integer"
"ModTileCacheDurationMax needs integer argument" "ModTileCacheDurationMax argument must be an integer"
"ModTileCacheDurationMediumZoom needs integer argument" "ModTileCacheDurationMediumZoom second argument must be an integer"
"ModTileCacheDurationMediumZoom needs integer argument" "ModTileCacheDurationMediumZoom first argument must be an integer"
"ModTileCacheDurationMinimum needs integer argument" "ModTileCacheDurationMinimum argument must be an integer"
"ModTileCacheExtendedDuration needs integer argument" "ModTileCacheExtendedDuration argument must be an integer"
"ModTileCacheLastModifiedFactor needs float argument" "ModTileCacheLastModifiedFactor argument must be a float"
"ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2 (0 => off\; "ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2 (0 => off\;
1 => use client\; 2 => use last entry in chain" 1 => use client\; 2 => use last entry in chain"
"ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2 (0 => off\; "ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2 (0 => off\;
1 => use client\; 2 => use last entry in chain" 1 => use client\; 2 => use last entry in chain"
"ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2" "ModTileEnableTileThrottlingXForward argument must be an integer"
"ModTileMaxLoadMissing needs integer argument" "ModTileMaxLoadMissing argument must be an integer"
"ModTileMaxLoadOld needs integer argument" "ModTileMaxLoadOld argument must be an integer"
"ModTileMissingRequestTimeout needs integer argument" "ModTileMissingRequestTimeout argument must be an integer"
"ModTileRenderdSocketAddr TCP port needs to be an integer argument" "ModTileRenderdSocketAddr second argument must be an integer"
"ModTileRequestTimeout needs integer argument" "ModTileRequestTimeout argument must be an integer"
"ModTileThrottlingRenders needs two numerical arguments, the first one must be integer" "ModTileThrottlingRenders second argument must be a float"
"ModTileThrottlingRenders needs two numerical arguments, the first one must be integer" "ModTileThrottlingRenders first argument must be an integer"
"ModTileThrottlingTiles needs two numerical arguments, the first one must be integer" "ModTileThrottlingTiles second argument must be a float"
"ModTileThrottlingTiles needs two numerical arguments, the first one must be integer" "ModTileThrottlingTiles first argument must be an integer"
"ModTileVeryOldThreshold needs integer argument" "ModTileVeryOldThreshold argument must be an integer"
) )
list(LENGTH DIRECTIVES DIRECTIVES_LENGTH) list(LENGTH DIRECTIVES DIRECTIVES_LENGTH)
math(EXPR DIRECTIVES_LENGTH "${DIRECTIVES_LENGTH} - 1") math(EXPR DIRECTIVES_LENGTH "${DIRECTIVES_LENGTH} - 1")

View File

@ -12,6 +12,7 @@ ATTRIBUTION=Attribution for @DEFAULT_MAP_NAME@
DESCRIPTION=Description for @DEFAULT_MAP_NAME@ DESCRIPTION=Description for @DEFAULT_MAP_NAME@
MAXZOOM=5 MAXZOOM=5
MINZOOM=0 MINZOOM=0
SERVER_ALIAS=http://alias/
TILEDIR=@TILE_DIR@ TILEDIR=@TILE_DIR@
URI=/tiles/@DEFAULT_MAP_NAME@/ URI=/tiles/@DEFAULT_MAP_NAME@/
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
@ -42,7 +43,6 @@ HTCPHOST=@HTTPD1_HOST@
MAXZOOM=20 MAXZOOM=20
MINZOOM=0 MINZOOM=0
SCALE=1.0 SCALE=1.0
SERVER_ALIAS=http://localhost/
TILEDIR=@TILE_DIR@ TILEDIR=@TILE_DIR@
TILESIZE=256 TILESIZE=256
URI=/tiles/htcp/ URI=/tiles/htcp/
@ -53,8 +53,8 @@ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
[@DEFAULT_MAP_NAME@_parameterization] [@DEFAULT_MAP_NAME@_parameterization]
PARAMETERIZE_STYLE=language PARAMETERIZE_STYLE=language
TILEDIR=@TILE_DIR@ TILEDIR=@TILE_DIR@
TYPE=png image/png# Test two parts (rather than three) TYPE=png image/png # Test two parts (rather than three)
URI=/tiles/parameterization# Test no trailing slash URI=/tiles/parameterization # Test no trailing slash
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
# Test Comment: JPEG Map Section # Test Comment: JPEG Map Section
@ -85,7 +85,7 @@ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
; Test Comment: WEBP Map Section ; Test Comment: WEBP Map Section
[webp] [webp]
TILEDIR=@TILE_DIR@ TILEDIR=@TILE_DIR@
TYPE=webp image/webp webp TYPE=webp image/webp webp # Test extra spaces
URI=/tiles/webp/ URI=/tiles/webp/
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml