chargetrip / clusterbuster

A Mapbox Vector Tile (MVT) map tiling server with built-in clustering and filtering
MIT License
92 stars 18 forks source link

Warning: No such label #44

Closed jmpmcmanus closed 4 years ago

jmpmcmanus commented 4 years ago

When I attempt to run the example I am not getting any clustered points, but instead get the following warning:

(node:19870) Warning: No such label 'ed40cf87-2b30-400d-bc99-75c92ca867f7' for console.timeEnd()

I think this is because the tileserver is not able to access the postgis database, which I am running in a docker container. Initially I was having problems loading the points data using setup.ts, but then I switched from using the dotenv to define how to access the database to using the more direct method of a connectionString:

const path = require('path'); const connectionString = 'region3db://postgres:adcirc@localhost:5432/gis'

import { Pool } from 'pg';

(async function() { const pool = new Pool({ connectionString: connectionString, });

After making that change I was able to load the data.

Would it be possible to use the connectionString method in lib/tiler.ts to create the pool instance, or is there another way to successfully connect to postgres when it is running in a docker container?

Below is more information on my settings.

The .env file contains the same information as above: PGUSER=postgres PGHOST=region3db PGPASSWORD=adcirc PGDATABASE=gis PGDATA=/var/lib/postgresql/data PGPORT=5432

I've also tried using the docker-compose.yml defining the database connection in the clusterbuster container as: environment: PGUSER: postgres PGHOST: region3db PGPASSWORD: adcirc PGDATABASE: gis PGPORT: 5432 but get the same results.

In lib/tiler.ts the pool instance is created with the following command:

const pool = new pg.Pool({ max: 100, ...pgPoolOptions, });

Where pgPoolOptions are defined in types/TileServerConfig.ts using PoolConfig from import { PoolConfig } from 'pg';. I assume PoolConfig is getting some of it's information from the .env file or docker-compose environment.

Thanks Jim

jmpmcmanus commented 4 years ago

I was over thinking this one. I tried PGHOST=localhost in the .env file, instead of PGHOST=container-name and it worked!

cosmin-petrescu commented 4 years ago

Hello @jmpmcmanus. Sorry for my late response. The console.timeEnd warning is generated by the debugging code, if you disable the debugging on clusterbuster you will not get that warning anymore.

Also, docker mounts the containers over localhost, so thats why you needed to set the ENV PGHOST to localhost.

jmpmcmanus commented 4 years ago

Thanks! On Tuesday, February 25, 2020, 10:13:31 AM EST, cosmin-petrescu notifications@github.com wrote:

Hello @jmpmcmanus. Sorry for my late response. The console.timeEnd warning is generated by the debugging code, if you disable the debugging on clusterbuster you will not get that warning anymore.

Also, docker mounts the containers over localhost, so thats why you needed to set the ENV PGHOST to localhost.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.