connect tailscale node status through platform gateway
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -69,7 +69,7 @@ model LauncherSshKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
model LauncherCommonSetting {
|
model LauncherSetting {
|
||||||
id String @id @default(uuid()) @db.Uuid
|
id String @id @default(uuid()) @db.Uuid
|
||||||
key String @unique
|
key String @unique
|
||||||
name String
|
name String
|
||||||
@@ -82,5 +82,5 @@ model LauncherCommonSetting {
|
|||||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
|
||||||
|
|
||||||
@@index([type, isActive])
|
@@index([type, isActive])
|
||||||
@@map("launcher_common_settings")
|
@@map("launcher_settings")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
ALTER TABLE IF EXISTS "launcher_common_settings" RENAME TO "launcher_settings";
|
||||||
|
|
||||||
|
COMMENT ON TABLE "launcher_settings" IS '런처 소스, 빌드 환경 등 내부 설정';
|
||||||
@@ -279,59 +279,3 @@ export class UpdateLauncherBuildEnvDto {
|
|||||||
@Type(() => LauncherBuildEnvVariableDto)
|
@Type(() => LauncherBuildEnvVariableDto)
|
||||||
variables!: LauncherBuildEnvVariableDto[];
|
variables!: LauncherBuildEnvVariableDto[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateLauncherCommonSettingDto {
|
|
||||||
@IsString()
|
|
||||||
key!: string;
|
|
||||||
|
|
||||||
@IsString()
|
|
||||||
name!: string;
|
|
||||||
|
|
||||||
@IsString()
|
|
||||||
type!: string;
|
|
||||||
|
|
||||||
@IsString()
|
|
||||||
value!: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
description?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
@IsBoolean()
|
|
||||||
isActive?: boolean;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
@IsBoolean()
|
|
||||||
isSecret?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UpdateLauncherCommonSettingDto {
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
key?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
name?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
type?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
value?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
@IsString()
|
|
||||||
description?: string;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
@IsBoolean()
|
|
||||||
isActive?: boolean;
|
|
||||||
|
|
||||||
@IsOptional()
|
|
||||||
@IsBoolean()
|
|
||||||
isSecret?: boolean;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query } from '@nestjs/common';
|
||||||
|
|
||||||
import { CreateLauncherAppLinkDto, CreateLauncherBuildJobDto, CreateLauncherCommonSettingDto, CreateLauncherVersionDto, UpdateLauncherSourceDto, LinkLauncherVersionSourceDto, MoveLauncherAppLinkDto, UpdateLauncherAppLinkDto, UpdateLauncherBuildEnvDto, UpdateLauncherCommonSettingDto, UpdateLauncherUserAppPermissionsDto, DeployLauncherBackendDto, ListLauncherBuildJobsQuery } from './dto';
|
import { CreateLauncherAppLinkDto, CreateLauncherBuildJobDto, CreateLauncherVersionDto, UpdateLauncherSourceDto, LinkLauncherVersionSourceDto, MoveLauncherAppLinkDto, UpdateLauncherAppLinkDto, UpdateLauncherBuildEnvDto, UpdateLauncherUserAppPermissionsDto, DeployLauncherBackendDto, ListLauncherBuildJobsQuery } from './dto';
|
||||||
import { LauncherService } from './launcher.service';
|
import { LauncherService } from './launcher.service';
|
||||||
|
|
||||||
@Controller('launcher')
|
@Controller('launcher')
|
||||||
@@ -58,31 +58,6 @@ export class LauncherController {
|
|||||||
return this.launcherService.createBuildJob(body);
|
return this.launcherService.createBuildJob(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Get('common-settings')
|
|
||||||
listCommonSettings() {
|
|
||||||
return this.launcherService.listCommonSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Post('common-settings')
|
|
||||||
createCommonSetting(@Body() body: CreateLauncherCommonSettingDto) {
|
|
||||||
return this.launcherService.createCommonSetting(body);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Patch('common-settings/:id')
|
|
||||||
updateCommonSetting(
|
|
||||||
@Param('id') id: string,
|
|
||||||
@Body() body: UpdateLauncherCommonSettingDto,
|
|
||||||
) {
|
|
||||||
return this.launcherService.updateCommonSetting(id, body);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Delete('common-settings/:id')
|
|
||||||
deleteCommonSetting(@Param('id') id: string) {
|
|
||||||
return this.launcherService.deleteCommonSetting(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Get('app-links')
|
@Get('app-links')
|
||||||
listAppLinks() {
|
listAppLinks() {
|
||||||
return this.launcherService.listAppLinks();
|
return this.launcherService.listAppLinks();
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { PrismaService } from '../prisma/prisma.service';
|
|||||||
import {
|
import {
|
||||||
CreateLauncherAppLinkDto,
|
CreateLauncherAppLinkDto,
|
||||||
CreateLauncherBuildJobDto,
|
CreateLauncherBuildJobDto,
|
||||||
CreateLauncherCommonSettingDto,
|
|
||||||
CreateLauncherVersionDto,
|
CreateLauncherVersionDto,
|
||||||
DeployLauncherBackendDto,
|
DeployLauncherBackendDto,
|
||||||
ListLauncherBuildJobsQuery,
|
ListLauncherBuildJobsQuery,
|
||||||
@@ -21,7 +20,6 @@ import {
|
|||||||
LinkLauncherVersionSourceDto,
|
LinkLauncherVersionSourceDto,
|
||||||
UpdateLauncherAppLinkDto,
|
UpdateLauncherAppLinkDto,
|
||||||
UpdateLauncherBuildEnvDto,
|
UpdateLauncherBuildEnvDto,
|
||||||
UpdateLauncherCommonSettingDto,
|
|
||||||
UpdateLauncherUserAppPermissionsDto,
|
UpdateLauncherUserAppPermissionsDto,
|
||||||
} from './dto';
|
} from './dto';
|
||||||
|
|
||||||
@@ -76,51 +74,6 @@ export class LauncherService {
|
|||||||
return rows.map(mapLauncherVersionRow);
|
return rows.map(mapLauncherVersionRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
listCommonSettings() {
|
|
||||||
return this.launcherPrisma.launcherCommonSetting.findMany({
|
|
||||||
orderBy: [{ isActive: 'desc' }, { type: 'asc' }, { name: 'asc' }],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async createCommonSetting(body: CreateLauncherCommonSettingDto) {
|
|
||||||
const setting = await this.launcherPrisma.launcherCommonSetting.create({
|
|
||||||
data: {
|
|
||||||
key: body.key.trim(),
|
|
||||||
name: body.name.trim(),
|
|
||||||
type: body.type.trim(),
|
|
||||||
value: body.value.trim(),
|
|
||||||
description: body.description?.trim() || null,
|
|
||||||
isActive: body.isActive ?? true,
|
|
||||||
isSecret: body.isSecret ?? false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return { setting };
|
|
||||||
}
|
|
||||||
|
|
||||||
async updateCommonSetting(id: string, body: UpdateLauncherCommonSettingDto) {
|
|
||||||
const setting = await this.launcherPrisma.launcherCommonSetting.update({
|
|
||||||
where: { id },
|
|
||||||
data: {
|
|
||||||
key: body.key === undefined ? undefined : body.key.trim(),
|
|
||||||
name: body.name === undefined ? undefined : body.name.trim(),
|
|
||||||
type: body.type === undefined ? undefined : body.type.trim(),
|
|
||||||
value: body.value === undefined ? undefined : body.value.trim(),
|
|
||||||
description: body.description === undefined ? undefined : body.description.trim() || null,
|
|
||||||
isActive: body.isActive,
|
|
||||||
isSecret: body.isSecret,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return { setting };
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteCommonSetting(id: string) {
|
|
||||||
await this.launcherPrisma.launcherCommonSetting.delete({ where: { id } });
|
|
||||||
return { deleted: true };
|
|
||||||
}
|
|
||||||
|
|
||||||
async getSource() {
|
async getSource() {
|
||||||
const source = await this.getSourceSettings();
|
const source = await this.getSourceSettings();
|
||||||
return { source };
|
return { source };
|
||||||
@@ -136,35 +89,35 @@ export class LauncherService {
|
|||||||
const dockerfile = body.dockerfile?.trim() || 'Dockerfile';
|
const dockerfile = body.dockerfile?.trim() || 'Dockerfile';
|
||||||
|
|
||||||
const writes = isBackend ? [
|
const writes = isBackend ? [
|
||||||
this.upsertCommonSettingByKey(
|
this.upsertLauncherSettingByKey(
|
||||||
LAUNCHER_SOURCE_SETTING_KEYS.backendRepository,
|
LAUNCHER_SOURCE_SETTING_KEYS.backendRepository,
|
||||||
'런처 백엔드 소스 저장소',
|
'런처 백엔드 소스 저장소',
|
||||||
'source',
|
'source',
|
||||||
repository,
|
repository,
|
||||||
'런처 백엔드 컨테이너 빌드에 사용할 저장소',
|
'런처 백엔드 컨테이너 빌드에 사용할 저장소',
|
||||||
),
|
),
|
||||||
this.upsertCommonSettingByKey(
|
this.upsertLauncherSettingByKey(
|
||||||
LAUNCHER_SOURCE_SETTING_KEYS.backendBranch,
|
LAUNCHER_SOURCE_SETTING_KEYS.backendBranch,
|
||||||
'런처 백엔드 소스 브랜치',
|
'런처 백엔드 소스 브랜치',
|
||||||
'source',
|
'source',
|
||||||
branch,
|
branch,
|
||||||
'런처 백엔드 컨테이너 빌드 기준 브랜치',
|
'런처 백엔드 컨테이너 빌드 기준 브랜치',
|
||||||
),
|
),
|
||||||
this.upsertCommonSettingByKey(
|
this.upsertLauncherSettingByKey(
|
||||||
LAUNCHER_SOURCE_SETTING_KEYS.backendCommitSha,
|
LAUNCHER_SOURCE_SETTING_KEYS.backendCommitSha,
|
||||||
'런처 백엔드 소스 커밋',
|
'런처 백엔드 소스 커밋',
|
||||||
'source',
|
'source',
|
||||||
commitSha,
|
commitSha,
|
||||||
'비워두면 브랜치 최신 커밋 기준',
|
'비워두면 브랜치 최신 커밋 기준',
|
||||||
),
|
),
|
||||||
this.upsertCommonSettingByKey(
|
this.upsertLauncherSettingByKey(
|
||||||
LAUNCHER_SOURCE_SETTING_KEYS.backendImage,
|
LAUNCHER_SOURCE_SETTING_KEYS.backendImage,
|
||||||
'런처 백엔드 이미지',
|
'런처 백엔드 이미지',
|
||||||
'source',
|
'source',
|
||||||
image,
|
image,
|
||||||
'런처 백엔드 컨테이너 이미지 이름',
|
'런처 백엔드 컨테이너 이미지 이름',
|
||||||
),
|
),
|
||||||
this.upsertCommonSettingByKey(
|
this.upsertLauncherSettingByKey(
|
||||||
LAUNCHER_SOURCE_SETTING_KEYS.backendDockerfile,
|
LAUNCHER_SOURCE_SETTING_KEYS.backendDockerfile,
|
||||||
'런처 백엔드 Dockerfile',
|
'런처 백엔드 Dockerfile',
|
||||||
'source',
|
'source',
|
||||||
@@ -172,21 +125,21 @@ export class LauncherService {
|
|||||||
'런처 백엔드 빌드에 사용할 Dockerfile 경로',
|
'런처 백엔드 빌드에 사용할 Dockerfile 경로',
|
||||||
),
|
),
|
||||||
] : [
|
] : [
|
||||||
this.upsertCommonSettingByKey(
|
this.upsertLauncherSettingByKey(
|
||||||
LAUNCHER_SOURCE_SETTING_KEYS.repository,
|
LAUNCHER_SOURCE_SETTING_KEYS.repository,
|
||||||
'런처 소스 저장소',
|
'런처 소스 저장소',
|
||||||
'source',
|
'source',
|
||||||
repository,
|
repository,
|
||||||
'런처 클라이언트 빌드에 사용할 저장소',
|
'런처 클라이언트 빌드에 사용할 저장소',
|
||||||
),
|
),
|
||||||
this.upsertCommonSettingByKey(
|
this.upsertLauncherSettingByKey(
|
||||||
LAUNCHER_SOURCE_SETTING_KEYS.branch,
|
LAUNCHER_SOURCE_SETTING_KEYS.branch,
|
||||||
'런처 소스 브랜치',
|
'런처 소스 브랜치',
|
||||||
'source',
|
'source',
|
||||||
branch,
|
branch,
|
||||||
'런처 클라이언트 빌드 기준 브랜치',
|
'런처 클라이언트 빌드 기준 브랜치',
|
||||||
),
|
),
|
||||||
this.upsertCommonSettingByKey(
|
this.upsertLauncherSettingByKey(
|
||||||
LAUNCHER_SOURCE_SETTING_KEYS.commitSha,
|
LAUNCHER_SOURCE_SETTING_KEYS.commitSha,
|
||||||
'런처 소스 커밋',
|
'런처 소스 커밋',
|
||||||
'source',
|
'source',
|
||||||
@@ -209,7 +162,7 @@ export class LauncherService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async getSourceSettings() {
|
private async getSourceSettings() {
|
||||||
const rows = await this.launcherPrisma.launcherCommonSetting.findMany({
|
const rows = await this.launcherPrisma.launcherSetting.findMany({
|
||||||
where: {
|
where: {
|
||||||
key: {
|
key: {
|
||||||
in: [
|
in: [
|
||||||
@@ -256,7 +209,7 @@ export class LauncherService {
|
|||||||
|
|
||||||
|
|
||||||
private async getLauncherClientBuildEnv() {
|
private async getLauncherClientBuildEnv() {
|
||||||
const rows = await this.launcherPrisma.launcherCommonSetting.findMany({
|
const rows = await this.launcherPrisma.launcherSetting.findMany({
|
||||||
where: {
|
where: {
|
||||||
key: {
|
key: {
|
||||||
startsWith: LAUNCHER_BUILD_ENV_PREFIX,
|
startsWith: LAUNCHER_BUILD_ENV_PREFIX,
|
||||||
@@ -283,7 +236,7 @@ export class LauncherService {
|
|||||||
.filter((row) => row.key);
|
.filter((row) => row.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private upsertCommonSettingByKey(
|
private upsertLauncherSettingByKey(
|
||||||
key: string,
|
key: string,
|
||||||
name: string,
|
name: string,
|
||||||
type: string,
|
type: string,
|
||||||
@@ -291,7 +244,7 @@ export class LauncherService {
|
|||||||
description: string,
|
description: string,
|
||||||
isSecret = false,
|
isSecret = false,
|
||||||
) {
|
) {
|
||||||
return this.launcherPrisma.launcherCommonSetting.upsert({
|
return this.launcherPrisma.launcherSetting.upsert({
|
||||||
where: { key },
|
where: { key },
|
||||||
create: {
|
create: {
|
||||||
key,
|
key,
|
||||||
@@ -322,7 +275,7 @@ export class LauncherService {
|
|||||||
async updateBuildEnv(body: UpdateLauncherBuildEnvDto) {
|
async updateBuildEnv(body: UpdateLauncherBuildEnvDto) {
|
||||||
const variables = normalizeBuildEnvVariables(body.variables ?? []);
|
const variables = normalizeBuildEnvVariables(body.variables ?? []);
|
||||||
const nextKeys = new Set(variables.map((variable) => variable.key));
|
const nextKeys = new Set(variables.map((variable) => variable.key));
|
||||||
const existing = await this.launcherPrisma.launcherCommonSetting.findMany({
|
const existing = await this.launcherPrisma.launcherSetting.findMany({
|
||||||
where: {
|
where: {
|
||||||
key: {
|
key: {
|
||||||
startsWith: LAUNCHER_BUILD_ENV_PREFIX,
|
startsWith: LAUNCHER_BUILD_ENV_PREFIX,
|
||||||
@@ -333,8 +286,8 @@ export class LauncherService {
|
|||||||
await this.launcherPrisma.$transaction([
|
await this.launcherPrisma.$transaction([
|
||||||
...existing
|
...existing
|
||||||
.filter((setting) => !nextKeys.has(setting.key.slice(LAUNCHER_BUILD_ENV_PREFIX.length)))
|
.filter((setting) => !nextKeys.has(setting.key.slice(LAUNCHER_BUILD_ENV_PREFIX.length)))
|
||||||
.map((setting) => this.launcherPrisma.launcherCommonSetting.delete({ where: { id: setting.id } })),
|
.map((setting) => this.launcherPrisma.launcherSetting.delete({ where: { id: setting.id } })),
|
||||||
...variables.map((variable) => this.upsertCommonSettingByKey(
|
...variables.map((variable) => this.upsertLauncherSettingByKey(
|
||||||
`${LAUNCHER_BUILD_ENV_PREFIX}${variable.key}`,
|
`${LAUNCHER_BUILD_ENV_PREFIX}${variable.key}`,
|
||||||
variable.key,
|
variable.key,
|
||||||
'launcher-build-env',
|
'launcher-build-env',
|
||||||
|
|||||||
Reference in New Issue
Block a user