Terrastories Support Materials
  • Introduction
  • OVERVIEW
    • About Terrastories
      • How Terrastories is being used
    • FAQs
    • Getting started
    • Terrastories demo
  • USING TERRASTORIES
    • Exploring the Terrastories main interface
    • Using the Terrastories member dashboard
      • Exploring and creating stories, speakers, and places
      • Customizing your community theme
      • Setting up users and roles
      • Setting up an Explore Terrastories view for your community
      • Modifying map settings
      • Importing data
  • EXPLORE TERRASTORIES
    • What is Explore Terrastories?
    • Exploring the Explore Terrastories interface
    • Setting up Explore Terrastories for your community
  • Operating Terrastories Offline
    • Operating an offline Terrastories "Field Kit"
    • Preparing offline map packages
  • SETTING UP A TERRASTORIES SERVER
    • Hosting environments
      • 🌐 Hosting Terrastories online
      • 🛖 Hosting Terrastories offline as a "Field Kit"
        • Advanced Setup
      • 🍫 Hosting Terrastories on Kakawa (Earth Defenders Toolkit Offline)
    • Navigating the Super Admin dashboard
    • Setting up an Explore Terrastories server
  • MISCELLANEOUS
    • Support
    • Troubleshooting
      • Offline map tiles are not showing up
      • Resetting passwords (using the Rails console)
      • Saving and printing Terrastories reference materials
    • Translating Terrastories
    • Additional resources and references
    • For developers
  • Terrastories website
  • our.terrastories.app
Powered by GitBook
On this page
  • Use a custom offline map package
  • Use a custom Tileserver
  • Set up a custom Hostname
Export as PDF
  1. SETTING UP A TERRASTORIES SERVER
  2. Hosting environments
  3. 🛖 Hosting Terrastories offline as a "Field Kit"

Advanced Setup

Previous🛖 Hosting Terrastories offline as a "Field Kit"Next🍫 Hosting Terrastories on Kakawa (Earth Defenders Toolkit Offline)

Last updated 1 year ago

Use a custom offline map package

If you already have a custom map style package, you can proceed. Skip this configuration if you are comfortable using the default maps. Or, for offline use and come back.

Add your map package to the map/data folder. You can or download our default map package . Your map/data folder structure should look like:


data/
├── fonts/
│   └── Font Name/
│       ├── font.pbf
│       └── ...
├── sprites/
│   ├── sprite.png
│   └── ...
├── tiles.pmtiles
├── style.json
└── config.json

The three files that are absolutely required are style.json, config.json, and one or more tile sources (in mbtiles or pmtiles format). Fonts and sprites are only needed if your style is using them.

Your style specification must include reference to the name of your style:

{
  "sources": {
    "terrastories-map": { // This MUST be terrastories-map OR you MUST update the config.json file to reflect your chosen name
      "type": "vector", // or raster
      "url": "pmtiles://tiles.pmtiles" // or "mbtiles://tiles.mbtiles". If your tile filename has a different name instead of "tiles", then change that too.
    }
  },
  "sprite": "sprite", // optional, only needed if your style utilizes sprites by name
  "glyphs": "{fontstack}/{range}.pbf", // optional, only needed if your style utilizes fonts by name
  // the rest of your style specifications
}

Use a custom Tileserver

If you are already hosting your own Tileserver, update compose.yaml file to remove the tileserver service and update the TILESERVER_URL to point to your hosted Tileserver:

  web:
    image: terrastories/terrastories:latest
    restart: unless-stopped
    depends_on:
      - db
    ports:
      - 80:3000
      - 3000:3000
    environment:
      - RAILS_ENV=offline
      - HOST_HOSTNAME=terrastories.local
-     - TILESERVER_URL=http://terrastories.local:8080/styles/terrastories-map/style.json
+     - TILESERVER_URL=http://localhost:8080/styles/terrastories-map/style.json
      - DATABASE_URL=postgresql://terrastories:terrastories@db:5432/terrastories
    volumes:
      - ./media:/media
      - ./import:/api/import/media

-  tileserver:
-    restart: unless-stopped
-    image: terrastories/terrastories-map:latest
-    ports:
-      - 8080:8080

Set up a custom Hostname

In order to access your Terrastories instance, you'll need to configure a domain.

Access via "localhost" is disabled for offline mode for security. You must set a custom hostname for domain access.

You can setup our default terrastories.local, but you may also setup your own.

First, update your /etc/hosts file (you will need root/sudo write access), and add the following line:

127.0.0.1 terrastories.local

Save and close.

Replace terrastories.local with your desired host name.

If you utilized a custom domain (not terrastories.local), update your compose.yaml file:

  web:
    image: terrastories/terrastories:latest
    restart: unless-stopped
    depends_on:
      - db
    ports:
      - 80:3000
      - 3000:3000
    environment:
      - RAILS_ENV=offline
-      - HOST_HOSTNAME=terrastories.local
+      - HOST_HOSTNAME=your-custom-domain.local
-     - TILESERVER_URL=http://terrastories.local:8080/styles/terrastories-map/style.json
+     - TILESERVER_URL=http://your-custom-domain.local:8080/styles/terrastories-map/style.json
      - DATABASE_URL=postgresql://terrastories:terrastories@db:5432/terrastories
    volumes:
      - ./media:/media
      - ./import:/api/import/media

For more information on custom maps, please see the Github repository .

prepare your own map package
prepare your own
here
README.md