summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2019-12-15 19:04:20 +1300
committerLingxian Kong <anlin.kong@gmail.com>2019-12-18 22:13:32 +0000
commit72524f9d856dd715242d9d96116f8238a95c048b (patch)
treef925c7dd9390318eaa5a8652c10a4626ea8abe20
parent5472d8a57c7c9e82cca122396fea75b8ef05a64a (diff)
downloadtrove-72524f9d856dd715242d9d96116f8238a95c048b.tar.gz
Support PostgreSQL 12
Change-Id: Ic1d4982a479c2154d7ddcc807d863e2a37fea506
-rw-r--r--devstack/plugin.sh2
-rwxr-xr-xintegration/scripts/files/elements/ubuntu-postgresql/install.d/30-postgresql33
-rwxr-xr-xintegration/scripts/files/elements/ubuntu-postgresql/pre-install.d/10-postgresql-repo4
-rwxr-xr-xintegration/scripts/files/elements/ubuntu-xenial-postgresql/install.d/31-fix-init-script7
4 files changed, 8 insertions, 38 deletions
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 6703fd9b..7529a057 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -295,7 +295,7 @@ write_files:
EOF
# NOTE(lxkong): Remove this when we support common cloud-init file for all datastores.
- for datastore in "mysql" "mariadb"
+ for datastore in "mysql" "mariadb" "postgresql"
do
sudo cp ${common_cloudinit} /etc/trove/cloudinit/${datastore}.cloudinit
done
diff --git a/integration/scripts/files/elements/ubuntu-postgresql/install.d/30-postgresql b/integration/scripts/files/elements/ubuntu-postgresql/install.d/30-postgresql
index 17dedde3..cb33bb6c 100755
--- a/integration/scripts/files/elements/ubuntu-postgresql/install.d/30-postgresql
+++ b/integration/scripts/files/elements/ubuntu-postgresql/install.d/30-postgresql
@@ -12,37 +12,14 @@ cat > "/etc/sysctl.d/10-postgresql-performance.conf" << _EOF_
# but the Python interpreter may require it on smaller flavors.
# We therefore stick with the heuristic overcommit setting.
vm.overcommit_memory=0
-
-_EOF_
-
-cat > "/etc/rc.local" << _EOF_
-#!/bin/bash
-
-# See 'http://www.postgresql.org/docs/9.6/static/kernel-resources.html'
-# Postgres 9.6 added support for THP. Using huge pages reduces overhead when
-# using large contiguous chunks of memory, like PostgreSQL does.
-if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
- echo never > /sys/kernel/mm/transparent_hugepage/defrag
-fi
-if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
- echo always > /sys/kernel/mm/transparent_hugepage/enabled
-fi
-
-exit \$?
-
_EOF_
-apt-get --allow-unauthenticated -y install postgresql-9.6 postgresql-contrib-9.6 postgresql-server-dev-9.6
-
-sed -i "s/external_pid_file =.*/external_pid_file = '\/var\/run\/postgresql\/postgresql.pid'/" /etc/postgresql/9.6/main/postgresql.conf
+apt-get --allow-unauthenticated -y install libpq-dev postgresql-12 postgresql-server-dev-12 postgresql-client-12
-# The script will create a postgresql-9.6 image for user to use.
-# From Postgresql >9.4, pg_rewind is in the main source tree. But, the default location is
-# /usr/lib/postgresql/<version>/bin/pg_rewind. So, there need create a symlink from that
-# location to /usr/bin
-ln -s /usr/lib/postgresql/9.6/bin/pg_rewind /usr/bin/pg_rewind
+pgsql_conf=/etc/postgresql/12/main/postgresql.conf
+sed -i "/listen_addresses/c listen_addresses = '*'" ${pgsql_conf}
+systemctl restart postgresql
# Install the native Python client.
-apt-get --allow-unauthenticated -y install libpq-dev python-dev
-pip2 install psycopg2
+pip3 install psycopg2
diff --git a/integration/scripts/files/elements/ubuntu-postgresql/pre-install.d/10-postgresql-repo b/integration/scripts/files/elements/ubuntu-postgresql/pre-install.d/10-postgresql-repo
index 132bc4f3..7f387b23 100755
--- a/integration/scripts/files/elements/ubuntu-postgresql/pre-install.d/10-postgresql-repo
+++ b/integration/scripts/files/elements/ubuntu-postgresql/pre-install.d/10-postgresql-repo
@@ -3,10 +3,10 @@
set -e
set -o xtrace
-[ -n "${RELEASE}" ] || die "RELEASE must be set to a valid Ubuntu release (e.g. trusty)"
+[ -n "${DIB_RELEASE}" ] || die "RELEASE must be set to a valid Ubuntu release (e.g. trusty)"
cat <<EOL > /etc/apt/sources.list.d/postgresql.list
-deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}-pgdg main
+deb http://apt.postgresql.org/pub/repos/apt/ ${DIB_RELEASE}-pgdg main
EOL
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
diff --git a/integration/scripts/files/elements/ubuntu-xenial-postgresql/install.d/31-fix-init-script b/integration/scripts/files/elements/ubuntu-xenial-postgresql/install.d/31-fix-init-script
deleted file mode 100755
index 35a6efb5..00000000
--- a/integration/scripts/files/elements/ubuntu-xenial-postgresql/install.d/31-fix-init-script
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-set -e
-set -o xtrace
-
-sed -i "s/PIDFile=\/run\/postgresql\/%i.pid/PIDFile=\/var\/run\/postgresql\/postgresql.pid/" /lib/systemd/system/postgresql@.service
-