Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
80586aff5f | ||
|
b82e37b9b5 |
@@ -135,14 +135,16 @@ RUN echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" >> /etc/a
|
|||||||
&& a2enconf mod_tile && a2enconf mod_headers
|
&& a2enconf mod_tile && a2enconf mod_headers
|
||||||
COPY apache.conf /etc/apache2/sites-available/000-default.conf
|
COPY apache.conf /etc/apache2/sites-available/000-default.conf
|
||||||
COPY leaflet-demo.html /var/www/html/index.html
|
COPY leaflet-demo.html /var/www/html/index.html
|
||||||
RUN ln -sf /proc/1/fd/1 /var/log/apache2/access.log \
|
RUN ln -sf /dev/stdout /var/log/apache2/access.log \
|
||||||
&& ln -sf /proc/1/fd/2 /var/log/apache2/error.log
|
&& ln -sf /dev/stderr /var/log/apache2/error.log
|
||||||
|
|
||||||
# Configure PosgtreSQL
|
# Configure PosgtreSQL
|
||||||
COPY postgresql.custom.conf.tmpl /etc/postgresql/10/main/
|
COPY postgresql.custom.conf.tmpl /etc/postgresql/10/main/
|
||||||
RUN chown -R postgres:postgres /var/lib/postgresql \
|
RUN chown -R postgres:postgres /var/lib/postgresql \
|
||||||
&& chown postgres:postgres /etc/postgresql/10/main/postgresql.custom.conf.tmpl \
|
&& chown postgres:postgres /etc/postgresql/10/main/postgresql.custom.conf.tmpl \
|
||||||
&& echo "\ninclude 'postgresql.custom.conf'" >> /etc/postgresql/10/main/postgresql.conf
|
&& echo "\ninclude 'postgresql.custom.conf'" >> /etc/postgresql/10/main/postgresql.conf
|
||||||
|
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/10/main/pg_hba.conf \
|
||||||
|
&& echo "host all all ::/0 md5" >> /etc/postgresql/10/main/pg_hba.conf
|
||||||
|
|
||||||
# copy update scripts
|
# copy update scripts
|
||||||
COPY openstreetmap-tiles-update-expire /usr/bin/
|
COPY openstreetmap-tiles-update-expire /usr/bin/
|
||||||
|
31
README.md
31
README.md
@@ -92,6 +92,37 @@ docker run \
|
|||||||
run
|
run
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Connecting to Postgres
|
||||||
|
|
||||||
|
To connect to the PostgreSQL database inside the container, make sure to expose port 5432:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run \
|
||||||
|
-p 80:80 \
|
||||||
|
-p 5432:5432 \
|
||||||
|
-v openstreetmap-data:/var/lib/postgresql/10/main \
|
||||||
|
-d overv/openstreetmap-tile-server \
|
||||||
|
run
|
||||||
|
```
|
||||||
|
|
||||||
|
Use the user `renderer` and the database `gis` to connect.
|
||||||
|
|
||||||
|
```
|
||||||
|
psql -h localhost -U renderer gis
|
||||||
|
```
|
||||||
|
|
||||||
|
The default password is `renderer`, but it can be changed using the `PGPASSWORD` environment variable:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run \
|
||||||
|
-p 80:80 \
|
||||||
|
-p 5432:5432 \
|
||||||
|
-e PGPASSWORD=secret \
|
||||||
|
-v openstreetmap-data:/var/lib/postgresql/10/main \
|
||||||
|
-d overv/openstreetmap-tile-server \
|
||||||
|
run
|
||||||
|
```
|
||||||
|
|
||||||
## Performance tuning and tweaking
|
## Performance tuning and tweaking
|
||||||
|
|
||||||
Details for update procedure and invoked scripts can be found here [link](https://ircama.github.io/osm-carto-tutorials/updating-data/).
|
Details for update procedure and invoked scripts can be found here [link](https://ircama.github.io/osm-carto-tutorials/updating-data/).
|
||||||
|
@@ -21,3 +21,5 @@ random_page_cost = 1.1
|
|||||||
track_activity_query_size = 16384
|
track_activity_query_size = 16384
|
||||||
autovacuum_vacuum_scale_factor = 0.05
|
autovacuum_vacuum_scale_factor = 0.05
|
||||||
autovacuum_analyze_scale_factor = 0.02
|
autovacuum_analyze_scale_factor = 0.02
|
||||||
|
|
||||||
|
listen_addresses = '*'
|
||||||
|
13
run.sh
13
run.sh
@@ -2,13 +2,16 @@
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
function CreatePostgressqlConfig()
|
function createPostgresConfig() {
|
||||||
{
|
|
||||||
cp /etc/postgresql/10/main/postgresql.custom.conf.tmpl /etc/postgresql/10/main/postgresql.custom.conf
|
cp /etc/postgresql/10/main/postgresql.custom.conf.tmpl /etc/postgresql/10/main/postgresql.custom.conf
|
||||||
sudo -u postgres echo "autovacuum = $AUTOVACUUM" >> /etc/postgresql/10/main/postgresql.custom.conf
|
sudo -u postgres echo "autovacuum = $AUTOVACUUM" >> /etc/postgresql/10/main/postgresql.custom.conf
|
||||||
cat /etc/postgresql/10/main/postgresql.custom.conf
|
cat /etc/postgresql/10/main/postgresql.custom.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setPostgresPassword() {
|
||||||
|
sudo -u postgres psql -c "ALTER USER renderer PASSWORD '${PGPASSWORD:-renderer}'"
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo "usage: <import|run>"
|
echo "usage: <import|run>"
|
||||||
echo "commands:"
|
echo "commands:"
|
||||||
@@ -22,7 +25,7 @@ fi
|
|||||||
|
|
||||||
if [ "$1" = "import" ]; then
|
if [ "$1" = "import" ]; then
|
||||||
# Initialize PostgreSQL
|
# Initialize PostgreSQL
|
||||||
CreatePostgressqlConfig
|
createPostgresConfig
|
||||||
service postgresql start
|
service postgresql start
|
||||||
sudo -u postgres createuser renderer
|
sudo -u postgres createuser renderer
|
||||||
sudo -u postgres createdb -E UTF8 -O renderer gis
|
sudo -u postgres createdb -E UTF8 -O renderer gis
|
||||||
@@ -30,6 +33,7 @@ if [ "$1" = "import" ]; then
|
|||||||
sudo -u postgres psql -d gis -c "CREATE EXTENSION hstore;"
|
sudo -u postgres psql -d gis -c "CREATE EXTENSION hstore;"
|
||||||
sudo -u postgres psql -d gis -c "ALTER TABLE geometry_columns OWNER TO renderer;"
|
sudo -u postgres psql -d gis -c "ALTER TABLE geometry_columns OWNER TO renderer;"
|
||||||
sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO renderer;"
|
sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO renderer;"
|
||||||
|
setPostgresPassword
|
||||||
|
|
||||||
# Download Luxembourg as sample if no data is provided
|
# Download Luxembourg as sample if no data is provided
|
||||||
if [ ! -f /data.osm.pbf ]; then
|
if [ ! -f /data.osm.pbf ]; then
|
||||||
@@ -75,9 +79,10 @@ if [ "$1" = "run" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialize PostgreSQL and Apache
|
# Initialize PostgreSQL and Apache
|
||||||
CreatePostgressqlConfig
|
createPostgresConfig
|
||||||
service postgresql start
|
service postgresql start
|
||||||
service apache2 restart
|
service apache2 restart
|
||||||
|
setPostgresPassword
|
||||||
|
|
||||||
# Configure renderd threads
|
# Configure renderd threads
|
||||||
sed -i -E "s/num_threads=[0-9]+/num_threads=${THREADS:-4}/g" /usr/local/etc/renderd.conf
|
sed -i -E "s/num_threads=[0-9]+/num_threads=${THREADS:-4}/g" /usr/local/etc/renderd.conf
|
||||||
|
Reference in New Issue
Block a user