diff options
author | Ryan Mulligan <ryan@ryantm.com> | 2021-09-23 08:22:53 -0700 |
---|---|---|
committer | Ryan Mulligan <ryan@ryantm.com> | 2021-09-23 09:59:31 -0700 |
commit | f933c68374b9c6195dc74d26c95fc9bf240fead8 (patch) | |
tree | 8ccb6e28d8e8a8cf180968493252b0bcb285154d | |
parent | e3cbf57cac4bcbd76b155a5d0b9103996916549a (diff) | |
download | nixpkgs-f933c68374b9c6195dc74d26c95fc9bf240fead8.tar nixpkgs-f933c68374b9c6195dc74d26c95fc9bf240fead8.tar.gz nixpkgs-f933c68374b9c6195dc74d26c95fc9bf240fead8.tar.bz2 nixpkgs-f933c68374b9c6195dc74d26c95fc9bf240fead8.tar.lz nixpkgs-f933c68374b9c6195dc74d26c95fc9bf240fead8.tar.xz nixpkgs-f933c68374b9c6195dc74d26c95fc9bf240fead8.tar.zst nixpkgs-f933c68374b9c6195dc74d26c95fc9bf240fead8.zip |
discourse: enable restoring backups bigger than RAM
When restoring a backup, discourse decompresses the backup archive in the /share/discourse/tmp dir. Before this change, it is linked to /run which is typically backed by memory, so the backup will fail to restore if you do not have enough memory on your system to contain the backup. This has already happened to me on two small forums. This moves tmp to the StateDirectory /var/lib/discourse/tmp which is typically backed by disk.
-rw-r--r-- | nixos/modules/services/web-apps/discourse.nix | 6 | ||||
-rw-r--r-- | pkgs/servers/web-apps/discourse/default.nix | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/services/web-apps/discourse.nix b/nixos/modules/services/web-apps/discourse.nix index 050e4ee3d32..2ff78f88db8 100644 --- a/nixos/modules/services/web-apps/discourse.nix +++ b/nixos/modules/services/web-apps/discourse.nix @@ -727,6 +727,8 @@ in umask u=rwx,g=rx,o= + rm -rf /var/lib/discourse/tmp/* + cp -r ${cfg.package}/share/discourse/config.dist/* /run/discourse/config/ cp -r ${cfg.package}/share/discourse/public.dist/* /run/discourse/public/ ln -sf /var/lib/discourse/uploads /run/discourse/public/uploads @@ -748,7 +750,7 @@ in ) discourse-rake db:migrate >>/var/log/discourse/db_migration.log - chmod -R u+w /run/discourse/tmp/ + chmod -R u+w /var/lib/discourse/tmp/ export ADMIN_EMAIL="${cfg.admin.email}" export ADMIN_NAME="${cfg.admin.fullName}" @@ -768,7 +770,6 @@ in RuntimeDirectory = map (p: "discourse/" + p) [ "config" "home" - "tmp" "assets/javascripts/plugins" "public" "sockets" @@ -777,6 +778,7 @@ in StateDirectory = map (p: "discourse/" + p) [ "uploads" "backups" + "tmp" ]; StateDirectoryMode = 0750; LogsDirectory = "discourse"; diff --git a/pkgs/servers/web-apps/discourse/default.nix b/pkgs/servers/web-apps/discourse/default.nix index ca0f30d7894..c699c9fb1ed 100644 --- a/pkgs/servers/web-apps/discourse/default.nix +++ b/pkgs/servers/web-apps/discourse/default.nix @@ -290,7 +290,7 @@ let cp -r . $out/share/discourse rm -r $out/share/discourse/log ln -sf /var/log/discourse $out/share/discourse/log - ln -sf /run/discourse/tmp $out/share/discourse/tmp + ln -sf /var/lib/discourse/tmp $out/share/discourse/tmp ln -sf /run/discourse/config $out/share/discourse/config ln -sf /run/discourse/assets/javascripts/plugins $out/share/discourse/app/assets/javascripts/plugins ln -sf /run/discourse/public $out/share/discourse/public |