Overv / openstreetmap-tile-server

Docker file for a minimal effort OpenStreetMap tile server
Apache License 2.0
1.2k stars 482 forks source link

:latest dosn't include OSM2PGSQL_EXTRA_ARGS for update #133

Open besders opened 4 years ago

besders commented 4 years ago

Hi, many thanks for the great work. Unfortunately I have an error updating the data. When I start the container with the following command:

docker run \
    -p 80:80 \
    --restart=always \
    -e UPDATES=enabled \
    -v openstreetmap-data:/var/lib/postgresql/12/main \
    -v openstreetmap-rendered-tiles:/var/lib/mod_tile \
        -v openstreetmap-nodes:/nodes \
    -e THREADS=16 \
    -e "OSM2PGSQL_EXTRA_ARGS=-C 20000 --flat-nodes /nodes/flat_nodes.bin" \
    --shm-size=256MB \
    -d overv/openstreetmap-tile-server:latest \
    run

the Argument OSM2PGSQL_EXTRA_ARGS isn't included in the command for osm2pgsql startet from openstreetmap-tiles-update-expire

Istador commented 4 years ago

I think I found the problem: https://github.com/Overv/openstreetmap-tile-server/blob/2754592d1ceea1fb3148037b70b075ab1f7758db/openstreetmap-tiles-update-expire#L25

${OSM2PGSQL_EXTRA_ARGS} should be before the double quote character. A small error made with commit 2754592d1ceea1fb3148037b70b075ab1f7758db.

besders commented 4 years ago

Thank you for the fast reaction. That's exactly what I had already tested. Unfortunately without success

echo $OSM2PGSQL_EXTRA_ARGS works and outputs the corresponding parameters

Istador commented 4 years ago

That's exactly what I had already tested. Unfortunately without success

How did you test it?

besders commented 4 years ago

I changed the file outside of the container and then exchanged it via docker exec

VShkaberda commented 4 years ago

@Istador I got new fixed image. I checked environment variables and see:

 OSM2PGSQL_EXTRA_ARGS=-C 4096 --flat-nodes /nodes/flat_nodes.bin

But when I'm checking osm2pgsql.log I see

Node-cache: cache=800MB, maxblocks=12800*65536, allocation method=11
Mid: pgsql, cache=800

So, something is still broken or doesn't suppose to have influence on this cache?

atwebm commented 3 years ago

I noticed, that the env-Variable is only set at the root-User. when changing to renderer (with "su - renderer) the environment-variable is gone. The "openstreetmap-tiles-update-expire"-Script is running as the renderer-User and can not access the additional Options.

Istador commented 3 years ago

I noticed, that the env-Variable is only set at the root-User. when changing to renderer (with "su - renderer) the environment-variable is gone. The "openstreetmap-tiles-update-expire"-Script is running as the renderer-User and can not access the additional Options.

Good find.

I think it has less to do with the user, but the fact, that it runs as a cronjob and therefore in its own shell. If it were a root cronjob, it should have the same issue.

The - in su - renderer clears all environment variables except TERM. Just a su rederer should still have it.

https://stackoverflow.com/questions/27771781/how-can-i-access-docker-set-environment-variables-from-a-cron-job