From c80c5631f0483c32c3b86bad3584c349a61b4b92 Mon Sep 17 00:00:00 2001 From: leonklingele Date: Sun, 1 Mar 2020 17:06:45 +0100 Subject: [PATCH] docker: do not require password for PostgreSQL superuser, docker,kubernetes: create "privacy" type before using it, travis: do not run "docker-compose up" in detached mode (#1042) * docker: do not require password for PostgreSQL superuser A password is now required by the postgres Docker image which makes initial setup (and our CI build) fail with the following error: postgres_1 | Error: Database is uninitialized and superuser password is not specified. postgres_1 | You must specify POSTGRES_PASSWORD for the superuser. Use postgres_1 | "-e POSTGRES_PASSWORD=password" to set it in "docker run". postgres_1 | postgres_1 | You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections postgres_1 | without a password. This is *not* recommended. See PostgreSQL postgres_1 | documentation about "trust": postgres_1 | https://www.postgresql.org/docs/current/auth-trust.html See https://github.com/docker-library/postgres/issues/681. * docker,kubernetes: create PostgreSQL "privacy" type before using it Fixes the following error when setting up the database: postgres_1 | 2020-02-21 01:01:22.371 UTC [172] ERROR: type "privacy" does not exist at character 200 postgres_1 | 2020-02-21 01:01:22.371 UTC [172] STATEMENT: CREATE TABLE public.playlists postgres_1 | ( postgres_1 | title text, postgres_1 | id text primary key, postgres_1 | author text, postgres_1 | description text, postgres_1 | video_count integer, postgres_1 | created timestamptz, postgres_1 | updated timestamptz, postgres_1 | privacy privacy, postgres_1 | index int8[] postgres_1 | ); postgres_1 | ERROR: type "privacy" does not exist postgres_1 | LINE 10: privacy privacy, * travis: do not run "docker-compose up" in detached mode Rather, allow database to finish its setup procedure and grant Invidious time to launch. --- .travis.yml | 2 +- docker/Dockerfile.postgres | 3 +++ kubernetes/README.md | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 314abc73..8b83db2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ jobs: install: - docker-compose build script: - - docker-compose up -d + - docker-compose up - sleep 15 # Wait for cluster to become ready, TODO: do not sleep - HEADERS="$(curl -I -s http://localhost:3000/)" - STATUS="$(echo $HEADERS | head -n1)" diff --git a/docker/Dockerfile.postgres b/docker/Dockerfile.postgres index 720bdff8..3b25b802 100644 --- a/docker/Dockerfile.postgres +++ b/docker/Dockerfile.postgres @@ -1,6 +1,9 @@ FROM postgres:10 ENV POSTGRES_USER postgres +# Do not require a PostgreSQL superuser password. +# See https://github.com/docker-library/postgres/issues/681. +ENV POSTGRES_HOST_AUTH_METHOD trust ADD ./config/sql /config/sql ADD ./docker/entrypoint.postgres.sh /entrypoint.sh diff --git a/kubernetes/README.md b/kubernetes/README.md index 163e9cd7..1c62f469 100644 --- a/kubernetes/README.md +++ b/kubernetes/README.md @@ -17,9 +17,9 @@ $ kubectl create configmap invidious-postgresql-init \ --from-file=../config/sql/session_ids.sql \ --from-file=../config/sql/nonces.sql \ --from-file=../config/sql/annotations.sql \ + --from-file=../config/sql/privacy.sql \ --from-file=../config/sql/playlists.sql \ - --from-file=../config/sql/playlist_videos.sql \ - --from-file=../config/sql/privacy.sql + --from-file=../config/sql/playlist_videos.sql # Install Helm app to your Kubernetes cluster $ helm install invidious ./