-
Notifications
You must be signed in to change notification settings - Fork 2
/
initdb-extensions.sh
100 lines (68 loc) · 1.96 KB
/
initdb-extensions.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh
### OTHERS :
# Load uuid-ossp (UUIDV4)
(
echo "Loading uuid-ossp (UUIDV4) extension"
psql -U $POSTGRES_USER -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp" CASCADE;'
)
# Load hstore
(
echo "Loading hstore extension"
psql -U $POSTGRES_USER -c 'CREATE EXTENSION IF NOT EXISTS hstore CASCADE;'
)
# Load unaccent
(
echo "Loading unaccent extension"
psql -U $POSTGRES_USER -c 'CREATE EXTENSION IF NOT EXISTS unaccent CASCADE;'
)
# Load fuzzystrmatch
(
echo "Loading fuzzystrmatch extension"
psql -U $POSTGRES_USER -c 'CREATE EXTENSION IF NOT EXISTS fuzzystrmatch CASCADE;'
)
# Load pg_stat_statements
(
echo "Loading pg_stat_statements extension"
psql -U $POSTGRES_USER -c 'CREATE EXTENSION IF NOT EXISTS pg_stat_statements CASCADE;'
)
### POSTGIS :
# Load postgis
(
echo "Loading postgis extension"
psql -U $POSTGRES_USER -c 'CREATE EXTENSION IF NOT EXISTS postgis CASCADE;'
)
# Load postgis_topology
(
echo "Loading postgis_topology extension"
psql -U $POSTGRES_USER -c 'CREATE EXTENSION IF NOT EXISTS postgis_topology CASCADE;'
)
### TIMESCALE :
# Load Timescale
(
echo "Loading Timescale extension"
psql -U $POSTGRES_USER -c 'CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;'
)
### UBER H3 :
# Load H3
(
echo "Loading H3 extension"
pgxn load h3
#pgxn load h3 -h 127.0.0.1 -d postgres -U $POSTGRES_USER
)
### CONFIGURATION :
# Tune PG
(
echo "Tuning PG configuration"
timescaledb-tune --quiet --yes --conf-path=/data/postgres/postgresql.conf
)
# Increase max_connections to 1000
(
echo "Increase max_connections to 1000"
sed -i 's/max_connections = 100 # (change requires restart)/max_connections = 1000 # (change requires restart)/g' /data/postgres/postgresql.conf
sed -i 's/work_mem = 1279kB/work_mem = 104kB/g' /data/postgres/postgresql.conf
)
# Restart PG service
(
echo "Reload PG configuration"
psql -U $POSTGRES_USER -c 'SELECT pg_reload_conf();'
)