diff --git a/NEWS.md b/NEWS.md index e91ce097..25d49b4c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +1.1.4 (DD//MM//YY) +----- +* Reduce default extent to allow for consistent proj4 round-tripping +* Enhance reset_styles script to use full configuration (#62) +* Have reset_styles script also drop extended keys (#58) +* Fix example postgis parameter for simplifying input geoms (#63) +* Add row_limit to example config (#64) + 1.1.3 (30//11//12) ----- * Fix reset_styles script to really skip extended keys @@ -15,7 +23,6 @@ * styles with no semicolon * markers shift due to geometry clipping - 1.1.1 (DD//MM//YY) ----- * Add support for persistent client cache headers diff --git a/cluster.js b/cluster.js index 3d426735..d5501d17 100755 --- a/cluster.js +++ b/cluster.js @@ -44,7 +44,7 @@ var cluster = new Cluster({ host: global.environment.host, monPort: global.environment.port+1, monHost: global.environment.host, - timeout: 600000, + timeout: global.environment.socket_timeout, noWorkers: 1 }); diff --git a/config/environments/development.js.example b/config/environments/development.js.example index fd863822..050cfc45 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -2,22 +2,27 @@ var config = { environment: 'development' ,port: 8181 ,host: '127.0.0.1' + // idle socket timeout, in miliseconds + ,socket_timeout: 600000 ,enable_cors: true ,cache_enabled: false ,log_format: '[:date] :req[X-Real-IP] \033[90m:method\033[0m \033[36m:req[Host]:url\033[0m \033[90m:status :response-time ms -> :res[Content-Type]\033[0m' ,postgres_auth_user: 'development_cartodb_user_<%= user_id %>' ,postgres: { + // Parameters to pass to datasource plugin of mapnik + // See http://github.com/mapnik/mapnik/wiki/PostGIS type: "postgis", user: "publicuser", host: '127.0.0.1', port: 5432, - extent: "-20037508.5,-20037508.5,20037508.5,20037508.5", + extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", /* experimental geometry_field: "the_geom", extent: "-180,-90,180,90", srid: 4326, */ - simplify: true, + row_limit: 65535, + simplify_geometries: true, max_size: 500 } ,mapnik_version: undefined diff --git a/config/environments/production.js.example b/config/environments/production.js.example index ece7766b..e7a76715 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -2,16 +2,21 @@ var config = { environment: 'production' ,port: 8181 ,host: '127.0.0.1' + // idle socket timeout, in miliseconds + ,socket_timeout: 600000 ,enable_cors: true ,cache_enabled: true ,log_format: '[:date] :req[X-Real-IP] \033[90m:method\033[0m \033[36m:req[Host]:url\033[0m \033[90m:status :response-time ms -> :res[Content-Type]\033[0m' ,postgres_auth_user: 'cartodb_user_<%= user_id %>' ,postgres: { + // Parameters to pass to datasource plugin of mapnik + // See http://github.com/mapnik/mapnik/wiki/PostGIS user: "publicuser", host: '127.0.0.1', port: 6432, - extent: "-20037508.5,-20037508.5,20037508.5,20037508.5", - simplify: true, + extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", + row_limit: 65535, + simplify_geometries: true, max_size: 500 } ,mapnik_version: undefined diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 17b59546..dedb5001 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -2,16 +2,21 @@ var config = { environment: 'production' ,port: 8181 ,host: '127.0.0.1' + // idle socket timeout, in miliseconds + ,socket_timeout: 600000 ,enable_cors: true ,cache_enabled: true ,log_format: '[:date] :req[X-Real-IP] \033[90m:method\033[0m \033[36m:req[Host]:url\033[0m \033[90m:status :response-time ms -> :res[Content-Type]\033[0m' ,postgres_auth_user: 'cartodb_staging_user_<%= user_id %>' ,postgres: { + // Parameters to pass to datasource plugin of mapnik + // See http://github.com/mapnik/mapnik/wiki/PostGIS user: "publicuser", host: '127.0.0.1', port: 6432, - extent: "-20037508.5,-20037508.5,20037508.5,20037508.5", - simplify: true, + extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", + row_limit: 65535, + simplify_geometries: true, max_size: 500 } ,mapnik_version: undefined diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 44969cc4..096acb03 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -2,16 +2,21 @@ var config = { environment: 'test' ,port: 8888 ,host: '127.0.0.1' + // idle socket timeout, in miliseconds + ,socket_timeout: 600000 ,enable_cors: true ,cache_enabled: false ,log_format: '[:date] :req[X-Real-IP] :method :req[Host]:url :status :response-time ms -> :res[Content-Type]' ,postgres_auth_user: 'test_cartodb_user_<%= user_id %>' ,postgres: { + // Parameters to pass to datasource plugin of mapnik + // See http://github.com/mapnik/mapnik/wiki/PostGIS user: "publicuser", host: '127.0.0.1', port: 5432, - extent: "-20037508.5,-20037508.5,20037508.5,20037508.5", - simplify: true, + extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", + row_limit: 65535, + simplify_geometries: true, max_size: 500 } ,mapnik_version: '2.0.2' diff --git a/package.json b/package.json index 0e687ed6..a94bc376 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "windshaft-cartodb", - "version": "1.1.3", + "version": "1.1.4", "description": "A map tile server for CartoDB", "url": "https://github.com/Vizzuality/Windshaft-cartodb", "licenses": [{ diff --git a/tools/reset_styles b/tools/reset_styles index 3a475a9f..b45c1a6b 100755 --- a/tools/reset_styles +++ b/tools/reset_styles @@ -1,5 +1,18 @@ #!/usr/bin/env node +/* + +This scripts drops all extended map_style keys in redis and regenerates +the XML caches in all the base ones to target the configured mapnik_version. + +Optionally (with --convert) it also re-writes the CartoCSS if needed +to target the configured mapnik_version. + +It is recommended to make a backup of the redis database before using +this script. + +*/ + var path = require('path'); // Reset all styles in the store @@ -8,43 +21,45 @@ var mapnik = require('mapnik'); var redis = require('redis'); function usage(me, exitcode) { - console.log("Usage: " + me + " [--convert] []"); + console.log("Usage: " + me + " [--convert] "); process.exit(exitcode); } var doConvert = false; -var MAPNIK_VERSION; var node_path = process.argv.shift(); var script_path = process.argv.shift(); var me = path.basename(script_path); +var ENV; var arg; while ( arg = process.argv.shift() ) { if ( arg == '--convert' ) { doConvert = true; - } else if ( ! MAPNIK_VERSION ) { - MAPNIK_VERSION = arg; + } + else if ( ! ENV ) { + ENV = arg; } else { usage(me, 1); } } -if ( ! MAPNIK_VERSION ) { - MAPNIK_VERSION = mapnik.versions.mapnik; -} +if ( ! ENV ) usage(me, 1); + +global.environment = require('../config/environments/' + ENV); +var serverOptions = require('../lib/cartodb/server_options'); // _after_ setting global.environment + +var MAPNIK_VERSION = global.environment.mapnik_version || mapnik.versions.mapnik; console.log( (doConvert ? "Converting" : "Resetting" ) + ' all styles to target ' + MAPNIK_VERSION); -var REDIS_PORT = 6379; // TODO: make a command line parameter - var dbnum = 0; -var mml_store = new grainstore.MMLStore({port:REDIS_PORT}, {mapnik_version:MAPNIK_VERSION}); +var mml_store = new grainstore.MMLStore(serverOptions.redis, serverOptions.grainstore); var failures = []; -var client = redis.createClient(REDIS_PORT, 'localhost'); +var client = redis.createClient(serverOptions.redis.port, serverOptions.redis.host); client.on('connect', function() { client.select(dbnum); client.keys('map_style|*', function(err, matches) { @@ -54,10 +69,12 @@ client.on('connect', function() { var k = matches.shift(); if ( /map_style\|.*\|.*\|/.test(k) ) { - //console.warn("Key " + k + " is EXTENDED, skipping"); - // TODO: drop instead ? // See https://github.com/Vizzuality/Windshaft-cartodb/issues/58 - processNext(); + //console.warn("Key " + k + " is EXTENDED, dropping"); + client.del(k, function(err) { + if ( err ) console.warn("Error dropping key " + k); + processNext(); + }); return; }