Skip to content

Commit

Permalink
Merge pull request #303 from OpenHistoricalMap/tiler-imposm
Browse files Browse the repository at this point in the history
Add Tiler imposm
  • Loading branch information
Rub21 authored May 8, 2024
2 parents e7b66c7 + c0d53fb commit f67dbfc
Show file tree
Hide file tree
Showing 16 changed files with 1,872 additions and 167 deletions.
315 changes: 155 additions & 160 deletions .github/workflows/chartpress.yaml

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
.env-tiler
tiler-db-data
tiler-imposm-data-2
tiler-imposm-data
tiler-imposm
images/data/
data/
images/.env
Expand All @@ -12,4 +8,6 @@ secrets
tegola
envs/.env.tiler
envs/.env.web
config.toml
config.toml
.DS_Store
*/.DS_Store
2 changes: 2 additions & 0 deletions chartpress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ charts:
valuesPath: osm-seed.db.image
tiler-db:
valuesPath: osm-seed.tilerDb.image
tiler-imposm:
valuesPath: osm-seed.tilerImposm.image
tiler-server:
valuesPath: osm-seed.tilerServer.image
tasking-manager-api:
Expand Down
26 changes: 26 additions & 0 deletions compose/tiler.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
version: '3.8'
services:
db:
image: ohm-tiler-db:v1
build:
context: ../images/tiler-db
dockerfile: Dockerfile
ports:
- "5433:5432"
volumes:
- ../data/tiler-db-data:/var/lib/postgresql/data
env_file:
- ../envs/.env.tiler
restart: always
imposm:
image: ohm-tiler-imposm:v1
build:
context: ../images/tiler-imposm
dockerfile: Dockerfile
volumes:
- ../data/tiler-imposm-data:/mnt/data
- ../images/tiler-imposm:/app
command:
- sh
- -c
- "sleep 60 && ./start.sh"
env_file:
- ../envs/.env.tiler
tiler:
image: ohm-tiler-server:v1
build:
Expand Down
61 changes: 61 additions & 0 deletions images/tiler-imposm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
FROM osgeo/gdal:ubuntu-small-3.2.3

RUN apt-get -y update
RUN apt-get install -y \
g++ \
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
libexpat1-dev \
zlib1g-dev \
libbz2-dev \
libpq-dev \
libgeos++-dev \
libproj-dev \
libleveldb-dev \
libgeos-dev \
libprotobuf-dev \
git-core \
curl \
wget \
unzip \
software-properties-common && \
rm -rf /var/lib/apt/lists/*

# # Install python
RUN add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y build-essential python3.6 python3.6-dev python3-pip && \
rm -rf /var/lib/apt/lists/* && \
python3 -m pip install pip --upgrade && \
python3 -m pip install wheel

# Install postgresql-client
RUN apt-get update && apt-get install -y postgresql-client && \
rm -rf /var/lib/apt/lists/*

# Install go
RUN wget -c https://dl.google.com/go/go1.10.linux-amd64.tar.gz -O - | tar -xz -C /usr/local
ENV PATH $PATH:/usr/local/go/bin

WORKDIR /go
ENV GOPATH /go
RUN go get github.com/omniscale/imposm3
WORKDIR $GOPATH/src/github.com/omniscale/imposm3
RUN git checkout v0.11.1
RUN go install github.com/omniscale/imposm3/cmd/imposm
ENV PATH $PATH:$GOPATH/bin

# Install awscli and gsutil to get the pbf file
RUN pip3 install -U setuptools
RUN pip3 install awscli
RUN pip3 install gsutil

ENV IMPOSMDATA /mnt/data
RUN mkdir -p $IMPOSMDATA && chmod 777 -R $IMPOSMDATA
WORKDIR $IMPOSMDATA
VOLUME $IMPOSMDATA

WORKDIR /osm
COPY . .
CMD ./start.sh
31 changes: 31 additions & 0 deletions images/tiler-imposm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Tiler imposm

This container is responsible to import the replication PBF files from osm-seed or OSM planet dump into the `tiler-db`

If we are running the container for the first time the container will import the [OSM Land](http://data.openstreetmapdata.com/land-polygons-split-3857.zip) and [Natural Earth dataset](http://nacis.org/initiatives/natural-earth) and [osm-land] files into the data bases. [Check more here](https://github.com/go-spatial/tegola-osm#import-the-osm-land-and-natural-earth-dataset-requires-gdal-natural-earth-can-be-skipped-if-youre-only-interested-in-osm).


### Configuration

In order to run this container we need environment variables, these can be found in the following files👇:

- [.env.tiler-db.example](./../../envs/.env.tiler-db.example)
- [.env.tiler-imposm.example](./../../envs/.env.tiler-imposm.example)

**Note**: Rename the above files as `.env.tiler-db` and `.env.tiler-imposm`

#### Running tiler-imposm container

```sh
# Docker compose
docker-compose run tiler-imposm

# Docker
docker run \
--env-file ./envs/.env.tiler-db \
--env-file ./envs/.env.tiler-imposm \
-v ${PWD}/data/tiler-imposm-data:/mnt/data \
--network osm-seed_default \
-it osmseed-tiler-imposm:v1
```

Loading

0 comments on commit f67dbfc

Please sign in to comment.