Skip to content

Commit

Permalink
Separate tracker deployment (#1245)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <[email protected]>
  • Loading branch information
haiodo authored Apr 1, 2022
1 parent 8cd1797 commit 6fcbd14
Show file tree
Hide file tree
Showing 56 changed files with 904 additions and 215 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
packages
plugins
pods
products
server
server-plugins
templates
Expand Down Expand Up @@ -99,6 +100,7 @@ jobs:
packages
plugins
pods
products
server
server-plugins
templates
Expand Down Expand Up @@ -132,6 +134,7 @@ jobs:
packages
plugins
pods
products
server
server-plugins
templates
Expand Down Expand Up @@ -165,6 +168,7 @@ jobs:
packages
plugins
pods
products
server
server-plugins
templates
Expand Down Expand Up @@ -210,6 +214,7 @@ jobs:
packages
plugins
pods
products
server
server-plugins
templates
Expand All @@ -222,9 +227,9 @@ jobs:
- name: Installing...
run: node common/scripts/install-run-rush.js install
- name: Bundle
run: node common/scripts/install-run-rush.js bundle
run: node common/scripts/install-run-rush.js bundle --verbose
- name: Docker build
run: node common/scripts/install-run-rush.js docker:build
run: node common/scripts/install-run-rush.js docker:build --verbose
- name: Prepare server
run: |
cd ./tests
Expand Down Expand Up @@ -266,6 +271,7 @@ jobs:
packages
plugins
pods
products
server
server-plugins
templates
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ common/autoinstallers/*/.npmrc
**/.rush/temp/
bundle.js
dist
tsconfig.tsbuildinfo
tsconfig.tsbuildinfo
ingest-attachment-*.zip
266 changes: 157 additions & 109 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/scripts/build_docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

roots='./server/server ./server/front ./pods/account'
roots='./server/server ./server/front ./pods/account ./products/tracker'

for r in $roots
do
Expand Down
1 change: 0 additions & 1 deletion dev/client-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default async () => {
await createDeps(client)
}
// Check if we had dev hook for client.
// Check if we had dev hook for client.
const hook = getMetadata(clientPlugin.metadata.ClientHook)
if (hook !== undefined) {
const hookProc = await getResource(hook)
Expand Down
20 changes: 20 additions & 0 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ services:
- MINIO_ENDPOINT=minio
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin
tracker-front:
image: hardcoreeng/tracker-front
links:
- mongodb
- minio
- elastic
- transactor
ports:
- 8084:8080
environment:
- SERVER_PORT=8080
- SERVER_SECRET=secret
- ACCOUNTS_URL=http://localhost:3000
- FRONT_URL=http://localhost:8084
- UPLOAD_URL=/files
- TRANSACTOR_URL=ws://localhost:3333
- ELASTIC_URL=http://elastic:9200
- MINIO_ENDPOINT=minio
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin
transactor:
image: hardcoreeng/transactor
links:
Expand Down
5 changes: 3 additions & 2 deletions dev/prod/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "prod",
"name": "@anticrm/prod",
"version": "1.0.1",
"license": "EPL-2.0",
"scripts": {
Expand Down Expand Up @@ -134,6 +134,7 @@
"@anticrm/presentation": "~0.6.2",
"@anticrm/tracker": "~0.6.0",
"@anticrm/tracker-assets": "~0.6.0",
"@anticrm/tracker-resources": "~0.6.0"
"@anticrm/tracker-resources": "~0.6.0",
"@anticrm/text-editor": "~0.6.0"
}
}
13 changes: 11 additions & 2 deletions dev/prod/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,18 @@ import '@anticrm/notification-assets'
import '@anticrm/tags-assets'
import '@anticrm/calendar-assets'
import '@anticrm/tracker-assets'
import presentation from '@anticrm/presentation'
import presentation, { presentationId } from '@anticrm/presentation'
import { coreId } from '@anticrm/core'
import { textEditorId } from '@anticrm/text-editor'

import { setMetadata } from '@anticrm/platform'


export async function configurePlatform() {
const config = await (await fetch('/config.json')).json()
console.log('loading configuration', config)
setMetadata(login.metadata.AccountsUrl, config.ACCOUNTS_URL)
setMetadata(login.metadata.UploadUrl, config.UPLOAD_URL)


if( config.MODEL_VERSION != null) {
console.log('Minimal Model version requirement', config.MODEL_VERSION)
Expand All @@ -81,6 +84,10 @@ export async function configurePlatform() {

setMetadata(uiPlugin.metadata.DefaultApplication, workbench.component.WorkbenchApp )

addLocation(coreId, async () => ({ default: async () => ({}) }))
addLocation(presentationId, async () => ({ default: async () => ({}) }))
addLocation(textEditorId, async () => ({ default: async () => ({}) }))

addLocation(clientId, () => import(/* webpackChunkName: "client" */ '@anticrm/client-resources'))
addLocation(loginId, () => import(/* webpackChunkName: "login" */ '@anticrm/login-resources'))
addLocation(workbenchId, () => import(/* webpackChunkName: "workbench" */ '@anticrm/workbench-resources'))
Expand All @@ -103,4 +110,6 @@ export async function configurePlatform() {
addLocation(calendarId, () => import(/* webpackChunkName: "calendar" */ '@anticrm/calendar-resources'))

addLocation(trackerId, () => import(/* webpackChunkName: "tracker" */ '@anticrm/tracker-resources'))

setMetadata(workbench.metadata.PlatformTitle, 'Platform')
}
2 changes: 2 additions & 0 deletions models/all/src/creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import { createDeps as createTaskDeps } from '@anticrm/model-task'
import { createDeps as createLeadDeps } from '@anticrm/model-lead'
import { createDeps as createRecruitDeps } from '@anticrm/model-recruit'
import { createDeps as createDemoDeps } from '@anticrm/model-demo'
import { createDeps as createTrackerDeps } from '@anticrm/model-tracker'

export async function createDeps (client: Client): Promise<void> {
await createTaskDeps(client)
await createLeadDeps(client)
await createRecruitDeps(client)
await createDemoDeps(client)
await createTrackerDeps(client)
}
93 changes: 54 additions & 39 deletions models/all/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.
//

import core, { Data, Version } from '@anticrm/core'
import core, { coreId, Data, PluginConfiguration, Ref, Tx, Version } from '@anticrm/core'
import jsonVersion from './version.json'

import { Builder } from '@anticrm/model'
Expand Down Expand Up @@ -58,47 +58,62 @@ export const version: Data<Version> = jsonVersion as Data<Version>

const builder = new Builder()

const builders = [
coreModel,
activityModel,
attachmentModel,
viewModel,
workbenchModel,
contactModel,
chunterModel,
taskModel,
recruitModel,
settingModel,
telegramModel,
leadModel,
gmailModel,
inventoryModel,
presentationModel,
templatesModel,
textEditorModel,
notificationModel,
serverCoreModel,
serverAttachmentModel,
serverContactModel,
serverNotificationModel,
serveSettingModel,
tagsModel,
calendarModel,
serverChunterModel,
serverInventoryModel,
serverLeadModel,
serverTagsModel,
serverTaskModel,
serverRecruitModel,
serverCalendarModel,
serverGmailModel,
serverTelegramModel,
trackerModel,
createDemo
const builders: [(b: Builder) => void, string][] = [
[coreModel, coreId],
[activityModel, 'activity'],
[attachmentModel, 'attachment'],
[viewModel, 'view'],
[workbenchModel, 'workbench'],
[contactModel, 'contact'],
[chunterModel, 'chunter'],
[taskModel, 'task'],
[recruitModel, 'recruit'],
[settingModel, 'setting'],
[telegramModel, 'telegram'],
[leadModel, 'lead'],
[gmailModel, 'gmail'],
[inventoryModel, 'inventory'],
[presentationModel, 'presentation'],
[templatesModel, 'templates'],
[textEditorModel, 'text-editor'],
[notificationModel, 'notification'],

[serverCoreModel, 'server-core'],
[serverAttachmentModel, 'server-attachment'],
[serverContactModel, 'server-contact'],
[serverNotificationModel, 'server-notification'],
[serveSettingModel, 'server-setting'],
[tagsModel, 'tags'],
[calendarModel, 'calendar'],
[serverChunterModel, 'server-chunter'],
[serverInventoryModel, 'server-inventory'],
[serverLeadModel, 'server-lead'],
[serverTagsModel, 'server-tags'],
[serverTaskModel, 'server-task'],
[serverRecruitModel, 'server-recruit'],
[serverCalendarModel, 'server-calendar'],
[serverGmailModel, 'server-gmail'],
[serverTelegramModel, 'server-telegram'],
[trackerModel, 'tracker'],
[createDemo, 'demo']
]

for (const b of builders) {
for (const [b, id] of builders) {
const txes: Tx[] = []
builder.onTx = (tx) => {
txes.push(tx)
}
b(builder)
builder.createDoc(
core.class.PluginConfiguration,
core.space.Model,
{
pluginId: id,
transactions: txes.map((it) => it._id)
},
('plugin-configuration-' + id) as Ref<PluginConfiguration>
)
builder.onTx = undefined
}

builder.createDoc(core.class.Version, core.space.Model, version, core.version.Model)
Expand Down
7 changes: 7 additions & 0 deletions models/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
ClassifierKind, Collection, Doc,
Domain, DOMAIN_MODEL, IndexKind, Interface, Mixin,
Obj,
PluginConfiguration,
Ref, RefTo, Space,
Timestamp,
Type, Version
Expand Down Expand Up @@ -143,3 +144,9 @@ export class TVersion extends TDoc implements Version {
minor!: number
patch!: number
}

@Model(core.class.PluginConfiguration, core.class.Doc, DOMAIN_MODEL)
export class TPluginConfiguration extends TDoc implements PluginConfiguration {
pluginId!: string;
transactions!: Ref<Doc>[]
}
4 changes: 3 additions & 1 deletion models/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
TInterface,
TMixin,
TObj,
TPluginConfiguration,
TRefTo,
TType,
TTypeBoolean,
Expand Down Expand Up @@ -81,6 +82,7 @@ export function createModel (builder: Builder): void {
TArrOf,
TVersion,
TTypeNumber,
TTypeIntlString
TTypeIntlString,
TPluginConfiguration
)
}
7 changes: 6 additions & 1 deletion models/tracker/src/creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ export async function createDeps (client: Client): Promise<void> {
_id: tracker.team.DefaultTeam
})

if (current === undefined) {
const currentDeleted = await tx.findOne(core.class.TxRemoveDoc, {
objectId: tracker.team.DefaultTeam
})

// Create new if not deleted by customers.
if (current === undefined && currentDeleted === undefined) {
await tx.createDoc<Team>(
tracker.class.Team,
core.space.Space,
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ export interface Class<T extends Obj> extends Classifier {
sortingKey?: string
}

/**
* @public
* Define a set of plugin to model document bindings.
*/
export interface PluginConfiguration extends Doc {
pluginId: string
transactions: Ref<Doc>[]
}

/**
* @public
*/
Expand Down
Loading

0 comments on commit 6fcbd14

Please sign in to comment.