mirror of
https://github.com/immich-app/immich.git
synced 2025-01-07 00:50:23 -05:00
Fixed EACCES permission when mounting bind volume, add dynamic location for backup directory
This commit is contained in:
parent
4f47c8c06b
commit
56627caf5b
6 changed files with 17 additions and 10 deletions
|
@ -520,6 +520,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.11"
|
version: "0.12.11"
|
||||||
|
material_color_utilities:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: material_color_utilities
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -832,7 +839,7 @@ packages:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.3"
|
version: "0.4.8"
|
||||||
timing:
|
timing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -7,7 +7,7 @@ DB_PASSWORD=postgres
|
||||||
DB_DATABASE_NAME=
|
DB_DATABASE_NAME=
|
||||||
|
|
||||||
# Upload File Config
|
# Upload File Config
|
||||||
UPLOAD_LOCATION=./upload
|
UPLOAD_LOCATION=absolute_location_on_your_machine_where_you_want_to_store_the_backup
|
||||||
|
|
||||||
# JWT SECRET
|
# JWT SECRET
|
||||||
JWT_SECRET=
|
JWT_SECRET=
|
|
@ -12,11 +12,9 @@ services:
|
||||||
command: npm run start:dev
|
command: npm run start:dev
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
# expose:
|
|
||||||
# - 3000
|
|
||||||
volumes:
|
volumes:
|
||||||
- .:/usr/src/app
|
- .:/usr/src/app
|
||||||
- userdata:/usr/src/app/upload
|
- ${UPLOAD_LOCATION}:/usr/src/app/upload
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
@ -67,5 +65,4 @@ services:
|
||||||
networks:
|
networks:
|
||||||
immich_network:
|
immich_network:
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
userdata:
|
|
|
@ -4,9 +4,10 @@ import { existsSync, mkdirSync } from 'fs';
|
||||||
import { diskStorage } from 'multer';
|
import { diskStorage } from 'multer';
|
||||||
import { extname } from 'path';
|
import { extname } from 'path';
|
||||||
import { Request } from 'express';
|
import { Request } from 'express';
|
||||||
|
import { APP_UPLOAD_LOCATION } from '../constants/upload_location.constant';
|
||||||
|
|
||||||
export const multerConfig = {
|
export const multerConfig = {
|
||||||
dest: process.env.UPLOAD_LOCATION,
|
dest: APP_UPLOAD_LOCATION,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const multerOption: MulterOptions = {
|
export const multerOption: MulterOptions = {
|
||||||
|
|
1
server/src/constants/upload_location.constant.ts
Normal file
1
server/src/constants/upload_location.constant.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const APP_UPLOAD_LOCATION = './upload';
|
|
@ -7,6 +7,7 @@ import sharp from 'sharp';
|
||||||
import { existsSync, mkdirSync, readFile } from 'fs';
|
import { existsSync, mkdirSync, readFile } from 'fs';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import ffmpeg from 'fluent-ffmpeg';
|
import ffmpeg from 'fluent-ffmpeg';
|
||||||
|
import { APP_UPLOAD_LOCATION } from '../../constants/upload_location.constant';
|
||||||
|
|
||||||
@Processor('optimize')
|
@Processor('optimize')
|
||||||
export class ImageOptimizeProcessor {
|
export class ImageOptimizeProcessor {
|
||||||
|
@ -21,7 +22,7 @@ export class ImageOptimizeProcessor {
|
||||||
async resizeUploadedImage(job: Job) {
|
async resizeUploadedImage(job: Job) {
|
||||||
const { savedAsset }: { savedAsset: AssetEntity } = job.data;
|
const { savedAsset }: { savedAsset: AssetEntity } = job.data;
|
||||||
|
|
||||||
const basePath = this.configService.get('UPLOAD_LOCATION');
|
const basePath = APP_UPLOAD_LOCATION;
|
||||||
const resizePath = savedAsset.originalPath.replace('/original/', '/thumb/');
|
const resizePath = savedAsset.originalPath.replace('/original/', '/thumb/');
|
||||||
|
|
||||||
// Create folder for thumb image if not exist
|
// Create folder for thumb image if not exist
|
||||||
|
@ -77,7 +78,7 @@ export class ImageOptimizeProcessor {
|
||||||
async resizeUploadedVideo(job: Job) {
|
async resizeUploadedVideo(job: Job) {
|
||||||
const { savedAsset, filename }: { savedAsset: AssetEntity; filename: String } = job.data;
|
const { savedAsset, filename }: { savedAsset: AssetEntity; filename: String } = job.data;
|
||||||
|
|
||||||
const basePath = this.configService.get('UPLOAD_LOCATION');
|
const basePath = APP_UPLOAD_LOCATION;
|
||||||
// const resizePath = savedAsset.originalPath.replace('/original/', '/thumb/');
|
// const resizePath = savedAsset.originalPath.replace('/original/', '/thumb/');
|
||||||
// Create folder for thumb image if not exist
|
// Create folder for thumb image if not exist
|
||||||
const resizeDir = `${basePath}/${savedAsset.userId}/thumb/${savedAsset.deviceId}`;
|
const resizeDir = `${basePath}/${savedAsset.userId}/thumb/${savedAsset.deviceId}`;
|
||||||
|
|
Loading…
Reference in a new issue