Move tmp directories for backups and restores into /shared (#411)

Move tmp directories for backups and restores into /shared (#411)

Large temporary files shouldn’t be stored inside of the Docker container.

From f390d78f7213d3e6c4c51d7b23a055825a89496b Mon Sep 17 00:00:00 2001
From: Gerhard Schlager <mail@gerhard-schlager.at>
Date: Fri, 5 Oct 2018 01:31:59 +0200
Subject: [PATCH] Move tmp directories for backups and restores into /shared
 (#411)

Large temporary files shouldn't be stored inside of the Docker container.

diff --git a/templates/web.template.yml b/templates/web.template.yml
index e71ff7e..6a1b6ba 100644
--- a/templates/web.template.yml
+++ b/templates/web.template.yml
@@ -107,7 +107,9 @@ run:
         - bash -c "ln    -s           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr}.log $home/log"
         - bash -c "mkdir -p           /shared/{uploads,backups}"
         - bash -c "ln    -s           /shared/{uploads,backups} $home/public"
-        - chown -R discourse:www-data /shared/log/rails /shared/uploads /shared/backups
+        - bash -c "mkdir -p           /shared/tmp/{backups,restores}"
+        - bash -c "ln    -s           /shared/tmp/{backups,restores} $home/tmp"
+        - chown -R discourse:www-data /shared/log/rails /shared/uploads /shared/backups /shared/tmp
 
   - exec:
       cmd:
@@ -272,6 +274,10 @@ run:
           chown -R discourse:www-data /shared/backups
         fi
 
+        rm -rf /shared/tmp/{backups,restores}
+        mkdir -p /shared/tmp/{backups,restores}
+        chown -R discourse:www-data /shared/tmp/{backups,restores}
+
   # change login directory to Discourse home
   - file:
      path: /root/.bash_profile

GitHub

2 Likes