Comments (4)
With docker-compose and nginx this could look like so:
docker-compose.yml:
version: "3.7"
volumes:
openstreetmap-data:
openstreetmap-rendered-tiles:
services:
proxy:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./domain.crt:/etc/nginx/conf.d/domain.crt
- ./domain.key:/etc/nginx/conf.d/domain.key
ports:
- 0.0.0.0:80:80
- 0.0.0.0:443:443
depends_on:
- osm
restart: always
osm:
image: overv/openstreetmap-tile-server
command: run
environment:
- THREADS=24
volumes:
- openstreetmap-data:/var/lib/postgresql/10/main
- openstreetmap-rendered-tiles:/var/lib/mod_tile
shm_size: 128M
restart: always
nginx.conf:
server {
server_name _;
listen 80 default_server;
listen 443 ssl default_server;
ssl_certificate /etc/nginx/conf.d/domain.crt;
ssl_certificate_key /etc/nginx/conf.d/domain.key;
location ~ ^/tile/[0-9]+/[0-9]+/[0-9]+.png$ {
proxy_pass http://osm;
}
}
Initialization (in the same directory):
# generate certificate and private key
# (normally you want the cert signed by a CA. I'd recommend to use Let's Encrypt instead of this step)
openssl req -x509 -nodes -days 365 -newkey rsa:8192 -keyout domain.key -out domain.crt
# download PBF file
wget -O data.osm.pbf https://download.geofabrik.de/europe/germany/hamburg-latest.osm.pbf
# initializes the database and import the PBF file
docker-compose run -v "/`pwd`/data.osm.pbf":/data.osm.pbf osm import
# start the services
docker-compose up -d
# pre-render all tiles on zoom levels 0 to 5
docker-compose exec osm render_list -a -f -m ajt -z 0 -Z 5
If you want to use your already existing named volumes that contain your imported database and pre-rendered tiles (from your other issue), you can change the volumes
section to the following (and skip the import and pre-render in the Initialization):
volumes:
openstreetmap-data:
external: true
openstreetmap-rendered-tiles:
external: true
from openstreetmap-tile-server.
This project uses apache to serve the rendered tiles over HTTP.
Opening the 443 port didn't work for you, because the apache server inside the docker container isn't listening on port 443 to serve HTTPS but only HTTP on port 80.
In order to offer HTTPS by this docker image natively you would need to modify the apache.conf and mount your certificate and your private key into the docker container.
Alternatively you could put a proxy (e.g. traefik, nginx, apache) in-front of the OSM docker container that handles HTTP and HTTPS to the outside, either on your host system or encapsulated in another docker container on your system, that internally forwards the requests to the OSM container on port 80.
That way you don't have to modify the content of the OSM container and it - what I personally prefer - separates the HTTP(S) handling and especially the private key from the OSM container that maintains the postgres database, tile rendering and storage.
from openstreetmap-tile-server.
Additionally I recommend looking into the Let's Encrypt companion for nginx to simplify HTTPS even more.
from openstreetmap-tile-server.
this may help someone struggling with this:
in my case it was not enough to use nginx for enabling https, I also needed to configure a proxy this way:
https://www.serverlab.ca/tutorials/containers/docker/how-to-set-the-proxy-for-docker-on-ubuntu/
from openstreetmap-tile-server.
Related Issues (20)
- During the data import, will it be possible to create the indexes in parallel rather than sequencially? HOT 1
- hangs on startup HOT 3
- Segmentation fault during import HOT 5
- Run container over proxy with UPDATES=ENABLED parameter
- running server If I run the server, does it automatically render for all the files?
- Import command fails for OSM data
- Data/Labels not shown up on maps HOT 1
- How do I force latin names for countries like Greece or China? HOT 6
- Postgis Plugin: ERROR: could not resize shared memory segment "/PostgreSQL.2682777122" to 50438144 bytes: No space left on device HOT 1
- To optimise the rendering HOT 1
- Import not completing HOT 7
- Search filed?
- Postgres in container not working HOT 2
- Tile fetching behind reverse proxy HOT 1
- Postgres says rendrer user already exsists
- Error downloading tile file : i/0 time out HOT 3
- til-server automatic update: how to do? HOT 2
- Running out of space when downloading the planet HOT 3
- postgresql error HOT 1
- Automatize tile rendering of big country HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openstreetmap-tile-server.