Enabling Open Street Maps

Quick guide to enable OSM in staging servers

To enable OSM on a staging server, you'll need:

  • ssh access to the server (with admin rights)

  • an OFN user account (with superadmin rights)

  • a geocoder API key

Then, follow the steps:

  • Log in to the staging server via ssh and edit the configuration file for the respective environment. For OFN staging servers that should be ~/apps/openfoodnetwork/current/.env.staging

  • Comment or delete existing Google Maps and replace it with the Mapbox key.

    • #GOOGLE_MAPS_API_KEY=...

    • Add the GEOCODER_API_KEY=pk.eyJ1IjoiZmZ1cnR...<look within the testing section of Bitwarden>

  • restart puma sudo systemctl restart puma.service

  • Log in as superadmin and visit the Content section (under Configuration).

    • Find the MAP section and tick the Open Street Map enabled checkbox

    • Under Open Street Map provider name: add OpenStreetMap.Mapnik

    • Save the changes by clicking Update

Visit /map ; you should be looking at an OSM map 🎉

You can check it in the bottom-right corner of the map:

Last updated