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:
$(APXS) -c $(DEF_LDLIBS) $(AM_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/g_logger.c \
@srcdir@/src/renderd_config.c \
@srcdir@/src/store.c \
@srcdir@/src/store_file.c \
@srcdir@/src/store_file_utils.c \
@ -167,9 +168,10 @@ install-mod_tile:
$(APXS) -S LIBEXECDIR=$(DESTDIR)`$(APXS) \
-q LIBEXECDIR` -c -i $(DEF_LDLIBS) $(AM_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/g_logger.c \
@srcdir@/src/renderd_config.c \
@srcdir@/src/store.c \
@srcdir@/src/store_file.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.
.SH NAME
@ -14,7 +14,7 @@ This manual page documents briefly the \fBrenderd.conf\fR configuration file.
.PP
The default location is \fB'/etc/renderd.conf'\fR (macro definition \fB'RENDERD_CONFIG'\fR).
.PP
All option names are \fBcase-insensitive\fR unless otherwise specified.
All option names are \fBcase-insensitive\fR.
.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.
.TP
.B ASPECTX
.B aspectx
Specify the X aspect to be used by \fBmod_tile\fR.
Only used by \fBmod_tile\fR.
The default value is \fB'1'\fR.
This option name is \fBcase-sensitive\fR.
.TP
.B ASPECTY
.B aspecty
Specify the Y aspect to be used by \fBmod_tile\fR.
Only used by \fBmod_tile\fR.
The default value is \fB'1'\fR.
This option name is \fBcase-sensitive\fR.
.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).
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).
This option name is \fBcase-sensitive\fR.
.TP
.B CORS
.B cors
Specify the CORS configuration for \fBmod_tile\fR.
Only used by \fBmod_tile\fR.
This option name is \fBcase-sensitive\fR.
.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).
Only used by \fBmod_tile\fR.
This option name is \fBcase-sensitive\fR.
.TP
.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.
.TP
.B MAXZOOM
.B maxzoom
Specify the maximum zoom level for this section.
The default value is \fB'20'\fR (macro definition \fB'MAX_ZOOM'\fR).
This option name is \fBcase-sensitive\fR.
.TP
.B MINZOOM
.B minzoom
Specify the minimum zoom level for this section.
The default value is \fB'0'\fR.
This option name is \fBcase-sensitive\fR.
.TP
.B PARAMETERIZE_STYLE
.B parameterize_style
Specify the parameterization style/function to be used for this section.
The value of \fB'language'\fR seems to be the only one supported.
This option name is \fBcase-sensitive\fR.
.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).
Only used by \fBmod_tile\fR.
This option name is \fBcase-sensitive\fR.
.TP
.B scale
@ -173,10 +164,9 @@ Only used by \fBrenderd\fR.
The default value is \fB'1.0'\fR.
.TP
.B TILEDIR
.B tiledir
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).
This option name is \fBcase-sensitive\fR.
.TP
.B tilesize
@ -185,14 +175,12 @@ Only used by \fBrenderd\fR.
The default value is \fB'256'\fR.
.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).
This option name is \fBcase-sensitive\fR.
.TP
.B URI
.B uri
Specify the URI prefix with which tiles can be accessed for this section.
This option name is \fBcase-sensitive\fR.
.TP
.B xml

View File

@ -92,54 +92,54 @@ typedef struct stats_data {
} stats_data;
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;
int noHostnames;
int minzoom;
int maxzoom;
const char *attribution;
const char *baseuri;
const char *cors;
const char *description;
const char *fileExtension;
const char *mimeType;
const char *store;
const char *xmlname;
int aspect_x;
int aspect_y;
int enableOptions;
int maxzoom;
int minzoom;
int noHostnames;
} tile_config_rec;
typedef struct {
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_priority;
int max_load_old;
int max_load_missing;
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;
long delaypool_render_rate;
long delaypool_tile_rate;
} tile_server_conf;
typedef struct tile_request_data {

View File

@ -77,10 +77,12 @@ set(mod_tile_SRCS
${COMMON_SRCS}
${STORE_SRCS}
mod_tile.c
renderd_config.c
)
set(mod_tile_LIBS
${APR_LIBRARIES}
${COMMON_LIBRARIES}
${INIPARSER_LIBRARIES}
${STORE_LIBRARIES}
)
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
exit 1;
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
)
@ -1062,33 +1070,33 @@ set(DIRECTIVES
set(DIRECTIVE_ERRORS
"AddTileConfig error, URL path 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 error, unable to open config file"
"ModTileCacheDurationDirty needs integer argument"
"ModTileCacheDurationLowZoom needs integer argument"
"ModTileCacheDurationLowZoom needs integer argument"
"ModTileCacheDurationMax needs integer argument"
"ModTileCacheDurationMediumZoom needs integer argument"
"ModTileCacheDurationMediumZoom needs integer argument"
"ModTileCacheDurationMinimum needs integer argument"
"ModTileCacheExtendedDuration needs integer argument"
"ModTileCacheLastModifiedFactor needs float argument"
"ModTileCacheDurationDirty argument must be an integer"
"ModTileCacheDurationLowZoom second argument must be an integer"
"ModTileCacheDurationLowZoom first argument must be an integer"
"ModTileCacheDurationMax argument must be an integer"
"ModTileCacheDurationMediumZoom second argument must be an integer"
"ModTileCacheDurationMediumZoom first argument must be an integer"
"ModTileCacheDurationMinimum argument must be an integer"
"ModTileCacheExtendedDuration argument must be an integer"
"ModTileCacheLastModifiedFactor argument must be a float"
"ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2 (0 => off\;
1 => use client\; 2 => use last entry in chain"
"ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2 (0 => off\;
1 => use client\; 2 => use last entry in chain"
"ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2"
"ModTileMaxLoadMissing needs integer argument"
"ModTileMaxLoadOld needs integer argument"
"ModTileMissingRequestTimeout needs integer argument"
"ModTileRenderdSocketAddr TCP port needs to be an integer argument"
"ModTileRequestTimeout needs integer argument"
"ModTileThrottlingRenders needs two numerical arguments, the first one must be integer"
"ModTileThrottlingRenders needs two numerical arguments, the first one must be integer"
"ModTileThrottlingTiles needs two numerical arguments, the first one must be integer"
"ModTileThrottlingTiles needs two numerical arguments, the first one must be integer"
"ModTileVeryOldThreshold needs integer argument"
"ModTileEnableTileThrottlingXForward argument must be an integer"
"ModTileMaxLoadMissing argument must be an integer"
"ModTileMaxLoadOld argument must be an integer"
"ModTileMissingRequestTimeout argument must be an integer"
"ModTileRenderdSocketAddr second argument must be an integer"
"ModTileRequestTimeout argument must be an integer"
"ModTileThrottlingRenders second argument must be a float"
"ModTileThrottlingRenders first argument must be an integer"
"ModTileThrottlingTiles second argument must be a float"
"ModTileThrottlingTiles first argument must be an integer"
"ModTileVeryOldThreshold argument must be an integer"
)
list(LENGTH DIRECTIVES DIRECTIVES_LENGTH)
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@
MAXZOOM=5
MINZOOM=0
SERVER_ALIAS=http://alias/
TILEDIR=@TILE_DIR@
URI=/tiles/@DEFAULT_MAP_NAME@/
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
@ -42,7 +43,6 @@ HTCPHOST=@HTTPD1_HOST@
MAXZOOM=20
MINZOOM=0
SCALE=1.0
SERVER_ALIAS=http://localhost/
TILEDIR=@TILE_DIR@
TILESIZE=256
URI=/tiles/htcp/
@ -53,8 +53,8 @@ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
[@DEFAULT_MAP_NAME@_parameterization]
PARAMETERIZE_STYLE=language
TILEDIR=@TILE_DIR@
TYPE=png image/png# Test two parts (rather than three)
URI=/tiles/parameterization# Test no trailing slash
TYPE=png image/png # Test two parts (rather than three)
URI=/tiles/parameterization # Test no trailing slash
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
# Test Comment: JPEG Map Section
@ -85,7 +85,7 @@ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
; Test Comment: WEBP Map Section
[webp]
TILEDIR=@TILE_DIR@
TYPE=webp image/webp webp
TYPE=webp image/webp webp # Test extra spaces
URI=/tiles/webp/
XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml

View File

@ -111,7 +111,7 @@ TEST_CASE("renderd_config min/max double lat generator", "min/max double generat
}
SECTION(option + " option is negative with --help", "should return 0") {
std::vector<std::string> argv = {option, std::to_string(min), "--help"};
std::vector<std::string> argv = {option, std::to_string(min), "--help"};
int status = run_command(test_binary, argv);
REQUIRE(WEXITSTATUS(status) == 0);