diff options
Diffstat (limited to 'backup')
-rw-r--r-- | backup/Dockerfile | 2 | ||||
-rw-r--r-- | backup/utils/postgresql.py | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/backup/Dockerfile b/backup/Dockerfile index f60149c7..3827bfc7 100644 --- a/backup/Dockerfile +++ b/backup/Dockerfile @@ -18,7 +18,7 @@ WORKDIR /opt/trove/backup RUN ./install.sh $DATASTORE RUN apt-get update \ - && apt-get install $APTOPTS build-essential python3-setuptools python3-all python3-all-dev python3-pip libffi-dev libssl-dev libxml2-dev libxslt1-dev libyaml-dev \ + && apt-get install $APTOPTS build-essential python3-setuptools python3-all python3-all-dev python3-pip libffi-dev libssl-dev libxml2-dev libxslt1-dev libyaml-dev libpq-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && pip3 --no-cache-dir install -U -r requirements.txt \ diff --git a/backup/utils/postgresql.py b/backup/utils/postgresql.py index 033652f0..e43570e9 100644 --- a/backup/utils/postgresql.py +++ b/backup/utils/postgresql.py @@ -15,7 +15,17 @@ import psycopg2 class PostgresConnection(object): - def __init__(self, user, password='', host='localhost', port=5432): + def __init__(self, user, password='', host='/var/run/postgresql', + port=5432): + """Utility class to communicate with PostgreSQL. + + Connect with socket rather than IP or localhost address to avoid + manipulation of pg_hba.conf when the database is running inside + container with bridge network. + + This class is consistent with PostgresConnection in + trove/guestagent/datastore/postgres/service.py + """ self.user = user self.password = password self.host = host |