From 4b2b2500478f19cd32d6af2727c540d61b10c0e0 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Sat, 15 Feb 2020 12:01:19 +0100
Subject: [PATCH] Fixed broken db with postgres:11.7

---
 .gitlab-ci.yml            | 1 +
 changes/notes.rst         | 9 +++++++++
 deploy/docker-compose.yml | 2 ++
 dev.yml                   | 2 ++
 4 files changed, 14 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3aa4cc56b5..f548dbb159 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -131,6 +131,7 @@ test_api:
     DATABASE_URL: "postgresql://postgres@postgres/postgres"
     FUNKWHALE_URL: "https://funkwhale.ci"
     DJANGO_SETTINGS_MODULE: config.settings.local
+    POSTGRES_HOST_AUTH_METHOD: trust
   only:
     - branches
   before_script:
diff --git a/changes/notes.rst b/changes/notes.rst
index 754d60f30f..63bb1e10c8 100644
--- a/changes/notes.rst
+++ b/changes/notes.rst
@@ -56,3 +56,12 @@ from the server CLI. Typical use cases include:
 All user-related commands are available under the ``python manage.py fw users`` namespace.
 Please refer to the `Admin documentation <https://docs.funkwhale.audio/admin/commands.html#user-management>`_ for
 more information and instructions.
+
+Postgres docker changed environment variable [manual action required, docker only]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If you're running with docker and our multi-container setup, there was a breaking change starting in the 11.7 postgres image (https://github.com/docker-library/postgres/pull/658)
+
+You need to add this to your .env file: ``POSTGRES_HOST_AUTH_METHOD=trust``
+
+Newer deployments aren't affected.
diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml
index b98555ef20..b895f4ff6a 100644
--- a/deploy/docker-compose.yml
+++ b/deploy/docker-compose.yml
@@ -6,6 +6,8 @@ services:
     networks:
       - default
     env_file: .env
+    environment:
+      - "POSTGRES_HOST_AUTH_METHOD=trust"
     image: postgres:11
     volumes:
       - ./data/postgres:/var/lib/postgresql/data
diff --git a/dev.yml b/dev.yml
index a01b2ee0c4..7ae73a51a1 100644
--- a/dev.yml
+++ b/dev.yml
@@ -23,6 +23,8 @@ services:
       - .env.dev
       - .env
     image: postgres:${POSTGRES_VERSION-11}
+    environment:
+      - "POSTGRES_HOST_AUTH_METHOD=trust"
     command: postgres ${POSTGRES_ARGS-}
     volumes:
       - "./data/${COMPOSE_PROJECT_NAME-node1}/postgres:/var/lib/postgresql/data"
-- 
GitLab