mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-22 01:31:25 -08:00
Dockerizing pg_tileserv.
Setup, healthcheck, and init work but load data does not load.
This commit is contained in:
parent
c7fcec2063
commit
ead6bc6d1f
9 changed files with 4003 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.env
|
5
server/README.md
Normal file
5
server/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Tile Server
|
||||
|
||||
A simple tile server using [pg_tileserv](https://github.com/CrunchyData/pg_tileserv).
|
||||
|
||||
Based on pg_tileserv [docker example](https://github.com/CrunchyData/pg_tileserv/tree/master/examples/docker).
|
9
server/config/cache.env.example
Normal file
9
server/config/cache.env.example
Normal file
|
@ -0,0 +1,9 @@
|
|||
BACKENDS_PROBE_INTERVAL: "15s"
|
||||
BACKENDS_PROBE_TIMEOUT: "5s"
|
||||
BACKENDS_PROBE_WINDOW: "3"
|
||||
BACKENDS: "tileserv:7800"
|
||||
DNS_ENABLED: "false"
|
||||
DASHBOARD_USER: "admin"
|
||||
DASHBOARD_PASSWORD: "admin1234"
|
||||
DASHBOARD_SERVERS: "web"
|
||||
PARAM_VALUE: "-p default_ttl=600"
|
3
server/config/db.env.example
Normal file
3
server/config/db.env.example
Normal file
|
@ -0,0 +1,3 @@
|
|||
POSTGRES_USER=tileserv
|
||||
POSTGRES_PASSWORD=tileserv
|
||||
POSTGRES_DB=tileserv
|
4
server/config/tileserv.env.example
Normal file
4
server/config/tileserv.env.example
Normal file
|
@ -0,0 +1,4 @@
|
|||
DATABASE_URL=postgres://tileserv:tileserv@tileserv_db/tileserv
|
||||
POSTGRES_USER=tileserv
|
||||
POSTGRES_PASSWORD=tileserv
|
||||
POSTGRES_DB=tileserv
|
3933
server/data/maryland.geojson
Normal file
3933
server/data/maryland.geojson
Normal file
File diff suppressed because one or more lines are too long
40
server/docker-compose.yml
Normal file
40
server/docker-compose.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
version: "3.9" # optional since v1.27.0
|
||||
|
||||
services:
|
||||
tileserv:
|
||||
image: pramsey/pg_tileserv:20210210
|
||||
container_name: tileserv
|
||||
env_file:
|
||||
- ./config/tileserv.env
|
||||
depends_on:
|
||||
tileserv_db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- 7800:7800
|
||||
tileserv_db:
|
||||
image: postgis/postgis:13-master
|
||||
container_name: tileserv_db
|
||||
volumes:
|
||||
- ./data:/work
|
||||
- local_db:/var/lib/postgresql/data
|
||||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U tileserv"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
env_file:
|
||||
- ./config/db.env
|
||||
|
||||
# See https://blog.crunchydata.com/blog/production-postgis-vector-tiles-caching
|
||||
# cache:
|
||||
# image: eeacms/varnish
|
||||
# container_name: tileserv_cache
|
||||
# ports:
|
||||
# - "80:6081"
|
||||
# env_file:
|
||||
# - ./config/cache.env
|
||||
# depends_on:
|
||||
# - tileserv
|
||||
volumes:
|
||||
local_db:
|
1
server/init.sql
Normal file
1
server/init.sql
Normal file
|
@ -0,0 +1 @@
|
|||
CREATE EXTENSION postgis;
|
7
server/load-data.sh
Executable file
7
server/load-data.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Load Maryland geojson
|
||||
echo "Loading data..."
|
||||
docker-compose exec tileserv_db sh -c 'ogr2ogr -progress PG:"dbname=tileserv user=tileserv" /work/maryland.geojson'
|
||||
echo "Data load complete"
|
Loading…
Add table
Reference in a new issue