diff --git a/.gitignore b/.gitignore index 236e3e6307..cf14211bf7 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,5 @@ common/deploy/ common/temp/ common/autoinstallers/*/.npmrc **/.rush/temp/ +server/front/bundle.js +dist diff --git a/cloud/app/index.ts b/cloud/app/index.ts index ada806f346..d3586c4191 100644 --- a/cloud/app/index.ts +++ b/cloud/app/index.ts @@ -275,3 +275,13 @@ new aws.route53.Record("databaseRecord", { "xored.com" ] }) + +new aws.route53.Record("frontRecord", { + name: "front.hc.engineering", + zoneId: zoneId, + type: "A", + ttl: 300, + records: [ + "8.9.31.18" + ] +}) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 32695b18bc..5544797d63 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -18,6 +18,7 @@ specifiers: '@rush-temp/dev-server-chunter-resources': file:./projects/dev-server-chunter-resources.tgz '@rush-temp/dev-storage': file:./projects/dev-storage.tgz '@rush-temp/elastic': file:./projects/elastic.tgz + '@rush-temp/front': file:./projects/front.tgz '@rush-temp/login': file:./projects/login.tgz '@rush-temp/login-assets': file:./projects/login-assets.tgz '@rush-temp/login-resources': file:./projects/login-resources.tgz @@ -70,7 +71,6 @@ specifiers: '@tiptap/extension-typography': ~2.0.0-beta.13 '@tiptap/starter-kit': ~2.0.0-beta.89 '@types/cors': ^2.8.12 - '@types/express': ^4.17.13 '@types/express-fileupload': ^1.1.7 '@types/heft-jest': ^1.0.2 '@types/toposort': ^2.0.3 @@ -94,6 +94,7 @@ specifiers: file-loader: ^6.2.0 intl-messageformat: ^9.7.1 mini-css-extract-plugin: ^2.2.0 + mongodb: ^4.1.0 node-html-parser: ^4.1.3 postcss: ^8.3.4 postcss-load-config: ^3.1.0 @@ -131,6 +132,7 @@ dependencies: '@rush-temp/dev-server-chunter-resources': file:projects/dev-server-chunter-resources.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/dev-storage': file:projects/dev-storage.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/elastic': file:projects/elastic.tgz_6c259fadfeb3a4b20890aefe87070b8b + '@rush-temp/front': file:projects/front.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/login': file:projects/login.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/login-assets': file:projects/login-assets.tgz '@rush-temp/login-resources': file:projects/login-resources.tgz_c38cf1a7a413db8918b0b4754c21e4c5 @@ -183,7 +185,6 @@ dependencies: '@tiptap/extension-typography': 2.0.0-beta.13_@tiptap+core@2.0.0-beta.93 '@tiptap/starter-kit': 2.0.0-beta.89 '@types/cors': 2.8.12 - '@types/express': 4.17.13 '@types/express-fileupload': 1.1.7 '@types/heft-jest': 1.0.2 '@types/toposort': 2.0.3 @@ -207,6 +208,7 @@ dependencies: file-loader: 6.2.0_webpack@5.48.0 intl-messageformat: 9.8.1 mini-css-extract-plugin: 2.2.0_webpack@5.48.0 + mongodb: 4.1.1 node-html-parser: 4.1.3 postcss: 8.3.6 postcss-load-config: 3.1.0 @@ -1365,13 +1367,13 @@ packages: resolution: {integrity: sha512-a6bTJ21vFOGIkwM0kzh9Yr89ziVxq4vYH2fQ6N8AeipEzai/cFK6aGMArIkUeIdRIgpwQa+2bXiLuUJCpSf2Cg==} dependencies: '@types/connect': 3.4.35 - '@types/node': 16.4.13 + '@types/node': 16.7.1 dev: false /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 16.4.13 + '@types/node': 16.7.1 dev: false /@types/cors/2.8.12: @@ -1405,7 +1407,7 @@ packages: /@types/express-serve-static-core/4.17.24: resolution: {integrity: sha512-3UJuW+Qxhzwjq3xhwXm2onQcFHn76frIYVbTu+kn24LFxI+dEhdfISDFovPB8VpEgW8oQCTpRuCe+0zJxB7NEA==} dependencies: - '@types/node': 16.4.13 + '@types/node': 16.7.1 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 dev: false @@ -1492,10 +1494,6 @@ packages: resolution: {integrity: sha512-TmVHsm43br64js9BqHWqiDZA+xMtbUpI1MBIA0EyiBmoV9pcEYFOSdj5fr6enZNfh4fChh+AGOLIzGwJnkshyQ==} dev: false - /@types/node/16.4.13: - resolution: {integrity: sha512-bLL69sKtd25w7p1nvg9pigE4gtKVpGTPojBFLMkGHXuUgap2sLqQt2qUnqmVCDfzGUL0DRNZP+1prIZJbMeAXg==} - dev: false - /@types/node/16.7.1: resolution: {integrity: sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A==} dev: false @@ -1618,7 +1616,7 @@ packages: resolution: {integrity: sha512-nCkHGI4w7ZgAdNkrEu0bv+4xNV/XDqW+DydknebMOQwkpDGx8G+HTlj7R7ABI8i8nKxVw0wtKPi1D+lPOkh4YQ==} dependencies: '@types/mime': 1.3.2 - '@types/node': 16.4.13 + '@types/node': 16.7.1 dev: false /@types/stack-utils/1.0.1: @@ -3367,6 +3365,12 @@ packages: is-symbol: 1.0.4 dev: false + /esbuild/0.12.24: + resolution: {integrity: sha512-C0ibY+HsXzYB6L/pLWEiWjMpghKsIc58Q5yumARwBQsHl9DXPakW+5NI/Y9w4YXiz0PEP6XTGTT/OV4Nnsmb4A==} + hasBin: true + requiresBuild: true + dev: false + /escalade/3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -9148,6 +9152,28 @@ packages: - typescript dev: false + file:projects/front.tgz_6c259fadfeb3a4b20890aefe87070b8b: + resolution: {integrity: sha512-LkPDbq5ryvnmz54MLr4Bj2L3G3vpBIoChyagXRYuwq3RVddY0BN0qVlNTafiapGztblj+mhH93NpKddrhMCEIA==, tarball: file:projects/front.tgz} + id: file:projects/front.tgz + name: '@rush-temp/front' + version: 0.0.0 + dependencies: + '@types/express': 4.17.13 + '@types/heft-jest': 1.0.2 + '@types/node': 16.7.1 + '@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea + esbuild: 0.12.24 + eslint: 7.32.0 + eslint-plugin-import: 2.23.4_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 4.3.1 + express: 4.17.1 + transitivePeerDependencies: + - '@typescript-eslint/parser' + - supports-color + - typescript + dev: false + file:projects/login-assets.tgz: resolution: {integrity: sha512-a/tWogP5p3gmtAVHY5bGyWLlR4YNEu/nMrTeDaLzi7DmjP0mnqCySe1rHU4UVks4AI6Svnhqo6RtRJOqRDTSoA==, tarball: file:projects/login-assets.tgz} name: '@rush-temp/login-assets' @@ -9656,7 +9682,7 @@ packages: dev: false file:projects/server-core.tgz_6c259fadfeb3a4b20890aefe87070b8b: - resolution: {integrity: sha512-hY0riFOPA+iJ7WkWqsmhnHkBirMDX1vZeGLoTIgb4GZ4PpFFVIz5XTgQjDfPDUi/ohY2NZGZMJNRhAec2jvXeg==, tarball: file:projects/server-core.tgz} + resolution: {integrity: sha512-f1N/pKtvanmAkPGw2nSzRr2hmcG6byZ1lbhstOde2oV3x/qoDfIbYCUSG3/lzDt6jEN+EnwXauxvCIGWqtTxWA==, tarball: file:projects/server-core.tgz} id: file:projects/server-core.tgz name: '@rush-temp/server-core' version: 0.0.0 @@ -9846,7 +9872,7 @@ packages: dev: false file:projects/upload.tgz_6c259fadfeb3a4b20890aefe87070b8b: - resolution: {integrity: sha512-StYlClUVsoxqeaYRM3BKSCnt2vfYSyxBobnnihP5f/6qVCazJTeCEDjZhYOOPNzJqQt+Z8iO63ajYuIV2c+1IA==, tarball: file:projects/upload.tgz} + resolution: {integrity: sha512-ak4xpI/m2ZKbxOIOnPnJ/+TxbaNxCKLgIeihA516iRc1r66eyRRgyIig2Ebx4JZw+VMToUvbSrZuITdLZAFPAA==, tarball: file:projects/upload.tgz} id: file:projects/upload.tgz name: '@rush-temp/upload' version: 0.0.0 diff --git a/dev/prod/public/index.html b/dev/prod/public/index.html index 34b56ebda9..1474b2b6f8 100644 --- a/dev/prod/public/index.html +++ b/dev/prod/public/index.html @@ -8,7 +8,7 @@ Svelte app - + diff --git a/rush.json b/rush.json index 39c049051e..ebd4fa73f6 100644 --- a/rush.json +++ b/rush.json @@ -736,5 +736,10 @@ "projectFolder": "server/contrib", "shouldPublish": true }, + { + "packageName": "@anticrm/front", + "projectFolder": "server/front", + "shouldPublish": true + }, ] } diff --git a/server/core/package.json b/server/core/package.json index 0a461bfad2..6c6742fbbd 100644 --- a/server/core/package.json +++ b/server/core/package.json @@ -16,8 +16,7 @@ "eslint-plugin-import":"2", "eslint-plugin-promise":"4", "eslint-plugin-node":"11", - "eslint":"^7.32.0", - "@types/ws":"^7.4.7" + "eslint":"^7.32.0" }, "dependencies": { "@anticrm/core": "~0.6.11", diff --git a/server/front/.eslintrc.js b/server/front/.eslintrc.js new file mode 100644 index 0000000000..89f8151bd4 --- /dev/null +++ b/server/front/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + project: './tsconfig.json' + } +} \ No newline at end of file diff --git a/server/front/.npmignore b/server/front/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/server/front/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/server/front/Dockerfile b/server/front/Dockerfile new file mode 100644 index 0000000000..0b1661b029 --- /dev/null +++ b/server/front/Dockerfile @@ -0,0 +1,9 @@ +FROM node:14 + +WORKDIR /usr/src/app + +COPY bundle.js ./ +COPY dist/ ./dist/ + +EXPOSE 8080 +CMD [ "node", "bundle.js" ] diff --git a/server/front/config/rig.json b/server/front/config/rig.json new file mode 100644 index 0000000000..af1257a896 --- /dev/null +++ b/server/front/config/rig.json @@ -0,0 +1,18 @@ +// 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/front/front.yml b/server/front/front.yml new file mode 100644 index 0000000000..a05cb369a8 --- /dev/null +++ b/server/front/front.yml @@ -0,0 +1,32 @@ + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: front +spec: + replicas: 5 + selector: + matchLabels: + app: front + template: + metadata: + labels: + app: front + spec: + containers: + - name: app + image: anticrm/front + ports: + - containerPort: 8080 + imagePullPolicy: Always +--- +apiVersion: v1 +kind: Service +metadata: + name: front +spec: + selector: + app: front + ports: + - port: 80 + targetPort: 8080 diff --git a/server/front/ingress.yml b/server/front/ingress.yml new file mode 100644 index 0000000000..6dbeaf9a18 --- /dev/null +++ b/server/front/ingress.yml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: "nginx" + cert-manager.io/issuer: "letsencrypt-prod" + name: front-ingress +spec: + tls: + - hosts: + - front.hc.engineering + secretName: front-tls + rules: + - host: front.hc.engineering + http: + paths: + - backend: + service: + name: front + port: + number: 80 + path: / + pathType: Prefix diff --git a/server/front/issuer-prod.yml b/server/front/issuer-prod.yml new file mode 100644 index 0000000000..6e3b2b4ea1 --- /dev/null +++ b/server/front/issuer-prod.yml @@ -0,0 +1,18 @@ +apiVersion: cert-manager.io/v1 +kind: Issuer +metadata: + name: letsencrypt-prod +spec: + acme: + # The ACME server URL + server: https://acme-v02.api.letsencrypt.org/directory + # Email address used for ACME registration + email: andrey@hardcoreeng.com + # Name of a secret used to store the ACME account private key + privateKeySecretRef: + name: letsencrypt-prod + # Enable the HTTP-01 challenge provider + solvers: + - http01: + ingress: + class: nginx diff --git a/server/front/issuer.yml b/server/front/issuer.yml new file mode 100644 index 0000000000..986587df9f --- /dev/null +++ b/server/front/issuer.yml @@ -0,0 +1,18 @@ +apiVersion: cert-manager.io/v1 +kind: Issuer +metadata: + name: letsencrypt-staging +spec: + acme: + # The ACME server URL + server: https://acme-staging-v02.api.letsencrypt.org/directory + # Email address used for ACME registration + email: andrey@hardcoreeng.com + # Name of a secret used to store the ACME account private key + privateKeySecretRef: + name: letsencrypt-staging + # Enable the HTTP-01 challenge provider + solvers: + - http01: + ingress: + class: nginx diff --git a/server/front/package.json b/server/front/package.json new file mode 100644 index 0000000000..125499b8c2 --- /dev/null +++ b/server/front/package.json @@ -0,0 +1,29 @@ +{ + "name": "@anticrm/front", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "lint:fix": "eslint --fix src", + "bundle": "esbuild src/index.ts --bundle --platform=node > bundle.js & cp -r ../../dev/prod/dist . & cp -r ../../dev/prod/public/* ./dist/" + }, + "devDependencies": { + "@anticrm/platform-rig":"~0.6.0", + "@types/heft-jest":"^1.0.2", + "@types/node": "^16.4.10", + "@typescript-eslint/eslint-plugin":"4", + "eslint-plugin-import":"2", + "eslint-plugin-promise":"4", + "eslint-plugin-node":"11", + "eslint":"^7.32.0", + "@types/express":"^4.17.13", + "esbuild":"^0.12.24" + }, + "dependencies": { + "@anticrm/core": "~0.6.11", + "@anticrm/platform": "~0.6.5", + "express": "^4.17.1" + } +} diff --git a/server/front/src/index.ts b/server/front/src/index.ts new file mode 100644 index 0000000000..e0f03e4199 --- /dev/null +++ b/server/front/src/index.ts @@ -0,0 +1,32 @@ +// +// 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 express from 'express' +import path from 'path' +const port = process.env.PORT || 8080; +const app = express(); + +// serve static assets normally +app.use(express.static(__dirname + '/dist', { maxAge: '10m'})) + +// handle every other route with index.html, which will contain +// a script tag to your application's JavaScript file(s). +app.get('*', function (request, response) { + response.sendFile(path.resolve(__dirname + '/dist', 'index.html')) +}) + +app.listen(port) +console.log("server started on port " + port) diff --git a/server/front/tsconfig.json b/server/front/tsconfig.json new file mode 100644 index 0000000000..548666d1a2 --- /dev/null +++ b/server/front/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "target": "ES2019", + "rootDir": "./src", + "outDir": "./lib", + "esModuleInterop": true + } +} \ No newline at end of file