turboci-admin/src/types/index.ts
2026-03-04 14:21:07 +00:00

160 lines
3.4 KiB
TypeScript

export const CloudProviders = [
{
title: "Hetzner",
value: "hetzner",
},
{
title: "Amazon Web Services",
value: "aws",
},
{
title: "Google Cloud Platform",
value: "gcp",
},
{
title: "Microsoft Azure",
value: "azure",
},
] as const;
export type ParsedDeploymentServiceConfig = TCIConfigServiceConfig & {
service_name: string;
parent_service_name?: string;
servers?: NormalizedServerObject[];
};
export type NormalizedServerObject = {
public_ip?: string;
private_ip?: string;
};
export type TCIConfig = {
deployment_name: string;
duplicate_deployment_name?: string;
description?: string;
location?: string;
availability_zone?: string;
provider: (typeof CloudProviders)[number]["value"];
services: TCIConfigService;
env?: { [k: string]: string };
env_file?: string;
pre_deployment?: TCIRunObj;
};
export type TCIGlobalConfig = Omit<TCIConfig, "services"> & {
services: ParsedDeploymentServiceConfig[];
relay_server_ip?: string;
};
export type TCIConfigService = {
[k: string]: TCIConfigServiceConfig;
};
export const TCIServiceTypes = [
{
title: "Default Service",
value: "default",
},
{
title: "Docker",
value: "docker",
},
{
title: "Load Balancer",
value: "load_balancer",
},
] as const;
export const TCIServiceOS = [
{
title: "Debian 12 Bookworm",
value: "debian_12",
},
{
title: "Debian 13 Buster",
value: "debian_13",
},
{
title: "Ubuntu 23.0.4",
value: "ubuntu_23_0_4",
},
] as const;
export const TCIServiceDependecyTypes = [
{
title: "Debian APT",
value: "apt",
},
{
title: "Turbo CI",
value: "turboci",
},
] as const;
export type TCIConfigServiceConfig = {
type?: (typeof TCIServiceTypes)[number]["value"];
os?: string;
server_type?: string;
enable_public_ip?: boolean;
instances?: number;
clusters?: number;
dir_mappings?: TCIConfigServiceConfigDirMApping[];
dependencies?: {
[k in (typeof TCIServiceDependecyTypes)[number]["value"]]?: string[];
};
env?: { [k: string]: string };
env_file?: string;
target_services?: TCIConfigServiceConfigLBTarget[];
run?: TCIConfigServiceConfigRun;
ssl?: TCIConfigServiceSSL;
duplicate_service_name?: string;
healthcheck?: TCIConfigServiceHealthcheck;
/**
* Commoands to Run on first run
*/
init?: string[];
};
export type TCIConfigServiceHealthcheck = {
cmd: string;
test: string;
};
export type TCIConfigServiceDomain = {
domain_name: string;
};
export type TCIConfigServiceSSL = {
email: string;
};
export type TCIConfigServiceConfigLBTarget = {
service_name: string;
port: number;
weight?: number;
backup?: boolean;
domains?: (string | TCIConfigServiceDomain)[];
};
export type TCIConfigServiceConfigRun = {
preflight?: TCIRunObj;
start?: TCIRunObj;
postflight?: TCIRunObj;
work_dir?: string;
};
export type TCIRunObj = {
cmds?: string[];
work_dir?: string;
file?: string;
};
export type TCIConfigServiceConfigDirMApping = {
src: string;
dst: string;
ignore_file?: string;
ignore_patterns?: string[];
use_gitignore?: boolean;
relay_ignore?: string[];
};