Skip to content
Open
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
48 changes: 42 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
"args": ["src/__start.ts"],
"env": {
// "FULLTEXT_URL": "http://localhost:4700",
"FULLTEXT_URL": "http://huly.local:4702",
// "FULLTEXT_URL": "http://huly.local:4702",
// "MONGO_URL": "mongodb://localhost:27017",
// "DB_URL": "mongodb://localhost:27017",
// "DB_URL": "postgresql://postgres:example@localhost:5432",
"DB_URL": "postgresql://root@localhost:26257/defaultdb?sslmode=disable",
// "DB_URL": "postgresql://root@localhost:26257/defaultdb?sslmode=disable",
// "GREEN_URL": "http://huly.local:6767?token=secret",
"SERVER_PORT": "3332",
"APM_SERVER_URL2": "http://localhost:8200",
Expand Down Expand Up @@ -109,7 +109,9 @@
"QUEUE_REGION": "cockroach",
"FILES_URL": "http://huly.local:4030/blob/:workspace/:blobId/:filename",
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://huly.local:4318/v1/traces",
"BRANDING_PATH": "${workspaceRoot}/dev/branding.json"
"BRANDING_PATH": "${workspaceRoot}/dev/branding.json",
"NETWORK_HOST": "huly.local:3737",
"MODE": "endpoint"
},
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"runtimeVersion": "20",
Expand All @@ -126,9 +128,9 @@
"args": ["src/__start.ts"],
"env": {
"FULLTEXT_URL": "http://localhost:4710",
// "DB_URL": "mongodb://localhost:27018",
"DB_URL": "mongodb://localhost:27018",
// "DB_URL": "postgresql://postgres:example@localhost:5432",
"DB_URL": "postgresql://[email protected]:26258/defaultdb?sslmode=disable",
// "DB_URL": "postgresql://[email protected]:26258/defaultdb?sslmode=disable",
// "GREEN_URL": "http://huly.local:6767?token=secret",
"SERVER_PORT": "3334",
"METRICS_CONSOLE": "false",
Expand All @@ -141,7 +143,41 @@
"FRONT_URL": "http://localhost:8083",
"ACCOUNTS_URL": "http://localhost:3003",
"MODEL_JSON": "${workspaceRoot}/models/all/bundle/model.json",
"MODEL_VERSION": "0.7.173",
"MODEL_VERSION": "0.7.230",
"STATS_URL": "http://huly.local:4901",
"QUEUE_CONFIG": "localhost:19093"
},
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"runtimeVersion": "22",
"showAsyncStacks": true,
"outputCapture": "std",
"sourceMaps": true,
"cwd": "${workspaceRoot}/pods/server",
"protocol": "inspector"
},
{
"name": "Debug Net transactor",
"type": "node",
"request": "launch",
"args": ["src/__start.ts"],
"env": {
"NETWORK_HOST": "huly.local:3737",
"AGENT_HOST": "huly.local:13738",
"MODE": "transactor",
"FULLTEXT_URL": "http://localhost:4710",
"DB_URL": "mongodb://localhost:27018",
// "SERVER_PORT": "3334",
"METRICS_CONSOLE": "false",
"DEBUG_PRINT_SQL": "true",
"METRICS_FILE": "${workspaceRoot}/metrics.txt", // Show metrics in console evert 30 seconds.,
"STORAGE_CONFIG": "minio|localhost?accessKey=minioadmin&secretKey=minioadmin",
"SERVER_SECRET": "secret",
"ENABLE_CONSOLE": "true",
"COLLABORATOR_URL": "ws://localhost:3079",
"FRONT_URL": "http://localhost:8083",
"ACCOUNTS_URL": "http://localhost:3003",
"MODEL_JSON": "${workspaceRoot}/models/all/bundle/model.json",
"MODEL_VERSION": "0.7.230",
"STATS_URL": "http://huly.local:4901",
"QUEUE_CONFIG": "localhost:19093"
},
Expand Down
274 changes: 233 additions & 41 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,50 @@ services:
volumes:
- ./branding.json:/var/cfg/branding.json
environment:
- NETWORK_HOST=huly.local:3737
- MODE=endpoint
- QUEUE_CONFIG=${QUEUE_CONFIG}
- SERVER_PORT=3332
- REGION=cockroach
- SERVER_SECRET=secret
- ENABLE_COMPRESSION=true
- FULLTEXT_URL=http://huly.local:4702
- STATS_URL=http://huly.local:4900
- DB_URL=${DB_CR_URL}
- METRICS_CONSOLE=false
- METRICS_FILE=metrics.txt
- STORAGE_CONFIG=${STORAGE_CONFIG}
- FRONT_URL=http://huly.local:8087
- MAIL_URL=''
- ACCOUNTS_URL=http://huly.local:3000
- LAST_NAME_FIRST=true
- BRANDING_PATH=/var/cfg/branding.json
- AI_BOT_URL=http://huly.local:4010
- COMMUNICATION_TIME_LOGGING_ENABLED=true
- RATE_LIMIT_MAX=250 # 250 requests per 30 seconds
- RATE_LIMIT_WINDOW=30000
- FILES_URL=http://huly.local:4030/blob/:workspace/:blobId/:filename
- COMMUNICATION_API_ENABLED=true
- OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318/v1/traces
- HYLYLAKE_URL=http://huly.local:8096
restart: unless-stopped
net_transactor_cockroach:
image: hardcoreeng/transactor
extra_hosts:
- 'huly.local:host-gateway'
links:
- cockroach
- minio
- account
- stats
depends_on:
redpanda:
condition: service_started
volumes:
- ./branding.json:/var/cfg/branding.json
environment:
- NETWORK_HOST=huly.local:3737
- MODE=transactor
- QUEUE_CONFIG=${QUEUE_CONFIG}
- SERVER_PORT=3332
- REGION=cockroach
Expand Down Expand Up @@ -627,6 +671,15 @@ services:
- BADGER_DIRECTORY_VALUE=/badger/data
- BADGER_DIRECTORY_KEY=/badger/key
restart: unless-stopped
huly-net:
image: hardcoreeng/network-pod:latest
extra_hosts:
- 'huly.local:host-gateway'
ports:
- 3737:3737
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318/v1
restart: unless-stopped
volumes:
db:
dbpg:
Expand Down
6 changes: 4 additions & 2 deletions packages/api-client/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ export interface WorkspaceToken {
token: string
workspaceId: WorkspaceUuid
info: WorkspaceLoginInfo
region: string
}

export async function getWorkspaceToken (
url: string,
options: AuthOptions,
config?: ServerConfig
config?: ServerConfig,
region?: string // TODO: Move region into account
): Promise<WorkspaceToken> {
config ??= await loadServerConfig(url)

Expand All @@ -51,5 +53,5 @@ export async function getWorkspaceToken (
throw new Error('Workspace not found')
}

return { endpoint: ws.endpoint, token: ws.token, workspaceId: ws.workspace, info: ws }
return { endpoint: ws.endpoint, token: ws.token, workspaceId: ws.workspace, info: ws, region: region ?? '' }
}
13 changes: 5 additions & 8 deletions packages/core/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.
//

import type { Account, AccountRole, AccountUuid, Doc, Domain, PersonId, Ref } from './classes'
import { type MeasureContext } from '@hcengineering/measurements'
import type { Account, AccountRole, AccountUuid, Doc, Domain, PersonId, Ref } from './classes'
import { type DocumentQuery, type FindOptions } from './storage'
import type { DocumentUpdate, Tx } from './tx'
import { PermissionsGrant, type WorkspaceIds } from './utils'
Expand Down Expand Up @@ -48,6 +48,9 @@ export interface BroadcastExcludeResult {

export type BroadcastResult = BroadcastTargetResult | BroadcastExcludeResult | undefined
export type BroadcastTargets = Record<string, (tx: Tx) => Promise<BroadcastResult>>
export type SocialStringsToUsers = Map<PersonId, { accountUuid: AccountUuid, role: AccountRole }>

export const guestAccount = 'b6996120-416f-49cd-841e-e4a5d2e49c9b' as AccountUuid

export interface SessionData {
broadcast: {
Expand All @@ -65,13 +68,7 @@ export interface SessionData {
isTriggerCtx?: boolean
hasDomainBroadcast?: boolean
workspace: WorkspaceIds
socialStringsToUsers: Map<
PersonId,
{
accontUuid: AccountUuid
role: AccountRole
}
>
socialStringsToUsers: SocialStringsToUsers
grant?: PermissionsGrant

asyncRequests?: ((ctx: MeasureContext, id?: string) => Promise<void>)[]
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@ import { DOMAIN_BENCHMARK } from './benchmark'
import {
type Account,
AccountRole,
type AccountUuid,
type AnyAttribute,
type AttachedDoc,
type Class,
ClassifierKind,
type Collection,
type Doc,
type DocData,
type Domain,
DOMAIN_BLOB,
DOMAIN_MODEL,
DOMAIN_TRANSIENT,
type FullTextSearchContext,
IndexKind,
type Obj,
type Permission,
type PluginConfiguration,
type Ref,
type Role,
roleOrder,
Expand All @@ -41,18 +44,15 @@ import {
type SocialKey,
type Space,
type TypedSpace,
type WorkspaceMode,
type Domain,
type PluginConfiguration,
type AccountUuid
type WorkspaceMode
} from './classes'
import core from './component'
import { type Hierarchy } from './hierarchy'
import { type TxOperations } from './operations'
import { isPredicate } from './predicate'
import { type Branding, type BrandingMap } from './server'
import { type DocumentQuery, type FindResult } from './storage'
import { DOMAIN_TX, TxProcessor, type Tx, type TxCreateDoc, type TxCUD, type TxUpdateDoc } from './tx'
import { DOMAIN_TX, type Tx, type TxCreateDoc, type TxCUD, TxProcessor, type TxUpdateDoc } from './tx'

function toHex (value: number, chars: number): string {
const result = value.toString(16)
Expand Down
4 changes: 1 addition & 3 deletions plugins/guest/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Class, Doc, PersonUuid, Ref } from '@hcengineering/core'
import { Class, Doc, Ref } from '@hcengineering/core'
import type { Asset, Plugin } from '@hcengineering/platform'
import { plugin } from '@hcengineering/platform'
import { AnyComponent, Location } from '@hcengineering/ui'
Expand All @@ -20,8 +20,6 @@ export interface Restrictions {
disableActions: boolean
}

export const guestAccount = 'b6996120-416f-49cd-841e-e4a5d2e49c9b' as PersonUuid

export const guestId = 'guest' as Plugin
export default plugin(guestId, {
class: {
Expand Down
2 changes: 2 additions & 0 deletions pods/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM hardcoreeng/base:v20250916
WORKDIR /usr/src/app

RUN npm install --ignore-scripts=false --verbose zeromq --unsafe-perm

COPY bundle/model.json ./
COPY bundle/bundle.js ./
COPY bundle/bundle.js.map ./
Expand Down
8 changes: 6 additions & 2 deletions pods/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"_phase:docker-build": "rushx docker:build",
"_phase:docker-staging": "rushx docker:staging",
"get-model": "node ../../common/scripts/esbuild.js --entry=src/get-model.ts -keep-names=true --define=MODEL_VERSION --define=VERSION --define=GIT_REVISION --bundle=true && node ./bundle/bundle.js > ./bundle/model.json",
"bundle": "rushx get-model && node ../../common/scripts/esbuild.js --entry=src/__start.ts --keep-names=true --bundle=true --sourcemap=external --external=*.node --external=bufferutil --external=snappy --define=MODEL_VERSION --define=VERSION --define=GIT_REVISION --external=utf-8-validate --external=msgpackr-extract",
"bundle": "rushx get-model && node ../../common/scripts/esbuild.js --entry=src/__start.ts --keep-names=true --bundle=true --sourcemap=external --external=*.node --external=zeromq --external=bufferutil --external=snappy --define=MODEL_VERSION --define=VERSION --define=GIT_REVISION --external=utf-8-validate --external=msgpackr-extract",
"docker:build": "../../common/scripts/docker_build.sh hardcoreeng/transactor",
"docker:tbuild": "docker build -t hardcoreeng/transactor . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/transactor",
"docker:abuild": "docker build -t hardcoreeng/transactor . --platform=linux/arm64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/transactor",
Expand Down Expand Up @@ -92,6 +92,10 @@
"morgan": "^1.10.0",
"body-parser": "^1.20.3",
"cors": "^2.8.5",
"express": "^4.21.2"
"express": "^4.21.2",
"@hcengineering/network-client": "^0.7.9",
"@hcengineering/network-core": "^0.7.9",
"@hcengineering/network-server": "^0.7.9",
"@hcengineering/net-workspace": "^0.7.0"
}
}
26 changes: 26 additions & 0 deletions pods/server/run_server_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

export FULLTEXT_URL="http://huly.local:4710"
export DB_URL="mongodb://huly.local:27018"
# export DB_URL="postgresql://postgres:[email protected]:5432"
# export DB_URL="postgresql://[email protected]:26258/defaultdb?sslmode=disable"
# export GREEN_URL="http://huly.local:6767?token=secret"
export REGION=
export SERVER_PORT="3334"
export METRICS_CONSOLE="false"
export DEBUG_PRINT_SQL="true"
export METRICS_FILE="$(pwd)/../../metrics.txt"
export STORAGE_CONFIG="datalake|http://huly.local:4031"
export SERVER_SECRET="secret"
export ENABLE_CONSOLE="true"
export COLLABORATOR_URL="ws://huly.local:3079"
export ENABLE_COMPRESSION=true
export FRONT_URL="http://huly.local:8083"
export ACCOUNTS_URL="http://huly.local:3003"
export MODEL_JSON="$(pwd)/../../models/all/bundle/model.json"
export MODEL_VERSION="0.7.230"
export STATS_URL="http://huly.local:4901"
export QUEUE_CONFIG="huly.local:19093"

cd "$(dirname "$0")"
node --inspect --nolazy -r ts-node/register src/__start.ts
23 changes: 23 additions & 0 deletions pods/server/run_transactor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

export NETWORK_HOST="huly.local:3737"
export AGENT_HOST="huly.local:13738"
export MODE="transactor"
export FULLTEXT_URL="http://localhost:4710"
export DB_URL="mongodb://localhost:27018"
# export SERVER_PORT="3334"
export METRICS_CONSOLE="false"
export DEBUG_PRINT_SQL="true"
export METRICS_FILE="$(pwd)/../../metrics.txt"
export STORAGE_CONFIG="minio|localhost?accessKey=minioadmin&secretKey=minioadmin"
export SERVER_SECRET="secret"
export ENABLE_CONSOLE="true"
export COLLABORATOR_URL="ws://localhost:3079"
export FRONT_URL="http://localhost:8083"
export ACCOUNTS_URL="http://localhost:3003"
export MODEL_JSON="$(pwd)/../../models/all/bundle/model.json"
export MODEL_VERSION="0.7.230"
export STATS_URL="http://huly.local:4901"
export QUEUE_CONFIG="localhost:19093"

node --inspect --nolazy -r ts-node/register src/__start.ts
Loading
Loading