Skip to content

Commit

Permalink
fix(server): add region api, fix init image version (#503)
Browse files Browse the repository at this point in the history
Signed-off-by: maslow <wangfugen@126.com>
  • Loading branch information
maslow authored Dec 9, 2022
1 parent 4ff0122 commit 91250c0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deploy/scripts/install-on-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ kubectl taint node $NODENAME node-role.kubernetes.io/control-plane-
sealos run labring/helm:v3.8.2
sealos run labring/openebs:v1.9.0
sealos run labring/cert-manager:v1.8.0
sealos run lafyun/laf:dev
sealos run lafyun/laf:latest

# Optional installations
#arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/)
Expand Down
11 changes: 11 additions & 0 deletions server/src/applications/specs.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ export class SpecsController {
private readonly logger = new Logger(SpecsController.name)
constructor(private readonly prisma: PrismaService) {}

/**
* Get region list
* @returns
*/
@ApiOperation({ summary: 'Get region list' })
@Get('regions')
async getRegions() {
const data = await this.prisma.region.findMany()
return ResponseUtil.ok(data)
}

/**
* Get runtime list
* @returns
Expand Down
17 changes: 17 additions & 0 deletions server/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ export class ServerConfig {
static get APPID_LENGTH(): number {
return parseInt(process.env.APPID_LENGTH || '6')
}

static get DEFAULT_RUNTIME_IMAGE() {
const image =
process.env.DEFAULT_RUNTIME_IMAGE ||
'docker.io/lafyun/runtime-node:latest'

const initImage =
process.env.DEFAULT_RUNTIME_INIT_IMAGE ||
'docker.io/lafyun/runtime-node-init:latest'
return {
image: {
main: image,
init: initImage,
},
version: 'latest',
}
}
}

export class ResourceLabels {
Expand Down
8 changes: 4 additions & 4 deletions server/src/initializer/initializer.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, Logger } from '@nestjs/common'
import { CPU_UNIT, MB } from 'src/constants'
import { CPU_UNIT, MB, ServerConfig } from 'src/constants'
import { PrismaService } from 'src/prisma.service'

@Injectable()
Expand Down Expand Up @@ -64,10 +64,10 @@ export class InitializerService {
name: 'node',
type: 'node:laf',
image: {
main: 'docker.io/lafyun/runtime-node:1.0.0-alpha.0',
init: 'docker.io/lafyun/runtime-node-init:1.0.0-alpha.0',
main: ServerConfig.DEFAULT_RUNTIME_IMAGE.image.main,
init: ServerConfig.DEFAULT_RUNTIME_IMAGE.image.init,
},
version: '1.0.0-alpha.0',
version: ServerConfig.DEFAULT_RUNTIME_IMAGE.version,
latest: true,
},
})
Expand Down

0 comments on commit 91250c0

Please sign in to comment.