Skip to content
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

Improve init #6634

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
Improve init
Signed-off-by: Denis Bykhov <[email protected]>
  • Loading branch information
BykhovDenis committed Sep 19, 2024
commit a49ce537b70cb4d53783e78af40cc84ba67c9465
17 changes: 11 additions & 6 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dev/tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"docker:tbuild": "docker build -t hardcoreeng/tool . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/tool",
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tool staging",
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tool",
"run-local": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --max-old-space-size=18000 ./bundle/bundle.js",
"run-local": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret DB_URL=postgresql://postgres:example@localhost:5432 ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --max-old-space-size=18000 ./bundle/bundle.js",
"run-local-brk": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --inspect-brk --enable-source-maps --max-old-space-size=18000 ./bundle/bundle.js",
"run": "rush bundle --to @hcengineering/tool >/dev/null && cross-env node --max-old-space-size=8000 ./bundle/bundle.js",
"run": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=fai4uugae9Xuuse5aelo ACCOUNTS_URL=https://account.huly.net TRANSACTOR_URL=wss://transactor.huly.net node --max-old-space-size=8000 ./bundle/bundle.js",
"upgrade": "rushx run-local upgrade",
"format": "format src",
"test": "jest --passWithNoTests --silent --forceExit",
Expand Down
29 changes: 17 additions & 12 deletions server/client/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,24 @@ export async function updateWorkspaceInfo (
progress: number,
message?: string
): Promise<void> {
const accountsUrl = getAccoutsUrlOrFail()
await (
await fetch(accountsUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
method: 'updateWorkspaceInfo',
params: [token, workspaceId, event, version, progress, message]
try {
const accountsUrl = getAccoutsUrlOrFail()
console.log('accountsUrl', accountsUrl)
await (
await fetch(accountsUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
method: 'updateWorkspaceInfo',
params: [token, workspaceId, event, version, progress, message]
})
})
})
).json()
).json()
} catch (err) {
console.log('error', err)
}
}

export async function workerHandshake (
Expand Down
2 changes: 2 additions & 0 deletions server/tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"@types/jest": "^29.5.5",
"@types/mime-types": "~2.1.1",
"@types/js-yaml": "^4.0.9"
},
"dependencies": {
Expand All @@ -60,6 +61,7 @@
"@hcengineering/minio": "^0.6.0",
"fast-equals": "^5.0.1",
"@hcengineering/text": "^0.6.5",
"mime-types": "~2.1.34",
"js-yaml": "^4.1.0"
}
}
3 changes: 2 additions & 1 deletion server/tool/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ export async function initializeWorkspace (
return
}

const initializer = new WorkspaceInitializer(ctx, storageAdapter, wsUrl, client)
const baseUrl = scriptUrl.substring(0, scriptUrl.lastIndexOf('/'))
const initializer = new WorkspaceInitializer(ctx, storageAdapter, wsUrl, client, baseUrl)
await initializer.processScript(script, logger, progress)
} catch (err: any) {
ctx.error('Failed to initialize workspace', { error: err })
Expand Down
Loading
Loading