ssh.port = 8022
ssh.authorized_keys_file = ~/.ssh/authorized_keys
+tempdir = (string, optional)
+
+ This specifies a temporary directory for the webapi server to use, for
+ holding large files while they are being uploaded. If a webapi client
+ attempts to upload a 10GB file, this tempdir will need to have at least 10GB
+ available for the upload to complete.
+
+ The default value is the "tmp" directory in the node's base directory (i.e.
+ $NODEDIR/tmp), but it can be placed elsewhere. This directory is used for
+ files that usually (on a unix system) go into /tmp . The string will be
+ interpreted relative to the node's base directory.
+
== Client Configuration ==
[client]
-import datetime, os.path, re, types, ConfigParser
+import datetime, os.path, re, types, ConfigParser, tempfile
from base64 import b32decode, b32encode
from twisted.python import log as twlog
from allmydata import get_package_versions, get_package_versions_string
from allmydata.util import log
from allmydata.util import fileutil, iputil, observer
-from allmydata.util.assertutil import precondition
+from allmydata.util.assertutil import precondition, _assert
from foolscap.logging import app_versions
nickname_utf8 = self.get_config("node", "nickname", "<unspecified>")
self.nickname = nickname_utf8.decode("utf-8")
+ self.init_tempdir()
self.create_tub()
self.logSource="Node"
self.log("Node constructed. " + get_package_versions_string())
iputil.increase_rlimits()
+ def init_tempdir(self):
+ local_tempdir = "tmp" # default is NODEDIR/tmp/
+ tempdir = self.get_config("node", "tempdir", local_tempdir)
+ tempdir = os.path.join(self.basedir, tempdir)
+ if not os.path.exists(tempdir):
+ fileutil.make_dirs(tempdir)
+ tempfile.tempdir = os.path.abspath(tempdir)
+ # this should cause twisted.web.http (which uses
+ # tempfile.TemporaryFile) to put large request bodies in the given
+ # directory. Without this, the default temp dir is usually /tmp/,
+ # which is frequently too small.
+ test_name = tempfile.mktemp()
+ _assert(os.path.dirname(test_name) == tempdir, test_name, tempdir)
+
def get_config(self, section, option, default=_None, boolean=False):
try:
if boolean: