Skip to content

Commit

Permalink
Fixing cache_expiration script and updating to trex 0.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kiambogo committed Jun 27, 2017
1 parent 8c5bb8a commit addd5a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions resources/tileserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y wget
RUN apt-get install -y wget python
RUN apt-get update
RUN apt-get install -y python-pip

RUN pip install -U psycopg2

WORKDIR /opt/t-rex

RUN wget https://github.com/pka/t-rex/releases/download/v0.7.2/t-rex-v0.7.2-x86_64-unknown-linux-gnu.tar.gz && tar xvf t-rex*
RUN wget https://github.com/pka/t-rex/releases/download/v0.7.5/t-rex-v0.7.5-x86_64-unknown-linux-gnu.tar.gz && tar xvf t-rex*

ADD cache_expiry.py cache-expiry.py
ADD config.toml config.toml

CMD ["/opt/t-rex/t_rex", "serve", "--config=/opt/t-rex/config.toml"]
# Write start script to start the expiration service and tileserver together
RUN echo """#!/bin/bash \n \
python /opt/t-rex/cache-expiry.py >> cache_expiration.log & \
./t_rex serve --config=/opt/t-rex/config.toml""" >> /start.sh
RUN chmod +x /start.sh

# Expose the tileserver port
EXPOSE 8080

CMD ["/start.sh"]
2 changes: 1 addition & 1 deletion resources/tileserver/cache_expiry.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
timestamp = row[1]
if bound is not None:
print 'Rendering tiles for bounding box ' + str(bound)
cmd = 'trex --config=/config.toml --extent=' + str(bound) + ' --ignore_cache=true --minzoom=0 --maxzoom=17'
cmd = 'cd /opt/t-rex && ./t_rex generate --config=/config.toml --extent=' + str(bound) + ' --overwrite=true --minzoom=0 --maxzoom=17'
FNULL = open(os.devnull, 'w')
subprocess.call(cmd, shell=True, stdout=FNULL, stderr=subprocess.STDOUT, close_fds=True)
cur.execute("UPDATE tile_cache_expirations SET processed_at = now() where created_at = (%s)", [timestamp])
Expand Down

0 comments on commit addd5a7

Please sign in to comment.