From 02d447376684c26d73cfd2b0ba60d41eaad5bb89 Mon Sep 17 00:00:00 2001 From: Luis Bosque Date: Wed, 28 Nov 2012 16:43:19 +0100 Subject: [PATCH 1/9] Target version 1.1.4 --- NEWS.md | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index e730c575..71f74fe4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +1.1.4 (DD//MM//YY) +----- + 1.1.3 (DD//MM//YY) ----- * Fix reset_styles script to really skip extended keys diff --git a/package.json b/package.json index 716c6bcd..b288b895 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": [{ From 69508f05d754d0c9fc5f15dbcfc9825e0b0f1122 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 29 Nov 2012 10:20:37 +0100 Subject: [PATCH 2/9] Reduce default extent to allow for consistent proj4 round-tripping See https://github.com/Vizzuality/grainstore/issues/42 --- NEWS.md | 2 ++ config/environments/development.js.example | 2 +- config/environments/production.js.example | 2 +- config/environments/staging.js.example | 2 +- config/environments/test.js.example | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 71f74fe4..75bd876e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ 1.1.4 (DD//MM//YY) ----- +* Reduce default extent to allow for consistent proj4 round-tripping + 1.1.3 (DD//MM//YY) ----- diff --git a/config/environments/development.js.example b/config/environments/development.js.example index fd863822..45fe267a 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -11,7 +11,7 @@ var config = { 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", diff --git a/config/environments/production.js.example b/config/environments/production.js.example index ece7766b..8a906834 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -10,7 +10,7 @@ var config = { user: "publicuser", host: '127.0.0.1', port: 6432, - extent: "-20037508.5,-20037508.5,20037508.5,20037508.5", + extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", simplify: true, max_size: 500 } diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 17b59546..4cf03104 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -10,7 +10,7 @@ var config = { user: "publicuser", host: '127.0.0.1', port: 6432, - extent: "-20037508.5,-20037508.5,20037508.5,20037508.5", + extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", simplify: true, max_size: 500 } diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 44969cc4..91c8492c 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -10,7 +10,7 @@ var config = { 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", simplify: true, max_size: 500 } From 6f5e3837e3353366a28d0ca61a9b7f75fff36315 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 5 Dec 2012 13:59:20 +0100 Subject: [PATCH 3/9] Use an env config parameter for socket timeout --- cluster.js | 2 +- config/environments/development.js.example | 2 ++ config/environments/production.js.example | 2 ++ config/environments/staging.js.example | 2 ++ config/environments/test.js.example | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) 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 45fe267a..99871000 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -2,6 +2,8 @@ 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' diff --git a/config/environments/production.js.example b/config/environments/production.js.example index 8a906834..5477b528 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -2,6 +2,8 @@ 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' diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 4cf03104..7904f0d4 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -2,6 +2,8 @@ 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' diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 91c8492c..75fa12fd 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -2,6 +2,8 @@ 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]' From 4f8b855f1fa17d928d450613b300b7a979525f91 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 7 Dec 2012 18:58:31 +0100 Subject: [PATCH 4/9] Add reference to the list of accepted parameters for the postgres section --- config/environments/development.js.example | 2 ++ config/environments/production.js.example | 2 ++ config/environments/staging.js.example | 2 ++ config/environments/test.js.example | 2 ++ 4 files changed, 8 insertions(+) diff --git a/config/environments/development.js.example b/config/environments/development.js.example index 99871000..231226de 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -9,6 +9,8 @@ var config = { ,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', diff --git a/config/environments/production.js.example b/config/environments/production.js.example index 5477b528..a79f9933 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -9,6 +9,8 @@ var config = { ,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, diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 7904f0d4..8765b73c 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -9,6 +9,8 @@ var config = { ,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, diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 75fa12fd..63057607 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -9,6 +9,8 @@ var config = { ,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, From b884fe00eae8a94ecacb25ce3025a6a88e002a2f Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 7 Dec 2012 19:50:57 +0100 Subject: [PATCH 5/9] The parameter to simplify geometries is "simplify_geometries" Closes #63 --- config/environments/development.js.example | 2 +- config/environments/production.js.example | 2 +- config/environments/staging.js.example | 2 +- config/environments/test.js.example | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/environments/development.js.example b/config/environments/development.js.example index 231226de..df067180 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -21,7 +21,7 @@ var config = { extent: "-180,-90,180,90", srid: 4326, */ - simplify: true, + simplify_geometries: true, max_size: 500 } ,mapnik_version: undefined diff --git a/config/environments/production.js.example b/config/environments/production.js.example index a79f9933..b5be4040 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -15,7 +15,7 @@ var config = { host: '127.0.0.1', port: 6432, extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", - simplify: true, + simplify_geometries: true, max_size: 500 } ,mapnik_version: undefined diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 8765b73c..561e0385 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -15,7 +15,7 @@ var config = { host: '127.0.0.1', port: 6432, extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", - simplify: true, + simplify_geometries: true, max_size: 500 } ,mapnik_version: undefined diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 63057607..2136be14 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -15,7 +15,7 @@ var config = { host: '127.0.0.1', port: 5432, extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", - simplify: true, + simplify_geometries: true, max_size: 500 } ,mapnik_version: '2.0.2' From a8a3e739aded6d0af004f6191668f86309d0c715 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 7 Dec 2012 20:04:31 +0100 Subject: [PATCH 6/9] Change interface of reset_style to read full config from env files Closes #62 It is highly recommended to invoke reset_styles after upgrade --- tools/reset_styles | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tools/reset_styles b/tools/reset_styles index 3a475a9f..bd07d856 100755 --- a/tools/reset_styles +++ b/tools/reset_styles @@ -8,43 +8,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) { From 9d52b8b11f0352e3109223e43dcee2c47799d867 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 7 Dec 2012 20:06:26 +0100 Subject: [PATCH 7/9] Update NEWS --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 61e5dea4..4bcbe73b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,8 @@ 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) +* Fix example postgis parameter for simplifying input geoms (#63) 1.1.3 (30//11//12) ----- From 081cc41a342ddd8a97f491f05478d10fabc3e815 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 7 Dec 2012 20:20:21 +0100 Subject: [PATCH 8/9] Drop extended styles. Closes #58. Add some documentation in header. --- NEWS.md | 1 + tools/reset_styles | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 4bcbe73b..1a1779df 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ ----- * 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) 1.1.3 (30//11//12) diff --git a/tools/reset_styles b/tools/reset_styles index bd07d856..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 @@ -56,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; } From cc91e0dcff9a93329d415c6c3c9bab63b8c6f0ac Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 7 Dec 2012 20:34:24 +0100 Subject: [PATCH 9/9] Add a row limitof 65535 (256x256) in the example configs. Closes #64 --- NEWS.md | 1 + config/environments/development.js.example | 1 + config/environments/production.js.example | 1 + config/environments/staging.js.example | 1 + config/environments/test.js.example | 1 + 5 files changed, 5 insertions(+) diff --git a/NEWS.md b/NEWS.md index 1a1779df..25d49b4c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ * 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) ----- diff --git a/config/environments/development.js.example b/config/environments/development.js.example index df067180..050cfc45 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -21,6 +21,7 @@ var config = { extent: "-180,-90,180,90", srid: 4326, */ + row_limit: 65535, simplify_geometries: true, max_size: 500 } diff --git a/config/environments/production.js.example b/config/environments/production.js.example index b5be4040..e7a76715 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -15,6 +15,7 @@ var config = { host: '127.0.0.1', port: 6432, extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", + row_limit: 65535, simplify_geometries: true, max_size: 500 } diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 561e0385..dedb5001 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -15,6 +15,7 @@ var config = { host: '127.0.0.1', port: 6432, extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", + row_limit: 65535, simplify_geometries: true, max_size: 500 } diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 2136be14..096acb03 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -15,6 +15,7 @@ var config = { host: '127.0.0.1', port: 5432, extent: "-20037508.3,-20037508.3,20037508.3,20037508.3", + row_limit: 65535, simplify_geometries: true, max_size: 500 }