Skip to content

Render Database Load

Paul Norman edited this page Sep 11, 2023 · 19 revisions

Database Load

  • Chef up server using the tile role if necessary
  • Create a temporary directory for the planet file under /store/tmp
  • Download planet.pbf and check the md5sum
  • Stop chef-client, apache2, renderd and replicate services
  • Check the drive has space free with df -h /var/lib/postgresql/*/main
  • Load planet with sudo -u tile osm2pgsql --slim --database=gis --cache=0 --flat-nodes=/store/database/nodes --number-processes=16 --multi-geometry --hstore --style=/srv/tile.openstreetmap.org/styles/default/openstreetmap-carto.style --tag-transform-script=/srv/tile.openstreetmap.org/styles/default/openstreetmap-carto.lua planet-latest.osm.pbf
  • Create additional indexes using sudo -u tile psql -d gis -f /srv/tile.openstreetmap.org/styles/default/indexes.sql
  • Initialise replication - find a sequence number from before planet and set replicate with echo -n SEQUENCE_NUM| sudo tee /var/lib/replicate/sequence.txt then start the replicate service and let the replication catch up
  • Run chef-client which should fix the database permissions and start renderd and apache2
  • Render low zoom tiles with sudo -u tile render_list --all --force --tile-dir=/srv/tile.openstreetmap.org/tiles --socket=/var/run/renderd/renderd.sock --num-threads=N --max-load=70 --min-zoom=0 --max-zoom=12

Fastly setup

  • Check server is responding to HTTP with https://<servername>.openstreetmap.org/
  • Log into Fastly Manage and create new configuration version
  • Add a new host under Origins->Hosts with hostname of new server
  • Attach host to request disabled condition
  • Edit host to have a name of server name (not domain name), certificate hostname of render.openstreetmap.org, SNI hostname of render.openstreetmap.org, health check of GET /0/0/0.png, and first byte timeout of 12000
  • Edit Define Directors VCL snippet to add new backend to appropriate groups with a weight of 1. A new server should start with <1% of a region's traffic
  • Edit respond to healthcheck endpoint VCL snippet to include new server
  • Review new config and activate
Clone this wiki locally