-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathinitdb-postgis.sh
35 lines (30 loc) · 1.26 KB
/
initdb-postgis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
# Tune-up performance for `make import-sql`
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo " Pre-configuring Postgres 14 system"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
PGUSER="$POSTGRES_USER" "${psql[@]}" --dbname="$POSTGRES_DB" <<-'EOSQL'
ALTER SYSTEM SET jit = 'off';
EOSQL
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo " Loading OMT postgis extensions"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
for db in template_postgis "$POSTGRES_DB"; do
echo "Loading extensions into $db"
PGUSER="$POSTGRES_USER" "${psql[@]}" --dbname="$db" <<-'EOSQL'
-- Cleanup. Ideally parent container shouldn't pre-install those.
DROP EXTENSION IF EXISTS postgis_tiger_geocoder;
DROP EXTENSION IF EXISTS postgis_topology;
-- These extensions are already loaded by the parent docker
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
-- Extensions needed for OpenMapTiles
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS unaccent;
CREATE EXTENSION IF NOT EXISTS osml10n;
CREATE EXTENSION IF NOT EXISTS gzip;
EOSQL
done