Skip to content

Commit

Permalink
chore(web&server): database repair, rollback on dependency restart... (
Browse files Browse the repository at this point in the history
…#2017)

* fix(web): adjust transparency of the overlay for application startup logs

* chore(web): Optimize log display logic

* chore(web): fix bouns display

* chore(web&server): database repair, rollback on dependency restart...

---------

Co-authored-by: HUAHUAI23 <[email protected]>
Co-authored-by: GH Action - Upstream Sync <[email protected]>
  • Loading branch information
3 people authored Jun 26, 2024
1 parent 6311eb8 commit 10ed931
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class DedicatedDatabaseService {
limitMemory,
requestCPU,
requestMemory,
capacity,
capacity: capacity / 1024,
replicas,
})

Expand Down Expand Up @@ -200,6 +200,7 @@ export class DedicatedDatabaseService {
options: {
authSource: 'admin',
replicaSet: `${name}-mongodb`,
readPreference: 'secondaryPreferred',
w: 'majority',
},
scheme: 'mongodb',
Expand Down
21 changes: 9 additions & 12 deletions server/src/dependency/dependency.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ export class DependencyService {
const new_deps = dto.map((dep) => `${dep.name}@${dep.spec}`)
const deps = extras.concat(new_deps)

const res = await this.db
await this.db
.collection<ApplicationConfiguration>('ApplicationConfiguration')
.findOneAndUpdate(
.updateOne(
{ appid },
{ $set: { dependencies: deps, updatedAt: new Date() } },
{ returnDocument: 'after' },
)
await this.confService.publish(res.value)

return true
}

Expand All @@ -87,14 +86,13 @@ export class DependencyService {

const deps = filtered.concat(new_deps)

const res = await this.db
await this.db
.collection<ApplicationConfiguration>('ApplicationConfiguration')
.findOneAndUpdate(
.updateOne(
{ appid },
{ $set: { dependencies: deps, updatedAt: new Date() } },
{ returnDocument: 'after' },
)
await this.confService.publish(res.value)

return true
}

Expand All @@ -107,14 +105,13 @@ export class DependencyService {

if (filtered.length === deps.length) return false

const res = await this.db
await this.db
.collection<ApplicationConfiguration>('ApplicationConfiguration')
.findOneAndUpdate(
.updateOne(
{ appid },
{ $set: { dependencies: filtered, updatedAt: new Date() } },
{ returnDocument: 'after' },
)
await this.confService.publish(res.value)

return true
}

Expand Down
2 changes: 1 addition & 1 deletion server/src/initializer/deploy-manifest/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: <%- capacity %>Mi
storage: <%- capacity %>Gi
terminationPolicy: Delete
tolerations: []
6 changes: 3 additions & 3 deletions server/src/instance/instance-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ export class InstanceTaskService {
return
}

// create instance
await this.instanceService.create(app.appid)

const appid = app.appid

const ddb = await this.dedicatedDatabaseService.findOne(appid)
Expand All @@ -152,6 +149,9 @@ export class InstanceTaskService {
}
}

// create instance
await this.instanceService.create(app.appid)

const instance = await this.instanceService.get(appid)
const unavailable =
instance.deployment?.status?.unavailableReplicas || false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ export default function DatabaseMonitor() {
metric: Record<string, string>;
values: Array<[number, string]>;
}[] = resourceData?.data?.memory;

const podList = useMemo(() => {
if (!cpuData || !memoryData) return [];
const cpuPods = cpuData.map((item) => item.metric.pod);
const memoryPods = memoryData.map((item) => item.metric.pod);

Expand Down

0 comments on commit 10ed931

Please sign in to comment.