From 8484c3ee3dbb8c404d1dc282cc3aecbb58a189c2 Mon Sep 17 00:00:00 2001 From: Jean-Frederic Date: Tue, 14 Apr 2020 12:50:57 +0200 Subject: [PATCH 1/5] Allow to run Makefile command without sudo There is no sudo available in the Docker environment. Let's just move the `apt-get` call command to a variable, and override it in Makefile call in the Dockerfile. --- Dockerfile | 2 +- makefile | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3244e345a..2e6180b2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ WORKDIR /srv/mygpo COPY makefile . # install all packaged runtime dependencies -RUN yes | make install-deps +RUN yes | make install-deps APT=apt-get # create log directories RUN mkdir -p /var/log/gunicorn diff --git a/makefile b/makefile index 76cbda4e3..3b80c2a42 100644 --- a/makefile +++ b/makefile @@ -1,3 +1,5 @@ +APT=sudo apt-get + all: help help: @@ -34,7 +36,7 @@ clean: git clean -fX install-deps: - sudo apt-get install libpq-dev libjpeg-dev zlib1g-dev libwebp-dev \ + $(APT) install libpq-dev libjpeg-dev zlib1g-dev libwebp-dev \ build-essential python3-dev virtualenv libffi-dev redis postgresql docker-build: From 4efb585aaa5b9f23b86f4844c1a59cbf6d7b21c9 Mon Sep 17 00:00:00 2001 From: Jean-Frederic Date: Tue, 14 Apr 2020 12:52:36 +0200 Subject: [PATCH 2/5] Set POSTGRES_HOST_AUTH_METHOD in Postgres Docker There was a breaking change recently in Postgres Docker image: ``` Error: Database is uninitialized and superuser password is not specified. You must specify POSTGRES_PASSWORD for the superuser. Use "-e POSTGRES_PASSWORD=password" to set it in "docker run". You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections without a password. This is *not* recommended. See PostgreSQL documentation about "trust": https://www.postgresql.org/docs/current/auth-trust.html ``` This may not be the best setting, but let's go for this. See https://github.com/docker-library/postgres/issues/681 --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 5311f565e..31ced40cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,8 @@ services: build: context: contrib dockerfile: Dockerfile.postgres + environment: + POSTGRES_HOST_AUTH_METHOD: 'trust' memcached: image: memcached:1.4 From 93131ae891e47d190be56ac02301be95b335cddb Mon Sep 17 00:00:00 2001 From: Jean-Frederic Date: Tue, 14 Apr 2020 13:01:43 +0200 Subject: [PATCH 3/5] Add gettext to makefile dependencies Without it, the step `compilemessages` fails. --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index 3b80c2a42..8fb5d893f 100644 --- a/makefile +++ b/makefile @@ -36,7 +36,7 @@ clean: git clean -fX install-deps: - $(APT) install libpq-dev libjpeg-dev zlib1g-dev libwebp-dev \ + $(APT) install libpq-dev libjpeg-dev zlib1g-dev libwebp-dev gettext \ build-essential python3-dev virtualenv libffi-dev redis postgresql docker-build: From 9f4ac3810d8235190a29dee157e5095ac15db32e Mon Sep 17 00:00:00 2001 From: Jean-Frederic Date: Tue, 14 Apr 2020 14:49:53 +0200 Subject: [PATCH 4/5] Fix variable in French locale --- mygpo/locale/fr/LC_MESSAGES/django.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mygpo/locale/fr/LC_MESSAGES/django.po b/mygpo/locale/fr/LC_MESSAGES/django.po index e968b0862..257bc6c64 100644 --- a/mygpo/locale/fr/LC_MESSAGES/django.po +++ b/mygpo/locale/fr/LC_MESSAGES/django.po @@ -813,7 +813,7 @@ msgstr "Podcast inconnu" #: mygpo/podcasts/models.py:700 #, python-brace-format msgid "Unknown Podcast from {domain}" -msgstr "Podcast inconnu de {domaine}" +msgstr "Podcast inconnu de {domain}" #: mygpo/podcasts/templates/episode.html:85 #: mygpo/podcasts/templates/episodes.html:27 From a7045b94e6ce958992f73081fda0a09cbdf0da25 Mon Sep 17 00:00:00 2001 From: Jean-Frederic Date: Tue, 14 Apr 2020 15:16:50 +0200 Subject: [PATCH 5/5] Set STATIC_ROOT for serving static assets using Whitenoise This is one of the few requirements for whitenoise to just work. See http://whitenoise.evans.io/en/stable/django.html (This had been done in cdcb34f8b, but probably lost in a master merge) --- mygpo/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mygpo/settings.py b/mygpo/settings.py index 393d22b20..648f8b5dc 100644 --- a/mygpo/settings.py +++ b/mygpo/settings.py @@ -86,7 +86,7 @@ def get_intOrNone(name, default): # Static Files -STATIC_ROOT = 'staticfiles' +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_URL = '/static/' STATICFILES_DIRS = (os.path.abspath(os.path.join(BASE_DIR, '..', 'static')),)