From 70bffaef36b2afe7c732d6f20afca008c5ef1445 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Wed, 4 Jul 2018 15:35:13 +0200 Subject: Made the database persistent Until now, each docker-compose down will loose all data (jobs, devices, etc...). By creating a docker volume, the database will now be persistent other restart. Due to a risk of the lava package reseting the password, it is always reseted at start. This patch add also another volume for job output which are stored in the filesystem and not in database. --- lava-master/scripts/setup.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lava-master') diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh index 585499e..c00cb02 100755 --- a/lava-master/scripts/setup.sh +++ b/lava-master/scripts/setup.sh @@ -1,5 +1,12 @@ #!/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 +fi +sudo -u postgres psql -c "ALTER USER lavaserver WITH PASSWORD '$(cat /root/pg_lava_password)';" || exit $? +sed -i "s,^LAVA_DB_PASSWORD=.*,LAVA_DB_PASSWORD='$(cat /root/pg_lava_password)'," /etc/lava-server/instance.conf || exit $? + if [ -e /root/lava-users ];then for ut in $(ls /root/lava-users) do -- cgit 1.2.3-korg