File tree Expand file tree Collapse file tree 4 files changed +26
-22
lines changed Expand file tree Collapse file tree 4 files changed +26
-22
lines changed Original file line number Diff line number Diff line change 1
- local all vcap peer
2
- host all vcap 127.0.0.1/32 md5
3
- host all vcap ::1/128 md5
1
+ local all vcap trust
2
+ host all vcap 127.0.0.1/32 trust
3
+ host all vcap ::1/128 trust
4
4
<% if !p("databases.trust_local_connections").nil? && !p("databases.trust_local_connections") %>
5
5
local all all md5
6
6
<% else %>
7
- local all all peer
8
- host all all 127.0.0.1/32 md5
9
- host all all ::1/128 md5
7
+ local all all trust
8
+ host all all 127.0.0.1/32 trust
9
+ host all all ::1/128 trust
10
10
<% end %>
11
11
<% p("databases.roles", []).each do |role| %>
12
12
<%=
13
13
line=nil
14
14
unless role["password"]
15
- line = "hostssl all #{role["name"]} 0.0.0.0/0 cert clientcert=1 "
15
+ line = "hostssl all #{role["name"]} 0.0.0.0/0 cert clientcert=verify-full "
16
16
line << 'map=cnmap' if role["common_name"]
17
17
end
18
18
line
Original file line number Diff line number Diff line change @@ -26,7 +26,11 @@ pgversion_upgrade_from=postgres-unknown
26
26
if [ -f " ${VERSION_FILE} " ]; then
27
27
pgversion_upgrade_from=$( cat ${VERSION_FILE} )
28
28
DATA_DIR_OLD=" ${PG_STORE_DIR} /${pgversion_upgrade_from} "
29
- PACKAGE_DIR_OLD=/var/vcap/packages/${pgversion_upgrade_from}
29
+ PACKAGE_DIR_OLD=(/var/vcap/packages/${pgversion_upgrade_from% .* } * )
30
+ if [ ! -d " ${PACKAGE_DIR_OLD} " ]; then
31
+ echo " Unable to find older postgres package to use for major upgrade. Upgrade to and older version first."
32
+ exit 1
33
+ fi
30
34
fi
31
35
< %
32
36
if ! [' rfc3339' , ' deprecated' ].include? (p(' databases.logging.format.timestamp' ))
Original file line number Diff line number Diff line change @@ -42,20 +42,12 @@ function main() {
42
42
chmod 700 " ${PG_STORE_DIR} "
43
43
44
44
if [ ! -f ${VERSION_FILE} ]; then
45
- for version in " postgres-9.6.8" " postgres-9.6.6" " postgres-9.6.4" ; do
46
- if [[ -d " ${PG_STORE_DIR} /${version} " ]]; then
47
- if [[ -f " ${PG_STORE_DIR} /${version} /postgresql.conf" ]]; then
48
- echo " Creating the PostgreSQL data version file at version ${version} "
49
- echo ${version} > ${VERSION_FILE}
50
- chown -R vcap:vcap " ${VERSION_FILE} "
51
- chmod 700 " ${VERSION_FILE} "
52
- pgversion_upgrade_from=${version}
53
- DATA_DIR_OLD=" ${PG_STORE_DIR} /${version} "
54
- PACKAGE_DIR_OLD=/var/vcap/packages/${version}
55
- break
56
- fi
57
- fi
58
- done
45
+ existing_data_dirs=$( compgen -G " ${PG_STORE_DIR} /postgres-*" || echo " " )
46
+
47
+ if [ -n " ${existing_data_dirs} " ]; then
48
+ echo " Found existing data dirs that we cannot upgrade from in this release. Upgrade to and older version first."
49
+ exit 1
50
+ fi
59
51
fi
60
52
61
53
mkdir -p " ${LOG_DIR} "
Original file line number Diff line number Diff line change @@ -52,6 +52,14 @@ function create_databases() {
52
52
echo " Enabling pg_stat_statements extension..."
53
53
pgexec " <%= database[" name" ] %>" " CREATE EXTENSION IF NOT EXISTS pg_stat_statements"
54
54
< % end %>
55
+ < % p(" databases.roles" , []).each do | role| %>
56
+ echo " Granting public schema access to <%= role[" name" ] %> on <%= database[" name" ] %>"
57
+ " ${PACKAGE_DIR} /bin/psql" \
58
+ -U " vcap" \
59
+ -p " ${PORT} " \
60
+ -d " <%= database[" name" ] %>" \
61
+ -c " GRANT ALL ON schema public TO \" <%= role[" name" ] %>\" "
62
+ < % end %>
55
63
56
64
< % end %>
57
65
}
You can’t perform that action at this time.
0 commit comments