This was deprecated for removal in Pike. It's probably time to drop it.
Note that the 'postgresql-devel'/'postgresql-server-dev-all' packages
are retained since some packages still include 'psycopg2' in their
general requirements.
Change-Id: I51e8354e99972757253ce259e6c03c91da24398c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
... | ... |
@@ -326,29 +326,23 @@ a file, keep service logs and disable color in the stored files. |
326 | 326 |
Database Backend |
327 | 327 |
---------------- |
328 | 328 |
|
329 |
-Multiple database backends are available. The available databases are defined |
|
330 |
-in the lib/databases directory. |
|
331 |
-``mysql`` is the default database, choose a different one by putting the |
|
332 |
-following in the ``localrc`` section:: |
|
329 |
+Support for the MySQL database backend is included. Addition database backends |
|
330 |
+may be available via external plugins. Enabling of disabling MySQL is handled |
|
331 |
+via the usual service functions and ``ENABLED_SERVICES``. For example, to |
|
332 |
+disable MySQL in ``local.conf``:: |
|
333 | 333 |
|
334 | 334 |
disable_service mysql |
335 |
- enable_service postgresql |
|
336 |
- |
|
337 |
-``mysql`` is the default database. |
|
338 | 335 |
|
339 | 336 |
RPC Backend |
340 | 337 |
----------- |
341 | 338 |
|
342 |
-Support for a RabbitMQ RPC backend is included. Additional RPC |
|
343 |
-backends may be available via external plugins. Enabling or disabling |
|
344 |
-RabbitMQ is handled via the usual service functions and |
|
345 |
-``ENABLED_SERVICES``. |
|
346 |
- |
|
347 |
-Example disabling RabbitMQ in ``local.conf``:: |
|
339 |
+Support for a RabbitMQ RPC backend is included. Additional RPC backends may be |
|
340 |
+available via external plugins. Enabling or disabling RabbitMQ is handled via |
|
341 |
+the usual service functions and ``ENABLED_SERVICES``. For example, to disable |
|
342 |
+RabbitMQ in ``local.conf``:: |
|
348 | 343 |
|
349 | 344 |
disable_service rabbit |
350 | 345 |
|
351 |
- |
|
352 | 346 |
Apache Frontend |
353 | 347 |
--------------- |
354 | 348 |
|
... | ... |
@@ -302,10 +302,7 @@ migrated at all. |
302 | 302 |
- This will probably be implemented on ironic side. |
303 | 303 |
* - DEVSTACK_GATE_POSTGRES |
304 | 304 |
- Legacy |
305 |
- - This flag exists in d-g but the only thing that it does is |
|
306 |
- capture postgres logs. This is already supported by the roles |
|
307 |
- in post, so the flag is useless in the new jobs. postgres |
|
308 |
- itself can be enabled via the devstack_service job variable. |
|
305 |
+ - This has no effect in d-g. |
|
309 | 306 |
* - DEVSTACK_GATE_ZEROMQ |
310 | 307 |
- Legacy |
311 | 308 |
- This has no effect in d-g. |
... | ... |
@@ -400,7 +400,8 @@ function upload_image { |
400 | 400 |
# initialized yet, just save the configuration selection and call back later |
401 | 401 |
# to validate it. |
402 | 402 |
# |
403 |
-# ``$1`` - the name of the database backend to use (mysql, postgresql, ...) |
|
403 |
+# ``$1`` - the name of the database backend to use (only mysql is currently |
|
404 |
+# supported) |
|
404 | 405 |
function use_database { |
405 | 406 |
if [[ -z "$DATABASE_BACKENDS" ]]; then |
406 | 407 |
# No backends registered means this is likely called from ``localrc`` |
407 | 408 |
deleted file mode 100644 |
... | ... |
@@ -1,137 +0,0 @@ |
1 |
-#!/bin/bash |
|
2 |
-# |
|
3 |
-# lib/databases/postgresql |
|
4 |
-# Functions to control the configuration and operation of the **PostgreSQL** database backend |
|
5 |
- |
|
6 |
-# Dependencies: |
|
7 |
-# |
|
8 |
-# - DATABASE_{HOST,USER,PASSWORD} must be defined |
|
9 |
- |
|
10 |
-# Save trace setting |
|
11 |
-_XTRACE_PG=$(set +o | grep xtrace) |
|
12 |
-set +o xtrace |
|
13 |
- |
|
14 |
- |
|
15 |
-MAX_DB_CONNECTIONS=${MAX_DB_CONNECTIONS:-200} |
|
16 |
- |
|
17 |
- |
|
18 |
-register_database postgresql |
|
19 |
- |
|
20 |
- |
|
21 |
-# Functions |
|
22 |
-# --------- |
|
23 |
- |
|
24 |
-function get_database_type_postgresql { |
|
25 |
- echo postgresql |
|
26 |
-} |
|
27 |
- |
|
28 |
-# Get rid of everything enough to cleanly change database backends |
|
29 |
-function cleanup_database_postgresql { |
|
30 |
- stop_service postgresql |
|
31 |
- if is_ubuntu; then |
|
32 |
- # Get ruthless with mysql |
|
33 |
- apt_get purge -y postgresql* |
|
34 |
- return |
|
35 |
- elif is_fedora || is_suse; then |
|
36 |
- uninstall_package postgresql-server |
|
37 |
- else |
|
38 |
- return |
|
39 |
- fi |
|
40 |
-} |
|
41 |
- |
|
42 |
-function recreate_database_postgresql { |
|
43 |
- local db=$1 |
|
44 |
- # Avoid unsightly error when calling dropdb when the database doesn't exist |
|
45 |
- psql -h$DATABASE_HOST -U$DATABASE_USER -dtemplate1 -c "DROP DATABASE IF EXISTS $db" |
|
46 |
- createdb -h $DATABASE_HOST -U$DATABASE_USER -l C -T template0 -E utf8 $db |
|
47 |
-} |
|
48 |
- |
|
49 |
-function configure_database_postgresql { |
|
50 |
- local pg_conf pg_dir pg_hba check_role version |
|
51 |
- echo_summary "Configuring and starting PostgreSQL" |
|
52 |
- if is_fedora; then |
|
53 |
- pg_hba=/var/lib/pgsql/data/pg_hba.conf |
|
54 |
- pg_conf=/var/lib/pgsql/data/postgresql.conf |
|
55 |
- if ! sudo [ -e $pg_hba ]; then |
|
56 |
- sudo postgresql-setup initdb |
|
57 |
- fi |
|
58 |
- elif is_ubuntu; then |
|
59 |
- version=`psql --version | cut -d ' ' -f3 | cut -d. -f1-2` |
|
60 |
- if vercmp $version '>=' 9.3; then |
|
61 |
- if [ -z "`pg_lsclusters -h`" ]; then |
|
62 |
- echo 'No PostgreSQL clusters exist; will create one' |
|
63 |
- sudo pg_createcluster $version main --start |
|
64 |
- fi |
|
65 |
- fi |
|
66 |
- pg_dir=`find /etc/postgresql -name pg_hba.conf|xargs dirname` |
|
67 |
- pg_hba=$pg_dir/pg_hba.conf |
|
68 |
- pg_conf=$pg_dir/postgresql.conf |
|
69 |
- elif is_suse; then |
|
70 |
- pg_hba=/var/lib/pgsql/data/pg_hba.conf |
|
71 |
- pg_conf=/var/lib/pgsql/data/postgresql.conf |
|
72 |
- # initdb is called when postgresql is first started |
|
73 |
- sudo [ -e $pg_hba ] || start_service postgresql |
|
74 |
- else |
|
75 |
- exit_distro_not_supported "postgresql configuration" |
|
76 |
- fi |
|
77 |
- # Listen on all addresses |
|
78 |
- sudo sed -i "/listen_addresses/s/.*/listen_addresses = '*'/" $pg_conf |
|
79 |
- # Set max_connections |
|
80 |
- sudo sed -i "/max_connections/s/.*/max_connections = $MAX_DB_CONNECTIONS/" $pg_conf |
|
81 |
- # Do password auth from all IPv4 clients |
|
82 |
- sudo sed -i "/^host/s/all\s\+127.0.0.1\/32\s\+ident/$DATABASE_USER\t0.0.0.0\/0\tpassword/" $pg_hba |
|
83 |
- # Do password auth for all IPv6 clients |
|
84 |
- sudo sed -i "/^host/s/all\s\+::1\/128\s\+ident/$DATABASE_USER\t::0\/0\tpassword/" $pg_hba |
|
85 |
- restart_service postgresql |
|
86 |
- |
|
87 |
- # Create the role if it's not here or else alter it. |
|
88 |
- check_role=$(sudo -u root sudo -u postgres -i psql -t -c "SELECT 'HERE' from pg_roles where rolname='$DATABASE_USER'") |
|
89 |
- if [[ ${check_role} == *HERE ]];then |
|
90 |
- sudo -u root sudo -u postgres -i psql -c "ALTER ROLE $DATABASE_USER WITH SUPERUSER LOGIN PASSWORD '$DATABASE_PASSWORD'" |
|
91 |
- else |
|
92 |
- sudo -u root sudo -u postgres -i psql -c "CREATE ROLE $DATABASE_USER WITH SUPERUSER LOGIN PASSWORD '$DATABASE_PASSWORD'" |
|
93 |
- fi |
|
94 |
-} |
|
95 |
- |
|
96 |
-function install_database_postgresql { |
|
97 |
- echo_summary "Installing postgresql" |
|
98 |
- deprecated "Use of postgresql in devstack is deprecated, and will be removed during the Pike cycle" |
|
99 |
- local pgpass=$HOME/.pgpass |
|
100 |
- if [[ ! -e $pgpass ]]; then |
|
101 |
- cat <<EOF > $pgpass |
|
102 |
-*:*:*:$DATABASE_USER:$DATABASE_PASSWORD |
|
103 |
-EOF |
|
104 |
- chmod 0600 $pgpass |
|
105 |
- else |
|
106 |
- sed -i "s/:root:\w\+/:root:$DATABASE_PASSWORD/" $pgpass |
|
107 |
- fi |
|
108 |
- if is_ubuntu; then |
|
109 |
- install_package postgresql |
|
110 |
- elif is_fedora || is_suse; then |
|
111 |
- install_package postgresql-server |
|
112 |
- if is_fedora; then |
|
113 |
- sudo systemctl enable postgresql |
|
114 |
- fi |
|
115 |
- else |
|
116 |
- exit_distro_not_supported "postgresql installation" |
|
117 |
- fi |
|
118 |
-} |
|
119 |
- |
|
120 |
-function install_database_python_postgresql { |
|
121 |
- # Install Python client module |
|
122 |
- pip_install_gr psycopg2 |
|
123 |
- ADDITIONAL_VENV_PACKAGES+=",psycopg2" |
|
124 |
-} |
|
125 |
- |
|
126 |
-function database_connection_url_postgresql { |
|
127 |
- local db=$1 |
|
128 |
- echo "$BASE_SQL_CONN/$db?client_encoding=utf8" |
|
129 |
-} |
|
130 |
- |
|
131 |
- |
|
132 |
-# Restore xtrace |
|
133 |
-$_XTRACE_PG |
|
134 |
- |
|
135 |
-# Local variables: |
|
136 |
-# mode: shell-script |
|
137 |
-# End: |
... | ... |
@@ -695,14 +695,11 @@ function read_password { |
695 | 695 |
# Database Configuration |
696 | 696 |
# ---------------------- |
697 | 697 |
|
698 |
-# To select between database backends, add the following to ``local.conf``: |
|
698 |
+# DevStack provides a MySQL database backend. Additional backends may be |
|
699 |
+# provided by external plugins and can be enabled using the usual service |
|
700 |
+# functions and ``ENABLED_SERVICES``. For example, to disable MySQL: |
|
699 | 701 |
# |
700 | 702 |
# disable_service mysql |
701 |
-# enable_service postgresql |
|
702 |
-# |
|
703 |
-# The available database backends are listed in ``DATABASE_BACKENDS`` after |
|
704 |
-# ``lib/database`` is sourced. ``mysql`` is the default. |
|
705 |
- |
|
706 | 703 |
if initialize_database_backends; then |
707 | 704 |
echo "Using $DATABASE_TYPE database backend" |
708 | 705 |
# Last chance for the database password. This must be handled here |
... | ... |
@@ -147,10 +147,6 @@ if [[ -n "$UNSTACK_ALL" ]]; then |
147 | 147 |
stop_service mysql |
148 | 148 |
fi |
149 | 149 |
|
150 |
- if is_service_enabled postgresql; then |
|
151 |
- stop_service postgresql |
|
152 |
- fi |
|
153 |
- |
|
154 | 150 |
# Stop rabbitmq-server |
155 | 151 |
if is_service_enabled rabbit; then |
156 | 152 |
stop_service rabbitmq-server |