Skip to content

Commit e173fd0

Browse files
authored
UBERF-12323: Include accounts info into backup (#9659)
* uberf-12323: include accounts data into backups Signed-off-by: Alexey Zinoviev <[email protected]> Signed-off-by: Alexey Zinoviev <[email protected]> * uberf-12323: support full recheck Signed-off-by: Alexey Zinoviev <[email protected]> Signed-off-by: Alexey Zinoviev <[email protected]> * uberf-12323: bump forced full recheck Signed-off-by: Alexey Zinoviev <[email protected]> Signed-off-by: Alexey Zinoviev <[email protected]> * uberf-12323: remove excess logs Signed-off-by: Alexey Zinoviev <[email protected]> Signed-off-by: Alexey Zinoviev <[email protected]> * uberf-12323: fix tests Signed-off-by: Alexey Zinoviev <[email protected]> Signed-off-by: Alexey Zinoviev <[email protected]> * uberf-12323: update local dev setup Signed-off-by: Alexey Zinoviev <[email protected]> --------- Signed-off-by: Alexey Zinoviev <[email protected]>
1 parent 06c9acc commit e173fd0

File tree

16 files changed

+434
-71
lines changed

16 files changed

+434
-71
lines changed

dev/docker-compose.min.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ services:
143143
- STORAGE_CONFIG=${STORAGE_CONFIG}
144144
- MODEL_ENABLED=*
145145
- ACCOUNTS_URL=http://huly.local:3000
146+
- ACCOUNTS_DB_URL=${DB_CR_URL}
146147
- BRANDING_PATH=/var/cfg/branding.json
147148
- BACKUP_STORAGE=${BACKUP_STORAGE_CONFIG}
148149
- BACKUP_BUCKET=${BACKUP_BUCKET_NAME}

dev/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ services:
197197
- STATS_URL=http://huly.local:4900
198198
- STORAGE_CONFIG=${STORAGE_CONFIG}
199199
- ACCOUNTS_URL=http://huly.local:3000
200+
- ACCOUNTS_DB_URL=${DB_CR_URL}
200201
- BRANDING_PATH=/var/cfg/branding.json
201202
- BACKUP_STORAGE=${BACKUP_STORAGE_CONFIG}
202203
- BACKUP_BUCKET=${BACKUP_BUCKET_NAME}
@@ -536,6 +537,7 @@ services:
536537
environment:
537538
- SECRET=secret
538539
- ACCOUNTS_URL=http://huly.local:3000
540+
- ACCOUNTS_DB_URL=${DB_CR_URL}
539541
- STATS_URL=http://huly.local:4900
540542
- DB_URL=${DB_CR_URL}
541543
- REGION=cockroach

dev/tool/src/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ export function devTool (
916916

917917
program
918918
.command('backup <dirName> <workspace>')
919-
.description('dump workspace transactions and minio resources')
919+
.description('dump workspace transactions, blobs and accounts')
920920
.option('-i, --include <include>', 'A list of ; separated domain names to include during backup', '*')
921921
.option('-s, --skip <skip>', 'A list of ; separated domain names to skip during backup', '')
922922
.option('--full', 'Full recheck', false)
@@ -929,6 +929,7 @@ export function devTool (
929929
.option('-f, --force', 'Force backup', false)
930930
.option('-t, --timeout <timeout>', 'Connect timeout in seconds', '30')
931931
.option('-k, --keepSnapshots <keepSnapshots>', 'Keep snapshots for days', '14')
932+
.option('-fv, --fullVerify', 'Full verification', false)
932933
.action(
933934
async (
934935
dirName: string,
@@ -942,6 +943,7 @@ export function devTool (
942943
contentTypes: string
943944
full: boolean
944945
keepSnapshots: string
946+
fullVerify: boolean
945947
}
946948
) => {
947949
const storage = await createFileBackupStorage(dirName)
@@ -980,7 +982,7 @@ export function devTool (
980982
return
981983
}
982984

983-
await backup(toolCtx, pipeline, wsIds, storage, {
985+
await backup(toolCtx, pipeline, wsIds, storage, db, {
984986
force: cmd.force,
985987
include: cmd.include === '*' ? undefined : new Set(cmd.include.split(';').map((it) => it.trim())),
986988
skipDomains: (cmd.skip ?? '').split(';').map((it) => it.trim()),
@@ -991,7 +993,8 @@ export function devTool (
991993
.split(';')
992994
.map((it) => it.trim())
993995
.filter((it) => it.length > 0),
994-
keepSnapshots: parseInt(cmd.keepSnapshots)
996+
keepSnapshots: parseInt(cmd.keepSnapshots),
997+
fullVerify: cmd.fullVerify
995998
})
996999
} catch (err: any) {
9971000
toolCtx.error('Failed to backup workspace', { err, workspace })

qms-tests/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ services:
122122
- TRANSACTOR_URL=ws://transactor:3334;ws://huly.local:3334
123123
- STORAGE_CONFIG=${STORAGE_CONFIG}
124124
- ACCOUNTS_URL=http://account:3003
125+
- ACCOUNTS_DB_URL=${DB_PG_URL}
125126
- BRANDING_PATH=/var/cfg/branding.json
126127
restart: unless-stopped
127128
front:

server/backup-service/src/config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import { type BackupConfig } from '@hcengineering/server-backup'
1717

1818
interface Config extends Omit<BackupConfig, 'Token'> {
1919
AccountsURL: string
20+
AccountsDbURL: string
21+
AccountsDbNS: string
2022
ServiceID: string
2123
Secret: string
2224

@@ -36,6 +38,8 @@ interface Config extends Omit<BackupConfig, 'Token'> {
3638

3739
const envMap: { [key in keyof Config]: string } = {
3840
AccountsURL: 'ACCOUNTS_URL',
41+
AccountsDbURL: 'ACCOUNTS_DB_URL',
42+
AccountsDbNS: 'ACCOUNTS_NS',
3943
ServiceID: 'SERVICE_ID',
4044
Secret: 'SECRET',
4145
BucketName: 'BUCKET_NAME',
@@ -53,6 +57,7 @@ const envMap: { [key in keyof Config]: string } = {
5357

5458
const required: Array<keyof Config> = [
5559
'AccountsURL',
60+
'AccountsDbURL',
5661
'Secret',
5762
'ServiceID',
5863
'BucketName',
@@ -64,6 +69,8 @@ const required: Array<keyof Config> = [
6469
export const config: () => Config = () => {
6570
const params: Partial<Config> = {
6671
AccountsURL: process.env[envMap.AccountsURL],
72+
AccountsDbURL: process.env[envMap.AccountsDbURL],
73+
AccountsDbNS: process.env[envMap.AccountsDbNS],
6774
Secret: process.env[envMap.Secret],
6875
BucketName: process.env[envMap.BucketName] ?? 'backups',
6976
ServiceID: process.env[envMap.ServiceID] ?? 'backup-service',

server/backup/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
"dependencies": {
4343
"@hcengineering/platform": "^0.6.11",
4444
"@hcengineering/core": "^0.6.32",
45+
"@hcengineering/account": "^0.6.0",
4546
"@hcengineering/contact": "^0.6.24",
47+
"@hcengineering/model-contact": "^0.6.1",
4648
"@hcengineering/client-resources": "^0.6.27",
4749
"@hcengineering/client": "^0.6.18",
4850
"@hcengineering/model": "^0.6.11",

0 commit comments

Comments
 (0)