CartoDB / carto-vl

CARTO VL: a Javascript library to create vector-based visualizations
BSD 3-Clause "New" or "Revised" License
129 stars 26 forks source link

Update windshaft configuration files for CI #1403

Closed dgaubert closed 4 years ago

dgaubert commented 4 years ago

Related issue: https://github.com/CartoDB/carto-vl/issues/1411

elenatorro commented 4 years ago

I've managed to fix the docker images generation, but I'm still having problems in circle ci. There's something I'm not configuring properly when setting up the database:

Screenshot 2019-11-08 at 16 14 54

Basically, I'm getting:

{"mainError":{"statusCode":500,"message":"cannot connect to the database"...

https://circleci.com/gh/CartoDB/carto-vl/22317

It'd be great to get some help! :) @Algunenano @dgaubert

Algunenano commented 4 years ago

{"mainError":{"statusCode":500,"message":"cannot connect to the database"...

This looks like the port configured in the setup (https://github.com/CartoDB/carto-vl/blob/12a4c371c491eeeffab3e74548b026125ec9f3b4/test/acceptance/docker/config/environments/test.js#L95) and the one in Docker might not match. If you have access to the docker machine, can you check what port is the database running? In debian, you can use pg_lsclusters to see all active databases and their ports.

I guess that this updates also bring a PG11 update to the image, as it's called test-e2e-pg10 and I see:

 * Starting PostgreSQL 11 database server        

So it's likely that PG10 has the port 5432 assigned, and PG11 uses the following one (5433)

alrocar commented 4 years ago

I can see these errors in the postgres logs

2019-11-15 14:34:52.216 UTC [873] test_windshaft_cartodb_user_1@test_windshaft_cartodb_user_1_db FATAL:  role "test_windshaft_cartodb_user_1" does not exist

~I'm going to take a look who and when creates that user in postgres and why it's not being created.~

I'm updating the prepare_db.sh script since it seems it was outdated.

alrocar commented 4 years ago

I fixed some things locally and now I have a different error:

Failed to load resource: the server responded with a status of 403 (Forbidden)
[Error: CartoMapsAPIError: [Security] Unauthorized access to dataset: the provided apiKey('1234') doesn't provide access to the requested data
    at WindshaftRequestHelper._dealWithWindshaftErrors (http://localhost:5000/dist/carto-vl.js:15327:19)
    at WindshaftRequestHelper.getLayerGroup (http://localhost:5000/dist/carto-vl.js:15304:18)]

I've checked the requests to the Maps API are being done with the localhost user and api_key 1234. The API key exists in Redis and the database_role has grants over the tables requested... so I don't know what's happening.

~Any clue of what I could investigate?~ It was GRANTS over CDB_Tablemetadata

alrocar commented 4 years ago

I made the Docker container to work locally, but it's still failing in CI.

Not sure where the error comes from, wondering if it's either because the Docker image is not being rebuilt, the postgres service is taking longer to start than the timeout or :shrug:

alrocar commented 4 years ago

Forgot to push the changes in the Docker images to dockerhub...

but it seems we have 💚 back! \0/

elenatorro commented 4 years ago

I've added a section explaining how to build the docker images https://github.com/CartoDB/carto-vl/pull/1403/commits/d64cf021b895c68052f8fbd7ec71d6f4792b5aa1

Please, let me know if you think this is ok and this will be ready to merge 🚀 cc @alrocar