diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 6703fd9ba7..7529a05797 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 17dedde363..cb33bb6c4f 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 +apt-get --allow-unauthenticated -y install libpq-dev postgresql-12 postgresql-server-dev-12 postgresql-client-12 -# 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 - -# 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//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 132bc4f399..7f387b2369 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 < /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 35a6efb570..0000000000 --- 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 -