Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pods/backup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"_phase:docker-staging": "rushx docker:staging",
"bundle": "mkdir -p bundle && esbuild src/index.ts --bundle --sourcemap=inline --platform=node --external:*.node --external:bufferutil --external:snappy > bundle/bundle.js",
"docker:build": "../../common/scripts/docker_build.sh hardcoreeng/backup",
"docker:tbuild": "docker build -t hardcoreeng/backup . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/backup",
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/backup staging",
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/backup",
"run-local": "cross-env ACCOUNTS_URL=http://localhost:3000/ SECRET=secret MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost BUCKET_NAME=backups INTERVAL=30 ts-node src/index.ts",
Expand Down
4 changes: 2 additions & 2 deletions server/backup/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class BackupWorker {
})
const childLogger = rootCtx.logger.childLogger?.(ws.workspace, {
workspace: ws.workspace,
enableConsole: 'false'
enableConsole: 'true'
})
const ctx = rootCtx.newChild(ws.workspace, { workspace: ws.workspace }, {}, childLogger)
try {
Expand All @@ -124,7 +124,7 @@ class BackupWorker {
const pipeline = await this.pipelineFactory(ctx, wsUrl, true, () => {}, null)

await ctx.with('backup', { workspace: ws.workspace }, async (ctx) => {
await backup(ctx, ws.endpoint, getWorkspaceId(ws.workspace), storage, {
await backup(ctx, '', getWorkspaceId(ws.workspace), storage, {
skipDomains: [],
force: false,
recheck: false,
Expand Down
7 changes: 6 additions & 1 deletion server/client/src/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ export class BlobClient {
}
break
} catch (err: any) {
if (err?.code === 'NoSuchKey') {
if (
err?.code === 'NoSuchKey' ||
err?.code === 'NotFound' ||
err?.message === 'No such key' ||
err?.Code === 'NoSuchKey'
) {
ctx.info('No such key', { name })
return
}
Expand Down
14 changes: 12 additions & 2 deletions server/front/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ async function getFileRange (
})
})
} catch (err: any) {
if (err?.code === 'NoSuchKey' || err?.code === 'NotFound') {
if (
err?.code === 'NoSuchKey' ||
err?.code === 'NotFound' ||
err?.message === 'No such key' ||
err?.Code === 'NoSuchKey'
) {
ctx.info('No such key', { workspace: workspace.name, uuid })
res.status(404).send()
return
Expand Down Expand Up @@ -459,7 +464,12 @@ export function start (
)
}
} catch (error: any) {
if (error?.code === 'NoSuchKey' || error?.code === 'NotFound' || error?.message === 'No such key') {
if (
error?.code === 'NoSuchKey' ||
error?.code === 'NotFound' ||
error?.message === 'No such key' ||
error?.Code === 'NoSuchKey'
) {
ctx.error('No such storage key', {
file: req.query.file,
workspace: payload?.workspace,
Expand Down
6 changes: 3 additions & 3 deletions server/server-storage/src/starter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type DatalakeConfig, DatalakeService } from '@hcengineering/datalake'
import { DatalakeService, type DatalakeConfig } from '@hcengineering/datalake'
import { MinioConfig, MinioService, addMinioFallback } from '@hcengineering/minio'
import { createRawMongoDBAdapter } from '@hcengineering/mongo'
import { S3Service, type S3Config } from '@hcengineering/s3'
Expand Down Expand Up @@ -30,10 +30,10 @@ import {

*/

export function storageConfigFromEnv (configEnv: string = 'STORAGE_CONFIG'): StorageConfiguration {
export function storageConfigFromEnv (configEnv?: string): StorageConfiguration {
const storageConfig: StorageConfiguration = { default: '', storages: [] }

const storageEnv = process.env[configEnv]
const storageEnv = configEnv ?? process.env.STORAGE_CONFIG
if (storageEnv !== undefined) {
parseStorageEnv(storageEnv, storageConfig)
}
Expand Down
7 changes: 6 additions & 1 deletion server/ws/src/blobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ export async function getFileRange (
})
})
} catch (err: any) {
if (err?.code === 'NoSuchKey' || err?.code === 'NotFound') {
if (
err?.code === 'NoSuchKey' ||
err?.code === 'NotFound' ||
err?.message === 'No such key' ||
err?.Code === 'NoSuchKey'
) {
ctx.info('No such key', { workspace: workspace.name, uuid })
res.cork(() => {
res.status(404)
Expand Down