update to postgres 9.6 and postgis 2.4

pull/46/head
Etienne Trimaille 2018-03-19 12:04:37 +01:00
rodzic 4cb08e2666
commit eae1ccc278
4 zmienionych plików z 53 dodań i 51 usunięć

Wyświetl plik

@ -14,17 +14,18 @@ storage:
db: db:
# About the postgresql version, it should match in the dockerfile of docker-imposm3 # About the postgresql version, it should match in the dockerfile of docker-imposm3
image: kartoza/postgis:9.4-2.1 image: kartoza/postgis:9.6-2.4
# image: kartoza/postgis:10.0-2.4
container_name: dockerosm_db container_name: dockerosm_db
hostname: db hostname: db
environment: environment:
- USERNAME=docker - POSTGRES_USER=docker
- PASS=docker - POSTGRES_PASS=docker
- POSTGRES_DBNAME=gis
volumes_from: volumes_from:
- storage - storage
ports: # Uncomment to use the postgis database from outside the docker network
- "5432:5432" # ports:
# - "5432:5432"
imposm: imposm:
build: docker-imposm3 build: docker-imposm3
@ -34,11 +35,11 @@ imposm:
links: links:
- db:db - db:db
environment: environment:
- USER=docker - POSTGRES_USER=docker
- PASSWORD=docker - POSTGRES_PASS=docker
- PORT=5432 - POSTGRES_DBNAME=gis
- HOST=db - POSTGRES_PORT=5432
- DATABASE=gis - POSTGRES_HOST=db
# seconds between 2 executions of the script # seconds between 2 executions of the script
# if 0, then no update will be done, only the first initial import from the PBF # if 0, then no update will be done, only the first initial import from the PBF
- TIME=120 - TIME=120

Wyświetl plik

@ -14,17 +14,18 @@ storage:
db: db:
# About the postgresql version, it should match in the dockerfile of docker-imposm3 # About the postgresql version, it should match in the dockerfile of docker-imposm3
image: kartoza/postgis:9.4-2.1 image: kartoza/postgis:9.6-2.4
# image: kartoza/postgis:10.0-2.4
container_name: dockerosm_db container_name: dockerosm_db
hostname: db hostname: db
environment: environment:
- USERNAME=docker - POSTGRES_USER=docker
- PASS=docker - POSTGRES_PASS=docker
- POSTGRES_DBNAME=gis
volumes_from: volumes_from:
- storage - storage
ports: # Uncomment to use the postgis database from outside the docker network
- "5432:5432" # ports:
# - "5432:5432"
imposm: imposm:
build: docker-imposm3 build: docker-imposm3
@ -34,11 +35,11 @@ imposm:
links: links:
- db:db - db:db
environment: environment:
- USER=docker - POSTGRES_USER=docker
- PASSWORD=docker - POSTGRES_PASS=docker
- PORT=5432 - POSTGRES_DBNAME=gis
- HOST=db - POSTGRES_PORT=5432
- DATABASE=gis - POSTGRES_HOST=db
# seconds between 2 executions of the script # seconds between 2 executions of the script
# if 0, then no update will be done, only the first initial import from the PBF # if 0, then no update will be done, only the first initial import from the PBF
- TIME=120 - TIME=120

Wyświetl plik

@ -34,11 +34,11 @@ class Importer(object):
# Default values which can be overwritten by environment variable. # Default values which can be overwritten by environment variable.
self.default = { self.default = {
'TIME': 120, 'TIME': 120,
'USER': 'docker', 'POSTGRES_USER': 'docker',
'PASSWORD': 'docker', 'POSTGRES_PASS': 'docker',
'DATABASE': 'gis', 'POSTGRES_DBNAME': 'gis',
'HOST': 'db', 'POSTGRES_HOST': 'db',
'PORT': '5432', 'POSTGRES_PORT': '5432',
'SETTINGS': 'settings', 'SETTINGS': 'settings',
'CACHE': 'cache', 'CACHE': 'cache',
'IMPORT_DONE': 'import_done', 'IMPORT_DONE': 'import_done',
@ -189,28 +189,28 @@ class Importer(object):
try: try:
connection = connect( connection = connect(
"dbname='%s' user='%s' host='%s' password='%s'" % ( "dbname='%s' user='%s' host='%s' password='%s'" % (
self.default['DATABASE'], self.default['POSTGRES_DBNAME'],
self.default['USER'], self.default['POSTGRES_USER'],
self.default['HOST'], self.default['POSTGRES_HOST'],
self.default['PASSWORD'])) self.default['POSTGRES_PASS']))
self.cursor = connection.cursor() self.cursor = connection.cursor()
except OperationalError as e: except OperationalError as e:
print >> stderr, e print >> stderr, e
exit() exit()
self.postgis_uri = 'postgis://%s:%s@%s/%s' % ( self.postgis_uri = 'postgis://%s:%s@%s/%s' % (
self.default['USER'], self.default['POSTGRES_USER'],
self.default['PASSWORD'], self.default['POSTGRES_PASS'],
self.default['HOST'], self.default['POSTGRES_HOST'],
self.default['DATABASE']) self.default['POSTGRES_DBNAME'])
def import_custom_sql(self): def import_custom_sql(self):
"""Import the custom SQL file into the database.""" """Import the custom SQL file into the database."""
self.info('Running the post import SQL file.') self.info('Running the post import SQL file.')
command = ['psql'] command = ['psql']
command += ['-h', self.default['HOST']] command += ['-h', self.default['POSTGRES_HOST']]
command += ['-U', self.default['USER']] command += ['-U', self.default['POSTGRES_USER']]
command += ['-d', self.default['DATABASE']] command += ['-d', self.default['POSTGRES_DBNAME']]
command += ['-f', self.post_import_file] command += ['-f', self.post_import_file]
call(command) call(command)
@ -218,9 +218,9 @@ class Importer(object):
"""Import the QGIS styles into the database.""" """Import the QGIS styles into the database."""
self.info('Installing QGIS styles.') self.info('Installing QGIS styles.')
command = ['psql'] command = ['psql']
command += ['-h', self.default['HOST']] command += ['-h', self.default['POSTGRES_HOST']]
command += ['-U', self.default['USER']] command += ['-U', self.default['POSTGRES_USER']]
command += ['-d', self.default['DATABASE']] command += ['-d', self.default['POSTGRES_DBNAME']]
command += ['-f', self.qgis_style] command += ['-f', self.qgis_style]
call(command) call(command)
@ -231,9 +231,9 @@ class Importer(object):
""" """
self.info('Import clip function.') self.info('Import clip function.')
command = ['psql'] command = ['psql']
command += ['-h', self.default['HOST']] command += ['-h', self.default['POSTGRES_HOST']]
command += ['-U', self.default['USER']] command += ['-U', self.default['POSTGRES_USER']]
command += ['-d', self.default['DATABASE']] command += ['-d', self.default['POSTGRES_DBNAME']]
command += ['-f', self.clip_sql_file] command += ['-f', self.clip_sql_file]
call(command) call(command)
self.info('!! Be sure to run \'make import_clip\' !!') self.info('!! Be sure to run \'make import_clip\' !!')
@ -243,9 +243,9 @@ class Importer(object):
if self.count_table('clip') == 1: if self.count_table('clip') == 1:
self.info('Clipping') self.info('Clipping')
command = ['psql'] command = ['psql']
command += ['-h', self.default['HOST']] command += ['-h', self.default['POSTGRES_HOST']]
command += ['-U', self.default['USER']] command += ['-U', self.default['POSTGRES_USER']]
command += ['-d', self.default['DATABASE']] command += ['-d', self.default['POSTGRES_DBNAME']]
command += ['-c', 'SELECT clean_tables();'] command += ['-c', 'SELECT clean_tables();']
call(command) call(command)

Wyświetl plik

@ -155,10 +155,10 @@ The container will look for an OSM file (*.pbf) and its state file
With -e, you can add some settings : With -e, you can add some settings :
- TIME = 120, seconds between 2 executions of the script - TIME = 120, seconds between 2 executions of the script
- USER = docker, default user - POSTGRES_USER = docker, default user
- PASSWORD = docker, default password - POSTGRES_PASS = docker, default password
- HOST = db - POSTGRES_HOST = db
- PORT = 5432 - POSTGRES_PORT = 5432
- SETTINGS = settings, folder for settings (with *.json and *.sql) - SETTINGS = settings, folder for settings (with *.json and *.sql)
- CACHE = cache, folder for caching - CACHE = cache, folder for caching
- BASE_PBF = base_pbf, folder the OSM file - BASE_PBF = base_pbf, folder the OSM file