summaryrefslogtreecommitdiff
path: root/doc/development/shared_files.md
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-11-19 15:46:04 +0100
committerDouwe Maan <douwe@gitlab.com>2015-11-19 15:46:04 +0100
commitf5a630111fb1499a1541e77040529f74ca6475ec (patch)
treec3c82cd23d7bdcbfe4ec38d12be4572a6e8653ee /doc/development/shared_files.md
parent28af56dea5a88ffcaceb082cf67c9c1ab021609d (diff)
parentc8074b6b115c95c68d5f7df300a391b4eab521d5 (diff)
downloadgitlab-ce-f5a630111fb1499a1541e77040529f74ca6475ec.tar.gz
Merge branch 'master' into reference-pipeline-and-caching
Diffstat (limited to 'doc/development/shared_files.md')
-rw-r--r--doc/development/shared_files.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/development/shared_files.md b/doc/development/shared_files.md
new file mode 100644
index 00000000000..fcd905b54a4
--- /dev/null
+++ b/doc/development/shared_files.md
@@ -0,0 +1,33 @@
+# Shared files
+
+Historically, GitLab has been storing shared files in many different
+directories: `public/uploads`, `builds`, `tmp/repositories`, `tmp/rebase` (EE),
+etc. Having so many shared directories makes it difficult to deploy GitLab on
+shared storage (e.g. NFS). Working towards GitLab 9.0 we are consolidating
+these different directories under the `shared` directory.
+
+This means that if GitLab will start storing puppies in some future version
+then we should put them in `shared/puppies`. Temporary puppy files should be
+stored in `shared/tmp`.
+
+In the GitLab application code you can get the full path to the `shared`
+directory with `Gitlab.config.shared.path`.
+
+## What is not a 'shared file'
+
+Files that belong to only one process, or on only one server, should not go in
+`shared`. Examples include PID files and sockets.
+
+## Temporary files and shared storage
+
+Sometimes you create a temporary file on disk with the intention of it becoming
+'official'. For example you might be first streaming an upload from a user to
+disk in a temporary file so you can perform some checks on it. When the checks
+pass, you make the file official. In scenarios like this please follow these
+rules:
+
+- Store the temporary file under `shared/tmp`, i.e. on the same filesystem you
+ want the official file to be on.
+- Use move/rename operations when operating on the file instead of copy
+ operations where possible, because renaming a file is much faster than
+ copying it.