summaryrefslogtreecommitdiff
path: root/doc/development/shared_files.md
blob: 859650c2e6cf8517679e3c6b19af8afd75f7c687 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---

# 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 begins 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.