Jump to content

Maps/Keyspace Setup

From Wikitech

This page contains information on how to do a bunch of tasks. It leaves to other pages information on what tasks to do. Frequently the keyspace name will be referenced. These can be found in /etc/tilerator/config.yaml and come from the deploy process. In cases involving multiple keyspaces, the names will depend on what's being done.

Access to the tilerator account will be required for most commands.

Prerequisites

For most steps described here, the map data loading must be finished.

Several steps call for commands to be run in Cassandra. This is done with the cqlsh command, which is called like CQLSH_NO_BUNDLED=TRUE cqlsh -u tilerator -p <password> <hostname>, where <hostname> is one of the Cassandra IPs in the cassandra_servers array of /etc/tilerator/config-vars.yaml, and <password> is the cassandra_password variable from the same file. It's essential to use the tilerator user consistently.

Removing data

Steps in this section can remove all tiles from storage. Double-check you are connected to the right host and working on the right keyspace.

Connect to Cassandra and run DROP KEYSPACE <keyspace_name>;

Creating a keyspace

This section differs significantly from the old documentation, which called for a create-sources.yaml file which contained only the Cassandra source. That approach seems to run into errors where tileshell can't get the metadata for the source layer information

Tilerator can create a keyspace if createIfMissing: true is part of the params for the layer. By default this is false, so there is a special process for creation with tileshell.js. Tileshell needs a configuration file containing just the layers, but telling it the Cassandra repfactor and durablewrite settings, and where to get the metadata for the source like layer names, fields, etc.

1. Copy /etc/tilerator/config.yaml to your home directory with cp /etc/tilerator/config.yaml $HOME/create-sources.yaml

2. Remove everything from create-sources.yaml except the sources list, which is the content of the sources key of the conf list item of the services key. This requires removing text from the beginning and end, but does not require adjusting indentation. Don't forget to remove the line with sources: on it.

Typically the file will then start with

        # Generates vtiles from database
        genallraw:
          public: true
          formats: [pbf]
          uri: tmsource://
          yaml:
            npm: ['@kartotherian/meddo', 'data.yml']

3. Set repfactor, durablewrite, and createIfMissing: true as keys under params for the source which needs a keyspace created. Normally this can be done by uncommenting some lines and changing a false to true.

If using multiple keyspaces or changing vector tile schema in any way, double-check that the layer referenced is correct and the definition of that layer

4. Set which source is used for the tileset metadata of the keyspace. This is done by adding copyInfoFrom: {ref: gen} to params. Normally this can be done by uncommenting a line.

5. As the tilerator user, call tileshell.js with sudo -u tilerator node /srv/deployment/tilerator/deploy/node_modules/tilerator/scripts/tileshell.js --config /etc/tilerator/config.yaml --source $HOME/create-sources.yaml.

Tileshell should run and exit, with the information

info Loading variables from the config file
info Loading sources from /home/pnorman/create-sources.yaml
done

Copying tiles from an existing keyspace