Merge pull request #28 from stevo01/stevo-autovacuum

stevo autovacuum
This commit is contained in:
Alexander Overvoorde 2019-04-23 21:37:14 +02:00 committed by GitHub
commit 5805f89698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 3 deletions

View File

@ -5,6 +5,7 @@ FROM ubuntu:18.04
# Set up environment # Set up environment
ENV TZ=UTC ENV TZ=UTC
ENV AUTOVACUUM=on
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install dependencies # Install dependencies
@ -132,9 +133,9 @@ RUN ln -sf /proc/1/fd/1 /var/log/apache2/access.log \
&& ln -sf /proc/1/fd/2 /var/log/apache2/error.log && ln -sf /proc/1/fd/2 /var/log/apache2/error.log
# Configure PosgtreSQL # Configure PosgtreSQL
COPY postgresql.custom.conf /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 \ && 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
# Start running # Start running

View File

@ -31,10 +31,18 @@ Tiles that have already been rendered will be stored in `/var/lib/mod_tile`. To
## Performance tuning ## Performance tuning
### THREADS
The import and tile serving processes use 4 threads by default, but this number can be changed by setting the `THREADS` environment variable. For example: The import and tile serving processes use 4 threads by default, but this number can be changed by setting the `THREADS` environment variable. For example:
docker run -p 80:80 -e THREADS=24 -v openstreetmap-data:/var/lib/postgresql/10/main -d overv/openstreetmap-tile-server run docker run -p 80:80 -e THREADS=24 -v openstreetmap-data:/var/lib/postgresql/10/main -d overv/openstreetmap-tile-server run
### AUTOVACUUM
The database use the autovacuum feature by default. This behavior can be changed with `AUTOVACUUM` environment variable. For example:
docker run -p 80:80 -e AUTOVACUUM=off -v openstreetmap-data:/var/lib/postgresql/10/main -d overv/openstreetmap-tile-server
## Troubleshooting ## Troubleshooting
### ERROR: could not resize shared memory segment ### ERROR: could not resize shared memory segment

12
run.sh
View File

@ -1,5 +1,14 @@
#!/bin/bash #!/bin/bash
set -x
function CreatePostgressqlConfig()
{
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
cat /etc/postgresql/10/main/postgresql.custom.conf
}
if [ "$#" -ne 1 ]; then if [ "$#" -ne 1 ]; then
echo "usage: <import|run>" echo "usage: <import|run>"
echo "commands:" echo "commands:"
@ -12,7 +21,7 @@ fi
if [ "$1" = "import" ]; then if [ "$1" = "import" ]; then
# Initialize PostgreSQL # Initialize PostgreSQL
sudo -u postgres echo "autovacuum = off" >> /etc/postgresql/10/main/postgresql.custom.conf CreatePostgressqlConfig
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
@ -36,6 +45,7 @@ fi
if [ "$1" = "run" ]; then if [ "$1" = "run" ]; then
# Initialize PostgreSQL and Apache # Initialize PostgreSQL and Apache
CreatePostgressqlConfig
service postgresql start service postgresql start
service apache2 restart service apache2 restart