-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(server): better mount checks #13092
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# System Integrity | ||
|
||
## Folder checks | ||
|
||
:::info | ||
The folders considered for these checks include: `upload/`, `library/`, `thumbs/`, `encoded-video/`, `profile/` | ||
::: | ||
|
||
When Immich starts, it performs a series of checks in order to validate that it can read and write files to the volume mounts used by the storage system. If it cannot perform all the required operations, it will fail to start. The checks include: | ||
|
||
- Creating an initial hidden file (`.immich`) in each folder | ||
- Reading a hidden file (`.immich`) in each folder | ||
- Overwriting a hidden file (`.immich`) in each folder | ||
|
||
The checks are designed to catch the following situations: | ||
|
||
- Incorrect permissions (cannot read/write files) | ||
- Missing volume mount (`.immich` files should exist, but are missing) | ||
|
||
### Common issues | ||
|
||
:::note | ||
`.immich` files serve as markers and help keep track of volume mounts being used by Immich. Except for the situations listed below, they should never be manually created or deleted. | ||
::: | ||
|
||
#### Missing `.immich` files | ||
|
||
``` | ||
Verifying system mount folder checks (enabled=true) | ||
... | ||
ENOENT: no such file or directory, open 'upload/encoded-video/.immich' | ||
``` | ||
|
||
The above error messages show that the server has previously (successfully) written `.immich` files to each folder, but now does not detect them. This could be because any of the following: | ||
|
||
- Permission error - unable to read the file, but it exists | ||
- File does not exist - volume mount has changed and should be corrected | ||
- File does not exist - user manually deleted it and should be manually re-created (`touch .immich`) | ||
- File does not exist - user restored from a backup, but did not restore each folder (user should restore all folders or manually create `.immich` in any missing folders) | ||
|
||
### Ignoring the checks | ||
|
||
The checks are designed to catch common problems that we have seen users have in the past, but if you want to disable them you can set the following environment variable: | ||
|
||
``` | ||
IMMICH_IGNORE_MOUNT_CHECK_ERRORS=true | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
import { IConfigRepository } from 'src/interfaces/config.interface'; | ||
import { EnvData, IConfigRepository } from 'src/interfaces/config.interface'; | ||
import { DatabaseExtension } from 'src/interfaces/database.interface'; | ||
import { Mocked, vitest } from 'vitest'; | ||
|
||
const envData: EnvData = { | ||
database: { | ||
skipMigrations: false, | ||
vectorExtension: DatabaseExtension.VECTORS, | ||
}, | ||
storage: { | ||
ignoreMountCheckErrors: false, | ||
}, | ||
}; | ||
|
||
export const newConfigRepositoryMock = (): Mocked<IConfigRepository> => { | ||
return { | ||
getEnv: vitest.fn().mockReturnValue({ | ||
database: { | ||
skipMigration: false, | ||
vectorExtension: DatabaseExtension.VECTORS, | ||
}, | ||
}), | ||
getEnv: vitest.fn().mockReturnValue(envData), | ||
}; | ||
}; | ||
|
||
export const mockEnvData = (config: Partial<EnvData>) => ({ ...envData, ...config }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add a disclaimer here along the lines of "if you've used this env var then unfortunately we can't help you with mountpoint issues"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is implied that when you disable default protections you are assuming the associated risk, but I can add a explicit note if you think that would be beneficial.