initial front implementation

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-08-28 22:31:45 +02:00
parent d38bbfe0a6
commit a30c08bd9d
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
17 changed files with 256 additions and 15 deletions

2
.gitignore vendored
View File

@ -67,3 +67,5 @@ common/deploy/
common/temp/
common/autoinstallers/*/.npmrc
**/.rush/temp/
server/front/bundle.js
dist

View File

@ -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"
]
})

View File

@ -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

View File

@ -8,7 +8,7 @@
<title>Svelte app</title>
<link rel='icon' type='image/png' href='favicon.png'>
<link rel='stylesheet' href='bundle.css'>
<link rel='stylesheet' href='/bundle.css'>
</head>
<body style="margin: 0; overflow: hidden;">

View File

@ -736,5 +736,10 @@
"projectFolder": "server/contrib",
"shouldPublish": true
},
{
"packageName": "@anticrm/front",
"projectFolder": "server/front",
"shouldPublish": true
},
]
}

View File

@ -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",

View File

@ -0,0 +1,6 @@
module.exports = {
extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'],
parserOptions: {
project: './tsconfig.json'
}
}

4
server/front/.npmignore Normal file
View File

@ -0,0 +1,4 @@
*
!/lib/**
!CHANGELOG.md
/lib/**/__tests__/

9
server/front/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM node:14
WORKDIR /usr/src/app
COPY bundle.js ./
COPY dist/ ./dist/
EXPOSE 8080
CMD [ "node", "bundle.js" ]

View File

@ -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"
}

32
server/front/front.yml Normal file
View File

@ -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

23
server/front/ingress.yml Normal file
View File

@ -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

View File

@ -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

18
server/front/issuer.yml Normal file
View File

@ -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

29
server/front/package.json Normal file
View File

@ -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"
}
}

32
server/front/src/index.ts Normal file
View File

@ -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)

View File

@ -0,0 +1,10 @@
{
"extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json",
"compilerOptions": {
"target": "ES2019",
"rootDir": "./src",
"outDir": "./lib",
"esModuleInterop": true
}
}