diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 354700cd45..8b6dabf64a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -96,7 +96,6 @@ specifiers: '@rush-temp/workbench': file:./projects/workbench.tgz '@rush-temp/workbench-assets': file:./projects/workbench-assets.tgz '@rush-temp/workbench-resources': file:./projects/workbench-resources.tgz - '@rush-temp/workspace': file:./projects/workspace.tgz '@rushstack/heft': ^0.41.1 '@rushstack/heft-jest-plugin': ^0.1.15 '@tiptap/core': ~2.0.0-beta.93 @@ -260,7 +259,6 @@ dependencies: '@rush-temp/workbench': file:projects/workbench.tgz '@rush-temp/workbench-assets': file:projects/workbench-assets.tgz '@rush-temp/workbench-resources': file:projects/workbench-resources.tgz_476f694f64637160ae71e12ff57815b9 - '@rush-temp/workspace': file:projects/workspace.tgz '@rushstack/heft': 0.41.1 '@rushstack/heft-jest-plugin': 0.1.36_@rushstack+heft@0.41.1 '@tiptap/core': 2.0.0-beta.118 @@ -11676,32 +11674,3 @@ packages: transitivePeerDependencies: - supports-color dev: false - - file:projects/workspace.tgz: - resolution: {integrity: sha512-YI/sT3YoO5I4h5IxDaQiW3DpmJ4debbG2AdYBK7a3hZcXInHy5JBYlH26oX8C03HkIFoyjXAKAs4rbhd7juy7w==, tarball: file:projects/workspace.tgz} - name: '@rush-temp/workspace' - version: 0.0.0 - dependencies: - '@rushstack/heft': 0.41.1 - '@types/heft-jest': 1.0.2 - '@types/minio': 7.0.10 - '@types/node': 16.10.3 - '@typescript-eslint/eslint-plugin': 5.4.0_87dbf04088b125598d0271706532eaf3 - '@typescript-eslint/parser': 5.4.0_eslint@7.32.0+typescript@4.4.3 - esbuild: 0.12.29 - eslint: 7.32.0 - eslint-config-standard-with-typescript: 21.0.1_05a8ea1454e6ca4c9f98b94b8f3abf9c - eslint-plugin-import: 2.25.3_eslint@7.32.0 - eslint-plugin-node: 11.1.0_eslint@7.32.0 - eslint-plugin-promise: 5.1.1_eslint@7.32.0 - jwt-simple: 0.5.6 - minio: 7.0.19 - mongodb: 4.1.3 - prettier: 2.4.1 - ts-node: 10.2.1_8304ecd715830f7c190b4d1dea90b100 - typescript: 4.4.3 - transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' - - supports-color - dev: false diff --git a/rush.json b/rush.json index d7bd9326c0..4fb64e70bc 100644 --- a/rush.json +++ b/rush.json @@ -766,11 +766,6 @@ "projectFolder": "server/elastic", "shouldPublish": true }, - { - "packageName": "@anticrm/workspace", - "projectFolder": "server/workspace", - "shouldPublish": true - }, { "packageName": "@anticrm/contrib", "projectFolder": "server/contrib", diff --git a/server/workspace/.eslintrc.js b/server/workspace/.eslintrc.js deleted file mode 100644 index 5da5872d4a..0000000000 --- a/server/workspace/.eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'], - parserOptions: { - tsconfigRootDir: __dirname, - project: './tsconfig.json' - } -} diff --git a/server/workspace/.npmignore b/server/workspace/.npmignore deleted file mode 100644 index e3ec093c38..0000000000 --- a/server/workspace/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!/lib/** -!CHANGELOG.md -/lib/**/__tests__/ diff --git a/server/workspace/CHANGELOG.json b/server/workspace/CHANGELOG.json deleted file mode 100644 index f26a311d72..0000000000 --- a/server/workspace/CHANGELOG.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "@anticrm/workspace", - "entries": [ - { - "version": "0.6.0", - "tag": "@anticrm/workspace_v0.6.0", - "date": "Fri, 20 Aug 2021 16:21:03 GMT", - "comments": { - "dependency": [ - { - "comment": "Updating dependency \"@anticrm/core\" from `~0.6.10` to `~0.6.11`" - } - ] - } - } - ] -} diff --git a/server/workspace/CHANGELOG.md b/server/workspace/CHANGELOG.md deleted file mode 100644 index edf531a54f..0000000000 --- a/server/workspace/CHANGELOG.md +++ /dev/null @@ -1,9 +0,0 @@ -# Change Log - @anticrm/workspace - -This log was last generated on Fri, 20 Aug 2021 16:21:03 GMT and should not be manually modified. - -## 0.6.0 -Fri, 20 Aug 2021 16:21:03 GMT - -_Initial release_ - diff --git a/server/workspace/Dockerfile b/server/workspace/Dockerfile deleted file mode 100644 index fe5cd03e02..0000000000 --- a/server/workspace/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM node - -WORKDIR /usr/src/app - -COPY bundle.js ./ - -ENV TRANSACTOR_URL ws://transactor/ -ENV MINIO_ENDPOINT minio - -EXPOSE 8080 -CMD [ "bash" ] diff --git a/server/workspace/build.sh b/server/workspace/build.sh deleted file mode 100755 index 0301e46926..0000000000 --- a/server/workspace/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright © 2020, 2021 Anticrm Platform Contributors. -# Copyright © 2021 Hardcore Engineering Inc. -# -# Licensed under the Eclipse Public License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. You may -# obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# -# See the License for the specific language governing permissions and -# limitations under the License. -# - -rushx bundle -rushx docker:build -rushx docker:push diff --git a/server/workspace/config/rig.json b/server/workspace/config/rig.json deleted file mode 100644 index af1257a896..0000000000 --- a/server/workspace/config/rig.json +++ /dev/null @@ -1,18 +0,0 @@ -// The "rig.json" file directs tools to look for their config files in an external package. -// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package -{ - "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", - - /** - * (Required) The name of the rig package to inherit from. - * It should be an NPM package name with the "-rig" suffix. - */ - "rigPackageName": "@anticrm/platform-rig" - - /** - * (Optional) Selects a config profile from the rig package. The name must consist of - * lowercase alphanumeric words separated by hyphens, for example "sample-profile". - * If omitted, then the "default" profile will be used." - */ - // "rigProfile": "your-profile-name" -} diff --git a/server/workspace/package.json b/server/workspace/package.json deleted file mode 100644 index 205f52f129..0000000000 --- a/server/workspace/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@anticrm/workspace", - "version": "0.6.0", - "main": "lib/index.js", - "author": "Anticrm Platform Contributors", - "license": "EPL-2.0", - "scripts": { - "create": "ts-node src/__create.ts", - "build": "heft build", - "build:watch": "tsc", - "lint:fix": "eslint --fix src", - "bundle": "esbuild src/__create.ts --bundle --minify --platform=node > bundle.js", - "docker:build": "docker build -t anticrm/tools .", - "docker:push": "docker push anticrm/tools", - "lint": "eslint src", - "format": "prettier --write src && eslint --fix src" - }, - "devDependencies": { - "@anticrm/platform-rig": "~0.6.0", - "@types/heft-jest": "^1.0.2", - "@typescript-eslint/eslint-plugin": "^5.4.0", - "eslint-plugin-import": "^2.25.3", - "eslint-plugin-promise": "^5.1.1", - "eslint-plugin-node": "^11.1.0", - "eslint": "^7.32.0", - "ts-node": "^10.2.1", - "esbuild": "^0.12.24", - "@types/minio": "^7.0.10", - "@types/node": "^16.7.5", - "@typescript-eslint/parser": "^5.4.0", - "eslint-config-standard-with-typescript": "^21.0.1", - "prettier": "^2.4.1", - "@rushstack/heft": "^0.41.1", - "typescript": "^4.3.5" - }, - "dependencies": { - "@anticrm/core": "~0.6.11", - "mongodb": "^4.1.0", - "@anticrm/contrib": "~0.6.0", - "jwt-simple": "^0.5.6", - "minio": "^7.0.19", - "@anticrm/model-all": "~0.6.0" - } -} diff --git a/server/workspace/run.sh b/server/workspace/run.sh deleted file mode 100755 index e96b1cac4e..0000000000 --- a/server/workspace/run.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright © 2020, 2021 Anticrm Platform Contributors. -# Copyright © 2021 Hardcore Engineering Inc. -# -# Licensed under the Eclipse Public License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. You may -# obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# -# See the License for the specific language governing permissions and -# limitations under the License. -# - -export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace default mng-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 --decode) -export MINIO_ACCESS_KEY=$(kubectl get secret --namespace default minio -o jsonpath="{.data.access-key}" | base64 --decode) -export MINIO_SECRET_KEY=$(kubectl get secret --namespace default minio -o jsonpath="{.data.secret-key}" | base64 --decode) - -kubectl run mng-mongodb-client --rm --tty -i --restart='Never' \ - --env="MONGO_URL=mongodb://root:$MONGODB_ROOT_PASSWORD@mng-mongodb:27017/" \ - --env="MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY" \ - --env="MINIO_SECRET_KEY=$MINIO_SECRET_KEY" --image anticrm/tools --command -- bash diff --git a/server/workspace/src/__create.ts b/server/workspace/src/__create.ts deleted file mode 100644 index 54cdf287fe..0000000000 --- a/server/workspace/src/__create.ts +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright © 2020, 2021 Anticrm Platform Contributors. -// Copyright © 2021 Hardcore Engineering Inc. -// -// Licensed under the Eclipse Public License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. You may -// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import { createWorkspace } from '.' -import { Client } from 'minio' - -const mongoUrl = process.env.MONGO_URL -if (mongoUrl === undefined) { - console.error('please provide mongodb url.') - process.exit(1) -} - -const transactorUrl = process.env.TRANSACTOR_URL -if (transactorUrl === undefined) { - console.error('please provide transactor url.') - process.exit(1) -} - -const minioEndpoint = process.env.MINIO_ENDPOINT -if (minioEndpoint === undefined) { - console.error('please provide minio endpoint') - process.exit(1) -} - -const minioAccessKey = process.env.MINIO_ACCESS_KEY -if (minioAccessKey === undefined) { - console.error('please provide minio access key') - process.exit(1) -} - -const minioSecretKey = process.env.MINIO_SECRET_KEY -if (minioSecretKey === undefined) { - console.error('please provide minio secret key') - process.exit(1) -} - -const db = process.argv[2] -if (db === undefined) { - console.error('Please specify the database.') - process.exit(1) -} - -const minio = new Client({ - endPoint: minioEndpoint, - port: 9000, - useSSL: false, - accessKey: minioAccessKey, - secretKey: minioSecretKey -}) - -console.log('creating model...') -createWorkspace(mongoUrl, db, transactorUrl, minio).then(() => { - console.log('done.') -}).catch(error => { console.error(error) }) diff --git a/server/workspace/src/index.ts b/server/workspace/src/index.ts deleted file mode 100644 index dece6f9aac..0000000000 --- a/server/workspace/src/index.ts +++ /dev/null @@ -1,58 +0,0 @@ -// -// Copyright © 2020, 2021 Anticrm Platform Contributors. -// Copyright © 2021 Hardcore Engineering Inc. -// -// Licensed under the Eclipse Public License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. You may -// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import { createContributingClient } from '@anticrm/contrib' -import core, { DOMAIN_TX } from '@anticrm/core' -import builder from '@anticrm/model-all' -import { encode } from 'jwt-simple' -import { Client } from 'minio' -import { Document, MongoClient } from 'mongodb' - -const txes = builder.getTxes() - -/** - * @public - */ -export async function createWorkspace (mongoUrl: string, dbName: string, clientUrl: string, minio: Client): Promise { - const client = new MongoClient(mongoUrl) - try { - await client.connect() - const db = client.db(dbName) - - console.log('dropping database...') - await db.dropDatabase() - - console.log('creating model...') - const model = txes.filter(tx => tx.objectSpace === core.space.Model) - const result = await db.collection(DOMAIN_TX).insertMany(model as Document[]) - console.log(`${result.insertedCount} model transactions inserted.`) - - console.log('creating data...') - const data = txes.filter(tx => tx.objectSpace !== core.space.Model) - const token = encode({ email: 'anticrm@hc.engineering', workspace: dbName }, 'secret') - const url = new URL(`/${token}`, clientUrl) - const contrib = await createContributingClient(url.href) - for (const tx of data) { - await contrib.tx(tx) - } - contrib.close() - - console.log('create minio bucket') - if (!await minio.bucketExists(dbName)) { await minio.makeBucket(dbName, 'k8s') } - } finally { - await client.close() - } -} diff --git a/server/workspace/tsconfig.json b/server/workspace/tsconfig.json deleted file mode 100644 index fffbf4c341..0000000000 --- a/server/workspace/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json", - - "compilerOptions": { - "rootDir": "./src", - "outDir": "./lib", - "esModuleInterop": true - } -} \ No newline at end of file