Giter Club home page Giter Club logo

tileserver-gl-varnish-docker's Introduction

Tileserver-gl with Varnish Cache

For ex.:

.
โ”— ๐Ÿ“‚ tileserver
  โ”— ๐Ÿ“œ docker-compose.yml
  โ”— ๐Ÿ“‚ data
    โ”— ๐Ÿ“œ config.json
    โ”— ๐Ÿ“œ style.json
    โ”— ๐Ÿ“œ myMbtiles1.mbtiles
    โ”— ๐Ÿ“œ myMbtiles2.mbtiles

docker-compose.yml

version: '3.7'
services: 
  tileserver:
    image: zingi/tileserver-gl-varnish:tileserver-gl-3.0.0_varnish-6.4.0
    container_name: tileserver
    ports: 
      - 80:8080 # tileserver only likes to be exposed at standard port: 80/443
      # - 3000:3000 never expose this port on the internet
    volumes: 
      - ./data:/data
    tmpfs: 
      - /usr/local/var/varnish:exec
    environment: 
      # how long things should be cached; https://varnish-cache.org/docs/6.3/reference/vcl.html#durations
      - CACHE_TTL=1d
{
  "data": { "snow": { "mbtiles": "snow.mbtiles" } },
  "styles": { "snow": { "style": "snowStyle.json" } }
}
{
  "version": 8,
  "name": "basic",
  "id": "basic",
  "sources": {
    "snow": {
      "url": "mbtiles://snow.mbtiles",
      "type": "vector"
    }
  },
  "layers": [
    {
      "id": "snow",
      "type": "fill",
      "source": "snow",
      "source-layer": "snow",
      "paint": {
        "fill-color": "#C69214",
        "fill-opacity": 0.5,
        "fill-outline-color": "rgba(0, 0, 0, 1)"
      }
    }
  ]
}

Backend API

On port 3000 a REST API is exposed to do actions on the tileserver and cache. It should only be used in docker internal networks and never be exposed to the internet. If the container name is tileserver, it can be accessed by other containers in the same docker network with: http://tileserver:3000

  • GET /
    • to test if a connection can be established to the backend api
  • POST /reload
    • Restarts the tileserver and purges the whole cache. Should be called if the .mbtiles files have changed.

Check Logs

Tileserver-gl Logs

docker exec -it tileserver pm2 logs tileserver

Backend API Logs

docker exec -it tileserver pm2 logs backend-api

tileserver-gl-varnish-docker's People

Contributors

dependabot[bot] avatar zingi avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.