kopia lustrzana https://github.com/kartoza/docker-osm
Made changes
rodzic
7bb7ff699d
commit
09c7d382b6
|
@ -6,7 +6,7 @@ RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key a
|
|||
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
|
||||
RUN apt update && apt install -y python3-pip \
|
||||
libprotobuf-dev libleveldb-dev libgeos-dev \
|
||||
libpq-dev python3-dev postgresql-client-11 python-setuptools \
|
||||
libpq-dev python3-dev postgresql-client-12 python-setuptools \
|
||||
gdal-bin \
|
||||
--no-install-recommends
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"""
|
||||
|
||||
from sys import exit, stderr
|
||||
from os import environ, listdir
|
||||
from os import environ, listdir, path, mknod, remove
|
||||
from shutil import move
|
||||
from os.path import join, exists, abspath, isabs
|
||||
from psycopg2 import connect, OperationalError
|
||||
|
@ -253,7 +253,7 @@ class Importer(object):
|
|||
call(command)
|
||||
|
||||
def perform_cron(self):
|
||||
cron_sql = """ SELECT cron.schedule('*/59 * * * *', $$select clean_tables()$$); """
|
||||
cron_sql = """ SELECT cron.schedule('*/20 * * * *', $$select clean_tables()$$); """
|
||||
self.cursor.execute(cron_sql)
|
||||
|
||||
def locate_table(self, name):
|
||||
|
@ -273,6 +273,12 @@ class Importer(object):
|
|||
|
||||
call(clipper, shell=True)
|
||||
|
||||
def create_lock_file(self):
|
||||
importer_lockfile = path.join(self.default['SETTINGS'], '.importer.lock')
|
||||
remove(importer_lockfile)
|
||||
if not path.exists(importer_lockfile):
|
||||
mknod(importer_lockfile)
|
||||
|
||||
def run(self):
|
||||
"""First checker."""
|
||||
osm_tables = self.locate_table('osm_%')
|
||||
|
@ -282,8 +288,11 @@ class Importer(object):
|
|||
|
||||
if self.clip_json_file:
|
||||
self._first_pbf_import(['-limitto', self.clip_json_file])
|
||||
self.create_lock_file()
|
||||
else:
|
||||
self._first_pbf_import([])
|
||||
self.create_lock_file()
|
||||
|
||||
else:
|
||||
self.info(
|
||||
'The database is not empty. Let\'s import only diff files.')
|
||||
|
|
|
@ -6,10 +6,6 @@ RUN pip3 install -r /home/requirements.txt
|
|||
|
||||
ADD enrich.py /home/
|
||||
|
||||
RUN if [ ! -f /home/check_tables.sql ]; then \
|
||||
echo "SELECT EXISTS (SELECT 1 AS result from information_schema.tables where table_name like 'osm_%');" >> /home/check_tables.sql;\
|
||||
fi;
|
||||
|
||||
WORKDIR /home
|
||||
CMD ["python3", "-u", "/home/enrich.py"]
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue