diff options
Diffstat (limited to 'lava-master')
-rw-r--r-- | lava-master/Dockerfile | 2 | ||||
-rw-r--r-- | lava-master/backup/.empty | 0 | ||||
-rwxr-xr-x | lava-master/scripts/setup.sh | 14 |
3 files changed, 16 insertions, 0 deletions
diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 7d61103..a074570 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -49,6 +49,8 @@ RUN /etc/init.d/postgresql start && \ bash /build-lava lava-server 2018.4 2018.4-1 && \ /etc/init.d/postgresql stop +COPY backup / + RUN a2enmod proxy \ && a2enmod proxy_http \ && a2dissite 000-default \ diff --git a/lava-master/backup/.empty b/lava-master/backup/.empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lava-master/backup/.empty diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh index c00cb02..ad10238 100755 --- a/lava-master/scripts/setup.sh +++ b/lava-master/scripts/setup.sh @@ -7,6 +7,20 @@ 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 /db_lavaserver.gz ];then + gunzip /db_lavaserver.gz || exit $? +fi + +if [ -e /db_lavaserver ];then + echo "Restore database from backup" + sudo -u postgres psql < /db_lavaserver || exit $? + lava-server manage migrate || exit $? + echo "Restore jobs output from backup" + rm -r /var/lib/lava-server/default/media/job-output/* + tar xzf /joboutput.tar.gz || exit $? +fi +chown -R lavaserver:lavaserver /var/lib/lava-server/default/media/job-output/ + if [ -e /root/lava-users ];then for ut in $(ls /root/lava-users) do |