tooling update

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-08-28 23:28:46 +02:00
parent 3e8a531099
commit c713a07531
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
12 changed files with 111 additions and 23 deletions

2
.gitignore vendored
View File

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

View File

@ -71,6 +71,7 @@ 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
@ -84,6 +85,7 @@ specifiers:
cross-env: ^7.0.3
css-loader: ^5.2.1
dotenv-webpack: ^7.0.2
esbuild: ^0.12.24
eslint: ^7.32.0
eslint-config-standard-with-typescript: ^20.0.0
eslint-plugin-import: '2'
@ -185,6 +187,7 @@ 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
@ -198,6 +201,7 @@ dependencies:
cross-env: 7.0.3
css-loader: 5.2.7_webpack@5.48.0
dotenv-webpack: 7.0.3_webpack@5.48.0
esbuild: 0.12.24
eslint: 7.32.0
eslint-config-standard-with-typescript: 20.0.0_2e482f375e273d762fe67cbd5e194b49
eslint-plugin-import: 2.23.4_eslint@7.32.0
@ -9153,7 +9157,7 @@ packages:
dev: false
file:projects/front.tgz_6c259fadfeb3a4b20890aefe87070b8b:
resolution: {integrity: sha512-LkPDbq5ryvnmz54MLr4Bj2L3G3vpBIoChyagXRYuwq3RVddY0BN0qVlNTafiapGztblj+mhH93NpKddrhMCEIA==, tarball: file:projects/front.tgz}
resolution: {integrity: sha512-XmgU22kXGEisU6bW4q3GuuqhzjWazpokQ+ASxb2Nu7M/cTM+xy9EY/fvessk79EXRTGFvoH4hM2jrbleWKP9ug==, tarball: file:projects/front.tgz}
id: file:projects/front.tgz
name: '@rush-temp/front'
version: 0.0.0
@ -9727,7 +9731,7 @@ packages:
dev: false
file:projects/server.tgz_6c259fadfeb3a4b20890aefe87070b8b:
resolution: {integrity: sha512-6XfixxRO1uisszjaBtMFoQCCvv2zWAknPVz3ZmES4q/keIWZuDDP667FpDMJ9maBB1AN7ImI9VBMXNbXDlVUuA==, tarball: file:projects/server.tgz}
resolution: {integrity: sha512-MEVHXm1K1YXXILA5Aq14mHsfYoFCd9Y43+vOFu6SHjXEphIn7J7neQm08DOqMWiSKbWK9uvkNjHEr5Fw12Mbog==, tarball: file:projects/server.tgz}
id: file:projects/server.tgz
name: '@rush-temp/server'
version: 0.0.0
@ -9736,6 +9740,7 @@ packages:
'@types/node': 16.7.1
'@types/ws': 7.4.7
'@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
@ -9995,7 +10000,7 @@ packages:
dev: false
file:projects/workspace.tgz_6c259fadfeb3a4b20890aefe87070b8b:
resolution: {integrity: sha512-q2/1LqGkYRwsMNbjDjy4ngJlBDAefFWXuEdVyIN0DyBjmBibnEVZuQayjBh5O7xUQYKlT0A7TdVn99hpIwixOA==, tarball: file:projects/workspace.tgz}
resolution: {integrity: sha512-Ircelx/9snTrdceAfj7OBTqmR1tZ/cTtPtdf3zcmTJ+EwFh0rhWQJgd80CSeny6I8wMC+UXcKUk5mGHDqcmKcw==, tarball: file:projects/workspace.tgz}
id: file:projects/workspace.tgz
name: '@rush-temp/workspace'
version: 0.0.0
@ -10003,6 +10008,7 @@ packages:
'@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

View File

@ -4,7 +4,7 @@ kind: Deployment
metadata:
name: front
spec:
replicas: 5
replicas: 1
selector:
matchLabels:
app: front

View File

@ -7,7 +7,9 @@
"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/"
"bundle": "esbuild src/index.ts --bundle --minify --platform=node > bundle.js & cp -r ../../dev/prod/dist . & cp -r ../../dev/prod/public/* ./dist/",
"docker:build": "docker build -t anticrm/front .",
"docker:push": "docker push anticrm/front"
},
"devDependencies": {
"@anticrm/platform-rig":"~0.6.0",

View File

@ -1,32 +1,34 @@
//
// 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();
import { resolve, join } from 'path'
// serve static assets normally
app.use(express.static(__dirname + '/dist', { maxAge: '10m'}))
const port = process.env.PORT ?? 8080
const app = express()
const dist = resolve(__dirname, 'dist')
console.log('serving static files from', dist)
app.use(express.static(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'))
response.sendFile(join(dist, 'index.html'))
})
app.listen(port)
console.log("server started on port " + port)
console.log(`server started on port ${port}`)

8
server/server/Dockerfile Normal file
View File

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

View File

@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: transactor
spec:
replicas: 1
selector:
matchLabels:
app: transactor
template:
metadata:
labels:
app: transactor
spec:
containers:
- name: app
image: anticrm/transactor
ports:
- containerPort: 3333
imagePullPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: transactor
spec:
selector:
app: transactor
ports:
- port: 80
targetPort: 3333

View File

@ -7,7 +7,10 @@
"scripts": {
"start": "ts-node src/__start.ts",
"build": "heft build",
"lint:fix": "eslint --fix src"
"lint:fix": "eslint --fix src",
"bundle": "esbuild src/__start.ts --bundle --minify --platform=node > bundle.js",
"docker:build": "docker build -t anticrm/transactor .",
"docker:push": "docker push anticrm/transactor"
},
"devDependencies": {
"@anticrm/platform-rig":"~0.6.0",
@ -19,7 +22,8 @@
"eslint-plugin-node":"11",
"eslint":"^7.32.0",
"@types/ws":"^7.4.7",
"ts-node":"^10.2.1"
"ts-node":"^10.2.1",
"esbuild":"^0.12.24"
},
"dependencies": {
"@anticrm/core": "~0.6.11",

View File

@ -0,0 +1,8 @@
FROM node
WORKDIR /usr/src/app
COPY bundle.js ./
EXPOSE 8080
CMD [ "bash" ]

View File

@ -7,7 +7,10 @@
"scripts": {
"create": "ts-node src/__create.ts",
"build": "heft build",
"lint:fix": "eslint --fix src"
"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"
},
"devDependencies": {
"@anticrm/platform-rig":"~0.6.0",
@ -17,7 +20,8 @@
"eslint-plugin-promise":"4",
"eslint-plugin-node":"11",
"eslint":"^7.32.0",
"ts-node":"^10.2.1"
"ts-node":"^10.2.1",
"esbuild":"~0.12.24"
},
"dependencies": {
"@anticrm/core": "~0.6.11",

18
server/workspace/run.sh Executable file
View File

@ -0,0 +1,18 @@
#!/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)
kubectl run mng-mongodb-client --rm --tty -i --restart='Never' --env="MONGO_URL=mongodb://root:$MONGODB_ROOT_PASSWORD@mng-mongodb:27017/" --image anticrm/tools --command -- bash

View File

@ -19,6 +19,10 @@ import { DOMAIN_TX } from '@anticrm/core'
import * as txJson from './model.tx.json'
const txes = (txJson as any).default
console.log(txes)
/**
* @public
*/
@ -28,7 +32,7 @@ export async function createModel (url: string, dbName: string): Promise<number>
await client.connect()
const db = client.db(dbName)
await db.dropDatabase()
const result = await db.collection(DOMAIN_TX).insertMany(txJson as Document[])
const result = await db.collection(DOMAIN_TX).insertMany(txes as Document[])
return result.insertedCount
} finally {
await client.close()