Skip to content

Commit fb5ee5d

Browse files
authored
Merge pull request #2601 from OliverGeneser/feat/libsql
feat: add libSQL database
2 parents 6fb4a13 + 3d50cb0 commit fb5ee5d

84 files changed

Lines changed: 11617 additions & 376 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Dokploy is a free, self-hostable Platform as a Service (PaaS) that simplifies th
1919
Dokploy includes multiple features to make your life easier.
2020

2121
- **Applications**: Deploy any type of application (Node.js, PHP, Python, Go, Ruby, etc.).
22-
- **Databases**: Create and manage databases with support for MySQL, PostgreSQL, MongoDB, MariaDB, and Redis.
22+
- **Databases**: Create and manage databases with support for MySQL, PostgreSQL, MongoDB, MariaDB, libsql, and Redis.
2323
- **Backups**: Automate backups for databases to an external storage destination.
2424
- **Docker Compose**: Native support for Docker Compose to manage complex applications.
2525
- **Multi Node**: Scale applications to multiple nodes using Docker Swarm to manage the cluster.

apps/dokploy/__test__/permissions/enterprise-only-resources.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const ENTERPRISE_RESOURCES = [
3535
"domain",
3636
"destination",
3737
"notification",
38+
"tag",
3839
"logs",
3940
"monitoring",
4041
"auditLog",

apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ const menuItems: MenuItem[] = [
110110
},
111111
];
112112

113-
const hasStopGracePeriodSwarm = (
114-
value: unknown,
115-
): value is { stopGracePeriodSwarm: bigint | number | string | null } =>
116-
typeof value === "object" &&
117-
value !== null &&
118-
"stopGracePeriodSwarm" in value;
119-
120113
interface Props {
121114
id: string;
122-
type: "postgres" | "mariadb" | "mongo" | "mysql" | "redis" | "application";
115+
type:
116+
| "application"
117+
| "libsql"
118+
| "mariadb"
119+
| "mongo"
120+
| "mysql"
121+
| "postgres"
122+
| "redis";
123123
}
124124

125125
export const AddSwarmSettings = ({ id, type }: Props) => {

apps/dokploy/components/dashboard/application/advanced/cluster/show-cluster-settings.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { AddSwarmSettings } from "./modify-swarm-settings";
3737

3838
interface Props {
3939
id: string;
40-
type: "postgres" | "mariadb" | "mongo" | "mysql" | "redis" | "application";
40+
type: "application" | "mariadb" | "mongo" | "mysql" | "postgres" | "redis";
4141
}
4242

4343
const AddRedirectchema = z.object({
@@ -49,28 +49,29 @@ type AddCommand = z.infer<typeof AddRedirectchema>;
4949

5050
export const ShowClusterSettings = ({ id, type }: Props) => {
5151
const queryMap = {
52-
postgres: () =>
53-
api.postgres.one.useQuery({ postgresId: id }, { enabled: !!id }),
54-
redis: () => api.redis.one.useQuery({ redisId: id }, { enabled: !!id }),
55-
mysql: () => api.mysql.one.useQuery({ mysqlId: id }, { enabled: !!id }),
56-
mariadb: () =>
57-
api.mariadb.one.useQuery({ mariadbId: id }, { enabled: !!id }),
5852
application: () =>
5953
api.application.one.useQuery({ applicationId: id }, { enabled: !!id }),
54+
mariadb: () =>
55+
api.mariadb.one.useQuery({ mariadbId: id }, { enabled: !!id }),
6056
mongo: () => api.mongo.one.useQuery({ mongoId: id }, { enabled: !!id }),
57+
mysql: () => api.mysql.one.useQuery({ mysqlId: id }, { enabled: !!id }),
58+
postgres: () =>
59+
api.postgres.one.useQuery({ postgresId: id }, { enabled: !!id }),
60+
redis: () => api.redis.one.useQuery({ redisId: id }, { enabled: !!id }),
6161
};
6262
const { data, refetch } = queryMap[type]
6363
? queryMap[type]()
6464
: api.mongo.one.useQuery({ mongoId: id }, { enabled: !!id });
6565
const { data: registries } = api.registry.all.useQuery();
6666

6767
const mutationMap = {
68-
postgres: () => api.postgres.update.useMutation(),
69-
redis: () => api.redis.update.useMutation(),
70-
mysql: () => api.mysql.update.useMutation(),
71-
mariadb: () => api.mariadb.update.useMutation(),
7268
application: () => api.application.update.useMutation(),
69+
libsql: () => api.libsql.update.useMutation(),
70+
mariadb: () => api.mariadb.update.useMutation(),
7371
mongo: () => api.mongo.update.useMutation(),
72+
mysql: () => api.mysql.update.useMutation(),
73+
postgres: () => api.postgres.update.useMutation(),
74+
redis: () => api.redis.update.useMutation(),
7475
};
7576

7677
const { mutateAsync, isPending } = mutationMap[type]
@@ -105,11 +106,11 @@ export const ShowClusterSettings = ({ id, type }: Props) => {
105106
const onSubmit = async (data: AddCommand) => {
106107
await mutateAsync({
107108
applicationId: id || "",
108-
postgresId: id || "",
109-
redisId: id || "",
110-
mysqlId: id || "",
111109
mariadbId: id || "",
112110
mongoId: id || "",
111+
mysqlId: id || "",
112+
postgresId: id || "",
113+
redisId: id || "",
113114
...(type === "application"
114115
? {
115116
registryId:

apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/endpoint-spec-form.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ export const endpointSpecFormSchema = z.object({
2828

2929
interface EndpointSpecFormProps {
3030
id: string;
31-
type: "postgres" | "mariadb" | "mongo" | "mysql" | "redis" | "application";
31+
type:
32+
| "postgres"
33+
| "mariadb"
34+
| "mongo"
35+
| "mysql"
36+
| "redis"
37+
| "application"
38+
| "libsql";
3239
}
3340

3441
export const EndpointSpecForm = ({ id, type }: EndpointSpecFormProps) => {
@@ -44,6 +51,7 @@ export const EndpointSpecForm = ({ id, type }: EndpointSpecFormProps) => {
4451
application: () =>
4552
api.application.one.useQuery({ applicationId: id }, { enabled: !!id }),
4653
mongo: () => api.mongo.one.useQuery({ mongoId: id }, { enabled: !!id }),
54+
libsql: () => api.libsql.one.useQuery({ libsqlId: id }, { enabled: !!id }),
4755
};
4856
const { data, refetch } = queryMap[type]
4957
? queryMap[type]()
@@ -56,6 +64,7 @@ export const EndpointSpecForm = ({ id, type }: EndpointSpecFormProps) => {
5664
mariadb: () => api.mariadb.update.useMutation(),
5765
application: () => api.application.update.useMutation(),
5866
mongo: () => api.mongo.update.useMutation(),
67+
libsql: () => api.libsql.update.useMutation(),
5968
};
6069

6170
const { mutateAsync } = mutationMap[type]
@@ -94,6 +103,7 @@ export const EndpointSpecForm = ({ id, type }: EndpointSpecFormProps) => {
94103
mysqlId: id || "",
95104
mariadbId: id || "",
96105
mongoId: id || "",
106+
libsqlId: id || "",
97107
endpointSpecSwarm: hasAnyValue ? formData : null,
98108
});
99109

apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ export const healthCheckFormSchema = z.object({
2626

2727
interface HealthCheckFormProps {
2828
id: string;
29-
type: "postgres" | "mariadb" | "mongo" | "mysql" | "redis" | "application";
29+
type:
30+
| "postgres"
31+
| "mariadb"
32+
| "mongo"
33+
| "mysql"
34+
| "redis"
35+
| "application"
36+
| "libsql";
3037
}
3138

3239
export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => {
@@ -42,6 +49,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => {
4249
application: () =>
4350
api.application.one.useQuery({ applicationId: id }, { enabled: !!id }),
4451
mongo: () => api.mongo.one.useQuery({ mongoId: id }, { enabled: !!id }),
52+
libsql: () => api.libsql.one.useQuery({ libsqlId: id }, { enabled: !!id }),
4553
};
4654
const { data, refetch } = queryMap[type]
4755
? queryMap[type]()
@@ -54,6 +62,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => {
5462
mariadb: () => api.mariadb.update.useMutation(),
5563
application: () => api.application.update.useMutation(),
5664
mongo: () => api.mongo.update.useMutation(),
65+
libsql: () => api.libsql.update.useMutation(),
5766
};
5867

5968
const { mutateAsync } = mutationMap[type]
@@ -104,6 +113,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => {
104113
mysqlId: id || "",
105114
mariadbId: id || "",
106115
mongoId: id || "",
116+
libsqlId: id || "",
107117
healthCheckSwarm: hasAnyValue ? formData : null,
108118
});
109119

apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/labels-form.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ export const labelsFormSchema = z.object({
2929

3030
interface LabelsFormProps {
3131
id: string;
32-
type: "postgres" | "mariadb" | "mongo" | "mysql" | "redis" | "application";
32+
type:
33+
| "postgres"
34+
| "mariadb"
35+
| "mongo"
36+
| "mysql"
37+
| "redis"
38+
| "application"
39+
| "libsql";
3340
}
3441

3542
export const LabelsForm = ({ id, type }: LabelsFormProps) => {
@@ -45,6 +52,7 @@ export const LabelsForm = ({ id, type }: LabelsFormProps) => {
4552
application: () =>
4653
api.application.one.useQuery({ applicationId: id }, { enabled: !!id }),
4754
mongo: () => api.mongo.one.useQuery({ mongoId: id }, { enabled: !!id }),
55+
libsql: () => api.libsql.one.useQuery({ libsqlId: id }, { enabled: !!id }),
4856
};
4957
const { data, refetch } = queryMap[type]
5058
? queryMap[type]()
@@ -57,6 +65,7 @@ export const LabelsForm = ({ id, type }: LabelsFormProps) => {
5765
mariadb: () => api.mariadb.update.useMutation(),
5866
application: () => api.application.update.useMutation(),
5967
mongo: () => api.mongo.update.useMutation(),
68+
libsql: () => api.libsql.update.useMutation(),
6069
};
6170

6271
const { mutateAsync } = mutationMap[type]
@@ -112,6 +121,7 @@ export const LabelsForm = ({ id, type }: LabelsFormProps) => {
112121
mysqlId: id || "",
113122
mariadbId: id || "",
114123
mongoId: id || "",
124+
libsqlId: id || "",
115125
labelsSwarm: labelsToSend,
116126
});
117127

apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/mode-form.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ import { api } from "@/utils/api";
2323

2424
interface ModeFormProps {
2525
id: string;
26-
type: "postgres" | "mariadb" | "mongo" | "mysql" | "redis" | "application";
26+
type:
27+
| "postgres"
28+
| "mariadb"
29+
| "mongo"
30+
| "mysql"
31+
| "redis"
32+
| "application"
33+
| "libsql";
2734
}
2835

2936
export const ModeForm = ({ id, type }: ModeFormProps) => {
@@ -39,6 +46,7 @@ export const ModeForm = ({ id, type }: ModeFormProps) => {
3946
application: () =>
4047
api.application.one.useQuery({ applicationId: id }, { enabled: !!id }),
4148
mongo: () => api.mongo.one.useQuery({ mongoId: id }, { enabled: !!id }),
49+
libsql: () => api.libsql.one.useQuery({ libsqlId: id }, { enabled: !!id }),
4250
};
4351
const { data, refetch } = queryMap[type]
4452
? queryMap[type]()
@@ -51,6 +59,7 @@ export const ModeForm = ({ id, type }: ModeFormProps) => {
5159
mariadb: () => api.mariadb.update.useMutation(),
5260
application: () => api.application.update.useMutation(),
5361
mongo: () => api.mongo.update.useMutation(),
62+
libsql: () => api.libsql.update.useMutation(),
5463
};
5564

5665
const { mutateAsync } = mutationMap[type]
@@ -95,6 +104,7 @@ export const ModeForm = ({ id, type }: ModeFormProps) => {
95104
mysqlId: id || "",
96105
mariadbId: id || "",
97106
mongoId: id || "",
107+
libsqlId: id || "",
98108
modeSwarm: null,
99109
});
100110
toast.success("Mode updated successfully");
@@ -122,6 +132,7 @@ export const ModeForm = ({ id, type }: ModeFormProps) => {
122132
mysqlId: id || "",
123133
mariadbId: id || "",
124134
mongoId: id || "",
135+
libsqlId: id || "",
125136
modeSwarm: modeData,
126137
});
127138

apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/network-form.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ export const networkFormSchema = z.object({
3535

3636
interface NetworkFormProps {
3737
id: string;
38-
type: "postgres" | "mariadb" | "mongo" | "mysql" | "redis" | "application";
38+
type:
39+
| "postgres"
40+
| "mariadb"
41+
| "mongo"
42+
| "mysql"
43+
| "redis"
44+
| "application"
45+
| "libsql";
3946
}
4047

4148
export const NetworkForm = ({ id, type }: NetworkFormProps) => {
@@ -51,6 +58,7 @@ export const NetworkForm = ({ id, type }: NetworkFormProps) => {
5158
application: () =>
5259
api.application.one.useQuery({ applicationId: id }, { enabled: !!id }),
5360
mongo: () => api.mongo.one.useQuery({ mongoId: id }, { enabled: !!id }),
61+
libsql: () => api.libsql.one.useQuery({ libsqlId: id }, { enabled: !!id }),
5462
};
5563
const { data, refetch } = queryMap[type]
5664
? queryMap[type]()
@@ -63,6 +71,7 @@ export const NetworkForm = ({ id, type }: NetworkFormProps) => {
6371
mariadb: () => api.mariadb.update.useMutation(),
6472
application: () => api.application.update.useMutation(),
6573
mongo: () => api.mongo.update.useMutation(),
74+
libsql: () => api.libsql.update.useMutation(),
6675
};
6776

6877
const { mutateAsync } = mutationMap[type]
@@ -132,6 +141,7 @@ export const NetworkForm = ({ id, type }: NetworkFormProps) => {
132141
mysqlId: id || "",
133142
mariadbId: id || "",
134143
mongoId: id || "",
144+
libsqlId: id || "",
135145
networkSwarm: networksToSend,
136146
});
137147

apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/placement-form.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ export const placementFormSchema = z.object({
3434

3535
interface PlacementFormProps {
3636
id: string;
37-
type: "postgres" | "mariadb" | "mongo" | "mysql" | "redis" | "application";
37+
type:
38+
| "postgres"
39+
| "mariadb"
40+
| "mongo"
41+
| "mysql"
42+
| "redis"
43+
| "application"
44+
| "libsql";
3845
}
3946

4047
export const PlacementForm = ({ id, type }: PlacementFormProps) => {
@@ -50,6 +57,7 @@ export const PlacementForm = ({ id, type }: PlacementFormProps) => {
5057
application: () =>
5158
api.application.one.useQuery({ applicationId: id }, { enabled: !!id }),
5259
mongo: () => api.mongo.one.useQuery({ mongoId: id }, { enabled: !!id }),
60+
libsql: () => api.libsql.one.useQuery({ libsqlId: id }, { enabled: !!id }),
5361
};
5462
const { data, refetch } = queryMap[type]
5563
? queryMap[type]()
@@ -62,6 +70,7 @@ export const PlacementForm = ({ id, type }: PlacementFormProps) => {
6270
mariadb: () => api.mariadb.update.useMutation(),
6371
application: () => api.application.update.useMutation(),
6472
mongo: () => api.mongo.update.useMutation(),
73+
libsql: () => api.libsql.update.useMutation(),
6574
};
6675

6776
const { mutateAsync } = mutationMap[type]
@@ -114,6 +123,7 @@ export const PlacementForm = ({ id, type }: PlacementFormProps) => {
114123
mysqlId: id || "",
115124
mariadbId: id || "",
116125
mongoId: id || "",
126+
libsqlId: id || "",
117127
placementSwarm: hasAnyValue
118128
? {
119129
...formData,

0 commit comments

Comments
 (0)