Merge branch 'canary' into feature/custom-entrypoint

This commit is contained in:
Mauricio Siu
2025-12-07 20:46:32 -06:00
160 changed files with 84257 additions and 2353 deletions
@@ -111,6 +111,7 @@ export const applications = pgTable("application", {
enabled: boolean("enabled"),
subtitle: text("subtitle"),
command: text("command"),
args: text("args").array(),
refreshToken: text("refreshToken").$defaultFn(() => nanoid()),
sourceType: sourceType("sourceType").notNull().default("github"),
cleanCache: boolean("cleanCache").default(false),
@@ -186,6 +187,12 @@ export const applications = pgTable("application", {
registryId: text("registryId").references(() => registry.registryId, {
onDelete: "set null",
}),
rollbackRegistryId: text("rollbackRegistryId").references(
() => registry.registryId,
{
onDelete: "set null",
},
),
environmentId: text("environmentId")
.notNull()
.references(() => environments.environmentId, { onDelete: "cascade" }),
@@ -204,6 +211,15 @@ export const applications = pgTable("application", {
serverId: text("serverId").references(() => server.serverId, {
onDelete: "cascade",
}),
buildServerId: text("buildServerId").references(() => server.serverId, {
onDelete: "set null",
}),
buildRegistryId: text("buildRegistryId").references(
() => registry.registryId,
{
onDelete: "set null",
},
),
});
export const applicationsRelations = relations(
@@ -226,6 +242,7 @@ export const applicationsRelations = relations(
registry: one(registry, {
fields: [applications.registryId],
references: [registry.registryId],
relationName: "applicationRegistry",
}),
github: one(github, {
fields: [applications.githubId],
@@ -246,8 +263,24 @@ export const applicationsRelations = relations(
server: one(server, {
fields: [applications.serverId],
references: [server.serverId],
relationName: "applicationServer",
}),
buildServer: one(server, {
fields: [applications.buildServerId],
references: [server.serverId],
relationName: "applicationBuildServer",
}),
buildRegistry: one(registry, {
fields: [applications.buildRegistryId],
references: [registry.registryId],
relationName: "applicationBuildRegistry",
}),
previewDeployments: many(previewDeployments),
rollbackRegistry: one(registry, {
fields: [applications.rollbackRegistryId],
references: [registry.registryId],
relationName: "applicationRollbackRegistry",
}),
}),
);
@@ -272,6 +305,7 @@ const createSchema = createInsertSchema(applications, {
username: z.string().optional(),
isPreviewDeploymentsActive: z.boolean().optional(),
password: z.string().optional(),
args: z.array(z.string()).optional(),
registryUrl: z.string().optional(),
customGitSSHKeyId: z.string().optional(),
repository: z.string().optional(),
@@ -70,6 +70,9 @@ export const deployments = pgTable("deployment", {
(): AnyPgColumn => volumeBackups.volumeBackupId,
{ onDelete: "cascade" },
),
buildServerId: text("buildServerId").references(() => server.serverId, {
onDelete: "cascade",
}),
});
export const deploymentsRelations = relations(deployments, ({ one }) => ({
@@ -84,6 +87,12 @@ export const deploymentsRelations = relations(deployments, ({ one }) => ({
server: one(server, {
fields: [deployments.serverId],
references: [server.serverId],
relationName: "deploymentServer",
}),
buildServer: one(server, {
fields: [deployments.buildServerId],
references: [server.serverId],
relationName: "deploymentBuildServer",
}),
previewDeployment: one(previewDeployments, {
fields: [deployments.previewDeploymentId],
@@ -115,6 +124,7 @@ const schema = createInsertSchema(deployments, {
composeId: z.string(),
description: z.string().optional(),
previewDeploymentId: z.string(),
buildServerId: z.string(),
});
export const apiCreateDeployment = schema
+2
View File
@@ -45,6 +45,7 @@ export const mariadb = pgTable("mariadb", {
databaseRootPassword: text("rootPassword").notNull(),
dockerImage: text("dockerImage").notNull(),
command: text("command"),
args: text("args").array(),
env: text("env"),
// RESOURCES
memoryReservation: text("memoryReservation"),
@@ -114,6 +115,7 @@ const createSchema = createInsertSchema(mariadb, {
.optional(),
dockerImage: z.string().default("mariadb:6"),
command: z.string().optional(),
args: z.array(z.string()).optional(),
env: z.string().optional(),
memoryReservation: z.string().optional(),
memoryLimit: z.string().optional(),
+2
View File
@@ -50,6 +50,7 @@ export const mongo = pgTable("mongo", {
databasePassword: text("databasePassword").notNull(),
dockerImage: text("dockerImage").notNull(),
command: text("command"),
args: text("args").array(),
env: text("env"),
memoryReservation: text("memoryReservation"),
memoryLimit: text("memoryLimit"),
@@ -110,6 +111,7 @@ const createSchema = createInsertSchema(mongo, {
databaseUser: z.string().min(1),
dockerImage: z.string().default("mongo:15"),
command: z.string().optional(),
args: z.array(z.string()).optional(),
env: z.string().optional(),
memoryReservation: z.string().optional(),
memoryLimit: z.string().optional(),
+2
View File
@@ -45,6 +45,7 @@ export const mysql = pgTable("mysql", {
databaseRootPassword: text("rootPassword").notNull(),
dockerImage: text("dockerImage").notNull(),
command: text("command"),
args: text("args").array(),
env: text("env"),
memoryReservation: text("memoryReservation"),
memoryLimit: text("memoryLimit"),
@@ -112,6 +113,7 @@ const createSchema = createInsertSchema(mysql, {
.optional(),
dockerImage: z.string().default("mysql:8"),
command: z.string().optional(),
args: z.array(z.string()).optional(),
env: z.string().optional(),
memoryReservation: z.string().optional(),
memoryLimit: z.string().optional(),
+63 -4
View File
@@ -1,5 +1,12 @@
import { relations } from "drizzle-orm";
import { boolean, integer, pgEnum, pgTable, text } from "drizzle-orm/pg-core";
import {
boolean,
integer,
jsonb,
pgEnum,
pgTable,
text,
} from "drizzle-orm/pg-core";
import { createInsertSchema } from "drizzle-zod";
import { nanoid } from "nanoid";
import { z } from "zod";
@@ -12,6 +19,7 @@ export const notificationType = pgEnum("notificationType", [
"email",
"gotify",
"ntfy",
"custom",
"lark",
]);
@@ -24,6 +32,7 @@ export const notifications = pgTable("notification", {
appDeploy: boolean("appDeploy").notNull().default(false),
appBuildError: boolean("appBuildError").notNull().default(false),
databaseBackup: boolean("databaseBackup").notNull().default(false),
volumeBackup: boolean("volumeBackup").notNull().default(false),
dokployRestart: boolean("dokployRestart").notNull().default(false),
dockerCleanup: boolean("dockerCleanup").notNull().default(false),
serverThreshold: boolean("serverThreshold").notNull().default(false),
@@ -49,6 +58,9 @@ export const notifications = pgTable("notification", {
ntfyId: text("ntfyId").references(() => ntfy.ntfyId, {
onDelete: "cascade",
}),
customId: text("customId").references(() => custom.customId, {
onDelete: "cascade",
}),
larkId: text("larkId").references(() => lark.larkId, {
onDelete: "cascade",
}),
@@ -116,10 +128,19 @@ export const ntfy = pgTable("ntfy", {
.$defaultFn(() => nanoid()),
serverUrl: text("serverUrl").notNull(),
topic: text("topic").notNull(),
accessToken: text("accessToken").notNull(),
accessToken: text("accessToken"),
priority: integer("priority").notNull().default(3),
});
export const custom = pgTable("custom", {
customId: text("customId")
.notNull()
.primaryKey()
.$defaultFn(() => nanoid()),
endpoint: text("endpoint").notNull(),
headers: jsonb("headers").$type<Record<string, string>>(),
});
export const lark = pgTable("lark", {
larkId: text("larkId")
.notNull()
@@ -153,6 +174,10 @@ export const notificationsRelations = relations(notifications, ({ one }) => ({
fields: [notifications.ntfyId],
references: [ntfy.ntfyId],
}),
custom: one(custom, {
fields: [notifications.customId],
references: [custom.customId],
}),
lark: one(lark, {
fields: [notifications.larkId],
references: [lark.larkId],
@@ -169,6 +194,7 @@ export const apiCreateSlack = notificationsSchema
.pick({
appBuildError: true,
databaseBackup: true,
volumeBackup: true,
dokployRestart: true,
name: true,
appDeploy: true,
@@ -196,6 +222,7 @@ export const apiCreateTelegram = notificationsSchema
.pick({
appBuildError: true,
databaseBackup: true,
volumeBackup: true,
dokployRestart: true,
name: true,
appDeploy: true,
@@ -225,6 +252,7 @@ export const apiCreateDiscord = notificationsSchema
.pick({
appBuildError: true,
databaseBackup: true,
volumeBackup: true,
dokployRestart: true,
name: true,
appDeploy: true,
@@ -255,6 +283,7 @@ export const apiCreateEmail = notificationsSchema
.pick({
appBuildError: true,
databaseBackup: true,
volumeBackup: true,
dokployRestart: true,
name: true,
appDeploy: true,
@@ -290,6 +319,7 @@ export const apiCreateGotify = notificationsSchema
.pick({
appBuildError: true,
databaseBackup: true,
volumeBackup: true,
dokployRestart: true,
name: true,
appDeploy: true,
@@ -323,6 +353,7 @@ export const apiCreateNtfy = notificationsSchema
.pick({
appBuildError: true,
databaseBackup: true,
volumeBackup: true,
dokployRestart: true,
name: true,
appDeploy: true,
@@ -331,7 +362,7 @@ export const apiCreateNtfy = notificationsSchema
.extend({
serverUrl: z.string().min(1),
topic: z.string().min(1),
accessToken: z.string().min(1),
accessToken: z.string().optional(),
priority: z.number().min(1),
})
.required();
@@ -355,6 +386,32 @@ export const apiFindOneNotification = notificationsSchema
})
.required();
export const apiCreateCustom = notificationsSchema
.pick({
appBuildError: true,
databaseBackup: true,
dokployRestart: true,
name: true,
appDeploy: true,
dockerCleanup: true,
serverThreshold: true,
})
.extend({
endpoint: z.string().min(1),
headers: z.record(z.string()).optional(),
});
export const apiUpdateCustom = apiCreateCustom.partial().extend({
notificationId: z.string().min(1),
customId: z.string().min(1),
organizationId: z.string().optional(),
});
export const apiTestCustomConnection = z.object({
endpoint: z.string().min(1),
headers: z.record(z.string()).optional(),
});
export const apiCreateLark = notificationsSchema
.pick({
appBuildError: true,
@@ -395,7 +452,9 @@ export const apiSendTest = notificationsSchema
serverUrl: z.string(),
topic: z.string(),
appToken: z.string(),
accessToken: z.string(),
accessToken: z.string().optional(),
priority: z.number(),
endpoint: z.string(),
headers: z.string(),
})
.partial();
@@ -44,6 +44,7 @@ export const postgres = pgTable("postgres", {
description: text("description"),
dockerImage: text("dockerImage").notNull(),
command: text("command"),
args: text("args").array(),
env: text("env"),
memoryReservation: text("memoryReservation"),
externalPort: integer("externalPort"),
@@ -103,6 +104,7 @@ const createSchema = createInsertSchema(postgres, {
databaseUser: z.string().min(1),
dockerImage: z.string().default("postgres:15"),
command: z.string().optional(),
args: z.array(z.string()).optional(),
env: z.string().optional(),
memoryReservation: z.string().optional(),
memoryLimit: z.string().optional(),
+2
View File
@@ -41,6 +41,7 @@ export const redis = pgTable("redis", {
databasePassword: text("password").notNull(),
dockerImage: text("dockerImage").notNull(),
command: text("command"),
args: text("args").array(),
env: text("env"),
memoryReservation: text("memoryReservation"),
memoryLimit: text("memoryLimit"),
@@ -93,6 +94,7 @@ const createSchema = createInsertSchema(redis, {
databasePassword: z.string(),
dockerImage: z.string().default("redis:8"),
command: z.string().optional(),
args: z.array(z.string()).optional(),
env: z.string().optional(),
memoryReservation: z.string().optional(),
memoryLimit: z.string().optional(),
+9 -1
View File
@@ -33,7 +33,15 @@ export const registry = pgTable("registry", {
});
export const registryRelations = relations(registry, ({ many }) => ({
applications: many(applications),
applications: many(applications, {
relationName: "applicationRegistry",
}),
buildApplications: many(applications, {
relationName: "applicationBuildRegistry",
}),
rollbackApplications: many(applications, {
relationName: "applicationRollbackRegistry",
}),
}));
const createSchema = createInsertSchema(registry, {
+358 -82
View File
@@ -5,17 +5,24 @@ enum applicationStatus {
error
}
enum backupType {
database
compose
}
enum buildType {
dockerfile
heroku_buildpacks
paketo_buildpacks
nixpacks
static
railpack
}
enum certificateType {
letsencrypt
none
custom
}
enum composeType {
@@ -28,6 +35,7 @@ enum databaseType {
mariadb
mysql
mongo
"web-server"
}
enum deploymentStatus {
@@ -61,6 +69,8 @@ enum notificationType {
discord
email
gotify
ntfy
custom
}
enum protocolType {
@@ -68,14 +78,21 @@ enum protocolType {
udp
}
enum publishModeType {
ingress
host
}
enum RegistryType {
selfHosted
cloud
}
enum Roles {
admin
user
enum scheduleType {
application
compose
server
"dokploy-server"
}
enum serverStatus {
@@ -93,6 +110,11 @@ enum serviceType {
compose
}
enum shellType {
bash
sh
}
enum sourceType {
docker
git
@@ -112,6 +134,11 @@ enum sourceTypeCompose {
raw
}
enum triggerType {
push
tag
}
table account {
id text [pk, not null]
account_id text [not null]
@@ -133,7 +160,39 @@ table account {
confirmationExpiresAt text
}
table admin {
table ai {
aiId text [pk, not null]
name text [not null]
apiUrl text [not null]
apiKey text [not null]
model text [not null]
isEnabled boolean [not null, default: true]
organizationId text [not null]
createdAt text [not null]
}
table apikey {
id text [pk, not null]
name text
start text
prefix text
key text [not null]
user_id text [not null]
refill_interval integer
refill_amount integer
last_refill_at timestamp
enabled boolean
rate_limit_enabled boolean
rate_limit_time_window integer
rate_limit_max integer
request_count integer
remaining integer
last_request timestamp
expires_at timestamp
created_at timestamp [not null]
updated_at timestamp [not null]
permissions text
metadata text
}
table application {
@@ -143,14 +202,19 @@ table application {
description text
env text
previewEnv text
watchPaths text[]
previewBuildArgs text
previewLabels text[]
previewWildcard text
previewPort integer [default: 3000]
previewHttps boolean [not null, default: false]
previewPath text [default: '/']
certificateType certificateType [not null, default: 'none']
previewCustomCertResolver text
previewLimit integer [default: 3]
isPreviewDeploymentsActive boolean [default: false]
previewRequireCollaboratorPermissions boolean [default: true]
rollbackActive boolean [default: false]
buildArgs text
memoryReservation text
memoryLimit text
@@ -167,6 +231,7 @@ table application {
owner text
branch text
buildPath text [default: '/']
triggerType triggerType [default: 'push']
autoDeploy boolean
gitlabProjectId integer
gitlabRepository text
@@ -174,6 +239,10 @@ table application {
gitlabBranch text
gitlabBuildPath text [default: '/']
gitlabPathNamespace text
giteaRepository text
giteaOwner text
giteaBranch text
giteaBuildPath text [default: '/']
bitbucketRepository text
bitbucketOwner text
bitbucketBranch text
@@ -186,6 +255,7 @@ table application {
customGitBranch text
customGitBuildPath text
customGitSSHKeyId text
enableSubmodules boolean [not null, default: false]
dockerfile text
dockerContextPath text
dockerBuildStage text
@@ -201,52 +271,47 @@ table application {
replicas integer [not null, default: 1]
applicationStatus applicationStatus [not null, default: 'idle']
buildType buildType [not null, default: 'nixpacks']
railpackVersion text [default: '0.2.2']
herokuVersion text [default: '24']
publishDirectory text
isStaticSpa boolean
createdAt text [not null]
registryId text
projectId text [not null]
environmentId text [not null]
githubId text
gitlabId text
bitbucketId text
giteaId text
bitbucketId text
serverId text
}
table auth {
id text [pk, not null]
email text [not null, unique]
password text [not null]
rol Roles [not null]
image text
secret text
token text
is2FAEnabled boolean [not null, default: false]
createdAt text [not null]
resetPasswordToken text
resetPasswordExpiresAt text
confirmationToken text
confirmationExpiresAt text
}
table backup {
backupId text [pk, not null]
appName text [not null, unique]
schedule text [not null]
enabled boolean
database text [not null]
prefix text [not null]
serviceName text
destinationId text [not null]
keepLatestCount integer
backupType backupType [not null, default: 'database']
databaseType databaseType [not null]
composeId text
postgresId text
mariadbId text
mysqlId text
mongoId text
userId text
metadata jsonb
}
table bitbucket {
bitbucketId text [pk, not null]
bitbucketUsername text
bitbucketEmail text
appPassword text
apiToken text
bitbucketWorkspaceName text
gitProviderId text [not null]
}
@@ -258,7 +323,7 @@ table certificate {
privateKey text [not null]
certificatePath text [not null, unique]
autoRenew boolean
userId text
organizationId text [not null]
serverId text
}
@@ -291,13 +356,17 @@ table compose {
customGitBranch text
customGitSSHKeyId text
command text [not null, default: '']
enableSubmodules boolean [not null, default: false]
composePath text [not null, default: './docker-compose.yml']
suffix text [not null, default: '']
randomize boolean [not null, default: false]
isolatedDeployment boolean [not null, default: false]
isolatedDeploymentsVolume boolean [not null, default: false]
triggerType triggerType [default: 'push']
composeStatus applicationStatus [not null, default: 'idle']
projectId text [not null]
environmentId text [not null]
createdAt text [not null]
watchPaths text[]
githubId text
gitlabId text
bitbucketId text
@@ -305,19 +374,32 @@ table compose {
serverId text
}
table custom {
customId text [pk, not null]
endpoint text [not null]
headers text
}
table deployment {
deploymentId text [pk, not null]
title text [not null]
description text
status deploymentStatus [default: 'running']
logPath text [not null]
pid text
applicationId text
composeId text
serverId text
isPreviewDeployment boolean [default: false]
previewDeploymentId text
createdAt text [not null]
startedAt text
finishedAt text
errorMessage text
scheduleId text
backupId text
rollbackId text
volumeBackupId text
}
table destination {
@@ -329,7 +411,8 @@ table destination {
bucket text [not null]
region text [not null]
endpoint text [not null]
userId text [not null]
organizationId text [not null]
createdAt timestamp [not null, default: `now()`]
}
table discord {
@@ -349,9 +432,12 @@ table domain {
uniqueConfigKey serial [not null, increment]
createdAt text [not null]
composeId text
customCertResolver text
applicationId text
previewDeploymentId text
certificateType certificateType [not null, default: 'none']
internalPath text [default: '/']
stripPath boolean [not null, default: false]
}
table email {
@@ -364,12 +450,36 @@ table email {
toAddress text[] [not null]
}
table environment {
environmentId text [pk, not null]
name text [not null]
description text
createdAt text [not null]
env text [not null, default: '']
projectId text [not null]
}
table git_provider {
gitProviderId text [pk, not null]
name text [not null]
providerType gitProviderType [not null, default: 'github']
createdAt text [not null]
userId text
organizationId text [not null]
userId text [not null]
}
table gitea {
giteaId text [pk, not null]
giteaUrl text [not null, default: 'https://gitea.com']
redirect_uri text
client_id text
client_secret text
gitProviderId text [not null]
access_token text
refresh_token text
expires_at integer
scopes text [default: 'repo,repo:status,read:user,read:org']
last_authenticated_at integer
}
table github {
@@ -397,20 +507,6 @@ table gitlab {
gitProviderId text [not null]
}
table gitea {
giteaId text [pk, not null]
giteaUrl text [not null, default: 'https://gitea.com']
redirect_uri text
client_id text [not null]
client_secret text [not null]
access_token text
refresh_token text
expires_at integer
gitProviderId text [not null]
scopes text [default: 'repo,repo:status,read:user,read:org']
last_authenticated_at integer
}
table gotify {
gotifyId text [pk, not null]
serverUrl text [not null]
@@ -427,6 +523,7 @@ table invitation {
status text [not null]
expires_at timestamp [not null]
inviter_id text [not null]
team_id text
}
table mariadb {
@@ -447,8 +544,17 @@ table mariadb {
cpuLimit text
externalPort integer
applicationStatus applicationStatus [not null, default: 'idle']
healthCheckSwarm json
restartPolicySwarm json
placementSwarm json
updateConfigSwarm json
rollbackConfigSwarm json
modeSwarm json
labelsSwarm json
networkSwarm json
replicas integer [not null, default: 1]
createdAt text [not null]
projectId text [not null]
environmentId text [not null]
serverId text
}
@@ -458,6 +564,19 @@ table member {
user_id text [not null]
role text [not null]
created_at timestamp [not null]
team_id text
canCreateProjects boolean [not null, default: false]
canAccessToSSHKeys boolean [not null, default: false]
canCreateServices boolean [not null, default: false]
canDeleteProjects boolean [not null, default: false]
canDeleteServices boolean [not null, default: false]
canAccessToDocker boolean [not null, default: false]
canAccessToAPI boolean [not null, default: false]
canAccessToGitProviders boolean [not null, default: false]
canAccessToTraefikFiles boolean [not null, default: false]
accesedProjects text[] [not null, default: `ARRAY[]::text[]`]
accessedEnvironments text[] [not null, default: `ARRAY[]::text[]`]
accesedServices text[] [not null, default: `ARRAY[]::text[]`]
}
table mongo {
@@ -476,8 +595,17 @@ table mongo {
cpuLimit text
externalPort integer
applicationStatus applicationStatus [not null, default: 'idle']
healthCheckSwarm json
restartPolicySwarm json
placementSwarm json
updateConfigSwarm json
rollbackConfigSwarm json
modeSwarm json
labelsSwarm json
networkSwarm json
replicas integer [not null, default: 1]
createdAt text [not null]
projectId text [not null]
environmentId text [not null]
serverId text
replicaSets boolean [default: false]
}
@@ -518,8 +646,17 @@ table mysql {
cpuLimit text
externalPort integer
applicationStatus applicationStatus [not null, default: 'idle']
healthCheckSwarm json
restartPolicySwarm json
placementSwarm json
updateConfigSwarm json
rollbackConfigSwarm json
modeSwarm json
labelsSwarm json
networkSwarm json
replicas integer [not null, default: 1]
createdAt text [not null]
projectId text [not null]
environmentId text [not null]
serverId text
}
@@ -539,7 +676,17 @@ table notification {
discordId text
emailId text
gotifyId text
userId text
ntfyId text
customId text
organizationId text [not null]
}
table ntfy {
ntfyId text [pk, not null]
serverUrl text [not null]
topic text [not null]
accessToken text [not null]
priority integer [not null, default: 3]
}
table organization {
@@ -555,6 +702,7 @@ table organization {
table port {
portId text [pk, not null]
publishedPort integer [not null]
publishMode publishModeType [not null, default: 'host']
targetPort integer [not null]
protocol protocolType [not null]
applicationId text [not null]
@@ -577,8 +725,17 @@ table postgres {
cpuReservation text
cpuLimit text
applicationStatus applicationStatus [not null, default: 'idle']
healthCheckSwarm json
restartPolicySwarm json
placementSwarm json
updateConfigSwarm json
rollbackConfigSwarm json
modeSwarm json
labelsSwarm json
networkSwarm json
replicas integer [not null, default: 1]
createdAt text [not null]
projectId text [not null]
environmentId text [not null]
serverId text
}
@@ -603,7 +760,7 @@ table project {
name text [not null]
description text
createdAt text [not null]
userId text [not null]
organizationId text [not null]
env text [not null, default: '']
}
@@ -633,7 +790,16 @@ table redis {
externalPort integer
createdAt text [not null]
applicationStatus applicationStatus [not null, default: 'idle']
projectId text [not null]
healthCheckSwarm json
restartPolicySwarm json
placementSwarm json
updateConfigSwarm json
rollbackConfigSwarm json
modeSwarm json
labelsSwarm json
networkSwarm json
replicas integer [not null, default: 1]
environmentId text [not null]
serverId text
}
@@ -646,7 +812,34 @@ table registry {
registryUrl text [not null, default: '']
createdAt text [not null]
selfHosted RegistryType [not null, default: 'cloud']
userId text [not null]
organizationId text [not null]
}
table rollback {
rollbackId text [pk, not null]
deploymentId text [not null]
version serial [not null, increment]
image text
createdAt text [not null]
fullContext jsonb
}
table schedule {
scheduleId text [pk, not null]
name text [not null]
cronExpression text [not null]
appName text [not null]
serviceName text
shellType shellType [not null, default: 'bash']
scheduleType scheduleType [not null, default: 'application']
command text [not null]
script text
applicationId text
composeId text
serverId text
userId text
enabled boolean [not null, default: true]
createdAt text [not null]
}
table security {
@@ -671,14 +864,14 @@ table server {
appName text [not null]
enableDockerCleanup boolean [not null, default: false]
createdAt text [not null]
userId text [not null]
organizationId text [not null]
serverStatus serverStatus [not null, default: 'active']
command text [not null, default: '']
sshKeyId text
metricsConfig jsonb [not null, default: `{"server":{"type":"Remote","refreshRate":60,"port":4500,"token":"","urlCallback":"","cronJob":"","retentionDays":2,"thresholds":{"cpu":0,"memory":0}},"containers":{"refreshRate":60,"services":{"include":[],"exclude":[]}}}`]
}
table session {
table session_temp {
id text [pk, not null]
expires_at timestamp [not null]
token text [not null, unique]
@@ -705,49 +898,49 @@ table "ssh-key" {
description text
createdAt text [not null]
lastUsedAt text
userId text
organizationId text [not null]
}
table telegram {
telegramId text [pk, not null]
botToken text [not null]
chatId text [not null]
messageThreadId text
}
table user {
table two_factor {
id text [pk, not null]
secret text [not null]
backup_codes text [not null]
user_id text [not null]
}
table user_temp {
id text [pk, not null]
name text [not null, default: '']
token text [not null]
isRegistered boolean [not null, default: false]
expirationDate text [not null]
createdAt text [not null]
canCreateProjects boolean [not null, default: false]
canAccessToSSHKeys boolean [not null, default: false]
canCreateServices boolean [not null, default: false]
canDeleteProjects boolean [not null, default: false]
canDeleteServices boolean [not null, default: false]
canAccessToDocker boolean [not null, default: false]
canAccessToAPI boolean [not null, default: false]
canAccessToGitProviders boolean [not null, default: false]
canAccessToTraefikFiles boolean [not null, default: false]
accesedProjects text[] [not null, default: `ARRAY[]::text[]`]
accesedServices text[] [not null, default: `ARRAY[]::text[]`]
created_at timestamp [default: `now()`]
two_factor_enabled boolean
email text [not null, unique]
email_verified boolean [not null]
image text
role text
banned boolean
ban_reason text
ban_expires timestamp
updated_at timestamp [not null]
serverIp text
certificateType certificateType [not null, default: 'none']
https boolean [not null, default: false]
host text
letsEncryptEmail text
sshPrivateKey text
enableDockerCleanup boolean [not null, default: false]
enableLogRotation boolean [not null, default: false]
logCleanupCron text [default: '0 0 * * *']
role text [not null, default: 'user']
enablePaidFeatures boolean [not null, default: false]
allowImpersonation boolean [not null, default: false]
metricsConfig jsonb [not null, default: `{"server":{"type":"Dokploy","refreshRate":60,"port":4500,"token":"","retentionDays":2,"cronJob":"","urlCallback":"","thresholds":{"cpu":0,"memory":0}},"containers":{"refreshRate":60,"services":{"include":[],"exclude":[]}}}`]
cleanupCacheApplications boolean [not null, default: false]
cleanupCacheOnPreviews boolean [not null, default: false]
@@ -766,6 +959,29 @@ table verification {
updated_at timestamp
}
table volume_backup {
volumeBackupId text [pk, not null]
name text [not null]
volumeName text [not null]
prefix text [not null]
serviceType serviceType [not null, default: 'application']
appName text [not null]
serviceName text
turnOff boolean [not null, default: false]
cronExpression text [not null]
keepLatestCount integer
enabled boolean
applicationId text
postgresId text
mariadbId text
mongoId text
mysqlId text
redisId text
composeId text
createdAt text [not null]
destinationId text [not null]
}
ref: mount.applicationId > application.applicationId
ref: mount.postgresId > postgres.postgresId
@@ -780,7 +996,13 @@ ref: mount.redisId > redis.redisId
ref: mount.composeId > compose.composeId
ref: application.projectId > project.projectId
ref: user_temp.id - account.user_id
ref: ai.organizationId - organization.id
ref: apikey.user_id > user_temp.id
ref: application.environmentId > environment.environmentId
ref: application.customGitSSHKeyId > "ssh-key".sshKeyId
@@ -790,6 +1012,8 @@ ref: application.githubId - github.githubId
ref: application.gitlabId - gitlab.gitlabId
ref: application.giteaId - gitea.giteaId
ref: application.bitbucketId - bitbucket.bitbucketId
ref: application.serverId > server.serverId
@@ -804,13 +1028,17 @@ ref: backup.mysqlId > mysql.mysqlId
ref: backup.mongoId > mongo.mongoId
ref: backup.userId > user_temp.id
ref: backup.composeId > compose.composeId
ref: git_provider.gitProviderId - bitbucket.gitProviderId
ref: certificate.serverId > server.serverId
ref: certificate.userId - user.id
ref: certificate.organizationId - organization.id
ref: compose.projectId > project.projectId
ref: compose.environmentId > environment.environmentId
ref: compose.customGitSSHKeyId > "ssh-key".sshKeyId
@@ -820,6 +1048,8 @@ ref: compose.gitlabId - gitlab.gitlabId
ref: compose.bitbucketId - bitbucket.bitbucketId
ref: compose.giteaId - gitea.giteaId
ref: compose.serverId > server.serverId
ref: deployment.applicationId > application.applicationId
@@ -830,7 +1060,15 @@ ref: deployment.serverId > server.serverId
ref: deployment.previewDeploymentId > preview_deployments.previewDeploymentId
ref: destination.userId - user.id
ref: deployment.scheduleId > schedule.scheduleId
ref: deployment.backupId > backup.backupId
ref: rollback.deploymentId - deployment.deploymentId
ref: deployment.volumeBackupId > volume_backup.volumeBackupId
ref: destination.organizationId - organization.id
ref: domain.applicationId > application.applicationId
@@ -838,23 +1076,33 @@ ref: domain.composeId > compose.composeId
ref: preview_deployments.domainId - domain.domainId
ref: environment.projectId > project.projectId
ref: github.gitProviderId - git_provider.gitProviderId
ref: gitlab.gitProviderId - git_provider.gitProviderId
ref: gitea.gitProviderId - git_provider.gitProviderId
ref: git_provider.userId - user.id
ref: git_provider.organizationId - organization.id
ref: mariadb.projectId > project.projectId
ref: git_provider.userId - user_temp.id
ref: invitation.organization_id - organization.id
ref: mariadb.environmentId > environment.environmentId
ref: mariadb.serverId > server.serverId
ref: mongo.projectId > project.projectId
ref: member.organization_id > organization.id
ref: member.user_id - user_temp.id
ref: mongo.environmentId > environment.environmentId
ref: mongo.serverId > server.serverId
ref: mysql.projectId > project.projectId
ref: mysql.environmentId > environment.environmentId
ref: mysql.serverId > server.serverId
@@ -868,30 +1116,58 @@ ref: notification.emailId - email.emailId
ref: notification.gotifyId - gotify.gotifyId
ref: notification.userId - user.id
ref: notification.ntfyId - ntfy.ntfyId
ref: notification.customId - custom.customId
ref: notification.organizationId - organization.id
ref: organization.owner_id > user_temp.id
ref: port.applicationId > application.applicationId
ref: postgres.projectId > project.projectId
ref: postgres.environmentId > environment.environmentId
ref: postgres.serverId > server.serverId
ref: preview_deployments.applicationId > application.applicationId
ref: project.userId - user.id
ref: project.organizationId > organization.id
ref: redirect.applicationId > application.applicationId
ref: redis.projectId > project.projectId
ref: redis.environmentId > environment.environmentId
ref: redis.serverId > server.serverId
ref: registry.userId - user.id
ref: schedule.applicationId - application.applicationId
ref: schedule.composeId > compose.composeId
ref: schedule.serverId > server.serverId
ref: schedule.userId > user_temp.id
ref: security.applicationId > application.applicationId
ref: server.userId - user.id
ref: server.sshKeyId > "ssh-key".sshKeyId
ref: "ssh-key".userId - user.id
ref: server.organizationId > organization.id
ref: "ssh-key".organizationId - organization.id
ref: volume_backup.applicationId - application.applicationId
ref: volume_backup.postgresId - postgres.postgresId
ref: volume_backup.mariadbId - mariadb.mariadbId
ref: volume_backup.mongoId - mongo.mongoId
ref: volume_backup.mysqlId - mysql.mysqlId
ref: volume_backup.redisId - redis.redisId
ref: volume_backup.composeId - compose.composeId
ref: volume_backup.destinationId - destination.destinationId
+16 -2
View File
@@ -24,6 +24,7 @@ import { schedules } from "./schedule";
import { sshKeys } from "./ssh-key";
import { generateAppName } from "./utils";
export const serverStatus = pgEnum("serverStatus", ["active", "inactive"]);
export const serverType = pgEnum("serverType", ["deploy", "build"]);
export const server = pgTable("server", {
serverId: text("serverId")
@@ -44,6 +45,7 @@ export const server = pgTable("server", {
.notNull()
.references(() => organization.id, { onDelete: "cascade" }),
serverStatus: serverStatus("serverStatus").notNull().default("active"),
serverType: serverType("serverType").notNull().default("deploy"),
command: text("command").notNull().default(""),
sshKeyId: text("sshKeyId").references(() => sshKeys.sshKeyId, {
onDelete: "set null",
@@ -97,12 +99,22 @@ export const server = pgTable("server", {
});
export const serverRelations = relations(server, ({ one, many }) => ({
deployments: many(deployments),
deployments: many(deployments, {
relationName: "deploymentServer",
}),
buildDeployments: many(deployments, {
relationName: "deploymentBuildServer",
}),
sshKey: one(sshKeys, {
fields: [server.sshKeyId],
references: [sshKeys.sshKeyId],
}),
applications: many(applications),
applications: many(applications, {
relationName: "applicationServer",
}),
buildApplications: many(applications, {
relationName: "applicationBuildServer",
}),
compose: many(compose),
redis: many(redis),
mariadb: many(mariadb),
@@ -131,6 +143,7 @@ export const apiCreateServer = createSchema
port: true,
username: true,
sshKeyId: true,
serverType: true,
})
.required();
@@ -155,6 +168,7 @@ export const apiUpdateServer = createSchema
port: true,
username: true,
sshKeyId: true,
serverType: true,
})
.required()
.extend({
+4 -2
View File
@@ -31,7 +31,8 @@ export const user = pgTable("user", {
.notNull()
.primaryKey()
.$defaultFn(() => nanoid()),
name: text("name").notNull().default(""),
firstName: text("firstName").notNull().default(""),
lastName: text("lastName").notNull().default(""),
isRegistered: boolean("isRegistered").notNull().default(false),
expirationDate: text("expirationDate")
.notNull()
@@ -56,7 +57,7 @@ export const user = pgTable("user", {
host: text("host"),
letsEncryptEmail: text("letsEncryptEmail"),
sshPrivateKey: text("sshPrivateKey"),
enableDockerCleanup: boolean("enableDockerCleanup").notNull().default(false),
enableDockerCleanup: boolean("enableDockerCleanup").notNull().default(true),
logCleanupCron: text("logCleanupCron").default("0 0 * * *"),
role: text("role").notNull().default("user"),
// Metrics
@@ -332,6 +333,7 @@ export const apiUpdateUser = createSchema.partial().extend({
password: z.string().optional(),
currentPassword: z.string().optional(),
name: z.string().optional(),
lastName: z.string().optional(),
metricsConfig: z
.object({
server: z.object({