diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2020-07-13 13:25:52 +0200 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2020-07-13 13:36:10 +0200 |
commit | 3fa641e74700acad323fe19f1eadb285aeb1dd66 (patch) | |
tree | cc13844c12d10cc63883f51d3d37390abe6960cb /lava-master | |
parent | 3860f1bb528503f6f2fb38d79d207d13498bc226 (diff) |
Permit to set the postgres lavaserver password
By setting pg_lava_password, the final lavaserver password will be set
to this value.
Diffstat (limited to 'lava-master')
-rw-r--r-- | lava-master/Dockerfile | 2 | ||||
-rwxr-xr-x | lava-master/entrypoint.d/01_setup.sh | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 5bf989a..6396253 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -39,6 +39,8 @@ COPY apache2/ /etc/apache2/ # Fixes 'postgresql ERROR: invalid locale name: "en_US.UTF-8"' when restoring a backup RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && locale-gen en_US.UTF-8 +COPY pg_lava_password /root + # TODO: send this fix to upstream RUN sed -i 's,find /root/entrypoint.d/ -type f,find /root/entrypoint.d/ -type f | sort,' /root/entrypoint.sh # TODO: send this fix to upstream diff --git a/lava-master/entrypoint.d/01_setup.sh b/lava-master/entrypoint.d/01_setup.sh index 53db47e..95b180b 100755 --- a/lava-master/entrypoint.d/01_setup.sh +++ b/lava-master/entrypoint.d/01_setup.sh @@ -1,8 +1,11 @@ #!/bin/bash # always reset the lavaserver user, since its password could have been reseted in a "docker build --nocache" -if [ ! -e /root/pg_lava_password ];then - < /dev/urandom tr -dc A-Za-z0-9 | head -c16 > /root/pg_lava_password +if [ ! -s /root/pg_lava_password ];then + echo "DEBUG: Generating a random LAVA password" + < /dev/urandom tr -dc A-Za-z0-9 | head -c16 > /root/pg_lava_password +else + echo "DEBUG: use the given LAVA password" fi sudo -u postgres psql -c "ALTER USER lavaserver WITH PASSWORD '$(cat /root/pg_lava_password)';" || exit $? if [ -e /etc/lava-server/instance.conf ];then |