Merge pull request #127 from Dokploy/canary

v0.2.1
This commit is contained in:
Mauricio Siu
2024-06-07 02:52:03 -06:00
committed by GitHub
16 changed files with 96 additions and 87 deletions

View File

@@ -39,10 +39,17 @@ curl -sSL https://dokploy.com/install.sh | sh
Getestete Systems: Getestete Systems:
- Ubuntu 20.04 - Ubuntu 24.04 LTS (Noble Numbat)
- Ubuntu 23.10 (Mantic Minotaur)
- Ubuntu 22.04 LTS (Jammy Jellyfish)
- Ubuntu 20.04 LTS (Focal Fossa)
- Ubuntu 18.04 LTS (Bionic Beaver)
- Debian 12
- Debian 11 - Debian 11
- Fedora 40 - Fedora 40
- Centos 9 - Centos 9
- Centos 8
## 📄 Dokumentation ## 📄 Dokumentation

View File

@@ -40,10 +40,17 @@ curl -sSL https://dokploy.com/install.sh | sh
Проверенные системы: Проверенные системы:
- Ubuntu 20.04 - Ubuntu 24.04 LTS (Noble Numbat)
- Ubuntu 23.10 (Mantic Minotaur)
- Ubuntu 22.04 LTS (Jammy Jellyfish)
- Ubuntu 20.04 LTS (Focal Fossa)
- Ubuntu 18.04 LTS (Bionic Beaver)
- Debian 12
- Debian 11 - Debian 11
- Fedora 40 - Fedora 40
- Centos 9 - Centos 9
- Centos 8
## 📄 Документация ## 📄 Документация
Для подробной документации посетите [docs.dokploy.com/docs](https://docs.dokploy.com). Для подробной документации посетите [docs.dokploy.com/docs](https://docs.dokploy.com).

View File

@@ -43,10 +43,17 @@ curl -sSL https://dokploy.com/install.sh | sh
经过测试的系统: 经过测试的系统:
- Ubuntu 20.04 - Ubuntu 24.04 LTS (Noble Numbat)
- Ubuntu 23.10 (Mantic Minotaur)
- Ubuntu 22.04 LTS (Jammy Jellyfish)
- Ubuntu 20.04 LTS (Focal Fossa)
- Ubuntu 18.04 LTS (Bionic Beaver)
- Debian 12
- Debian 11 - Debian 11
- Fedora 40 - Fedora 40
- Centos 9 - Centos 9
- Centos 8
## 📄 文档 ## 📄 文档

View File

@@ -42,10 +42,16 @@ curl -sSL https://dokploy.com/install.sh | sh
Tested Systems: Tested Systems:
- Ubuntu 20.04 - Ubuntu 24.04 LTS (Noble Numbat)
- Ubuntu 23.10 (Mantic Minotaur)
- Ubuntu 22.04 LTS (Jammy Jellyfish)
- Ubuntu 20.04 LTS (Focal Fossa)
- Ubuntu 18.04 LTS (Bionic Beaver)
- Debian 12
- Debian 11 - Debian 11
- Fedora 40 - Fedora 40
- Centos 9 - Centos 9
- Centos 8
## 📄 Documentation ## 📄 Documentation

View File

@@ -183,8 +183,7 @@ export const AddPort = ({
<SelectValue placeholder="Select a protocol" /> <SelectValue placeholder="Select a protocol" />
</SelectTrigger> </SelectTrigger>
</FormControl> </FormControl>
<SelectContent defaultValue={"none"}> <SelectContent>
<SelectItem value={"none"}>None</SelectItem>
<SelectItem value={"tcp"}>TCP</SelectItem> <SelectItem value={"tcp"}>TCP</SelectItem>
<SelectItem value={"udp"}>UDP</SelectItem> <SelectItem value={"udp"}>UDP</SelectItem>
</SelectContent> </SelectContent>

View File

@@ -11,6 +11,7 @@ import {
} from "@/components/ui/alert-dialog"; } from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { api } from "@/utils/api"; import { api } from "@/utils/api";
import { useEffect, useState } from "react";
import { toast } from "sonner"; import { toast } from "sonner";
interface Props { interface Props {
@@ -51,18 +52,14 @@ export const DeployApplication = ({ applicationId }: Props) => {
applicationId, applicationId,
}) })
.then(async () => { .then(async () => {
toast.success("Application Deploying...."); toast.success("Deploying Application....");
await refetch(); await refetch();
await deploy({ await deploy({
applicationId, applicationId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Application");
toast.success("Application Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Application");
});
await refetch(); await refetch();
}) })

View File

@@ -49,18 +49,14 @@ export const DeployCompose = ({ composeId }: Props) => {
composeStatus: "running", composeStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Compose Deploying...."); toast.success("Deploying Compose....");
await refetch(); await refetch();
await deploy({ await deploy({
composeId, composeId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Compose");
toast.success("Compose Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Compose");
});
await refetch(); await refetch();
}) })

View File

@@ -50,17 +50,13 @@ export const DeployMariadb = ({ mariadbId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
mariadbId, mariadbId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {

View File

@@ -50,17 +50,13 @@ export const DeployMongo = ({ mongoId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
mongoId, mongoId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {

View File

@@ -50,17 +50,13 @@ export const DeployMysql = ({ mysqlId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
mysqlId, mysqlId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {

View File

@@ -50,17 +50,13 @@ export const DeployPostgres = ({ postgresId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
postgresId, postgresId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {

View File

@@ -50,17 +50,13 @@ export const DeployRedis = ({ redisId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database...");
await refetch(); await refetch();
await deploy({ await deploy({
redisId, redisId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {

View File

@@ -1,6 +1,6 @@
{ {
"name": "dokploy", "name": "dokploy",
"version": "v0.2.0", "version": "v0.2.1",
"private": true, "private": true,
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"type": "module", "type": "module",

View File

@@ -17,7 +17,7 @@ import { adminProcedure, createTRPCRouter, protectedProcedure } from "../trpc";
import { TRPCError } from "@trpc/server"; import { TRPCError } from "@trpc/server";
import { manageRegistry } from "@/server/utils/traefik/registry"; import { manageRegistry } from "@/server/utils/traefik/registry";
import { initializeRegistry } from "@/server/setup/registry-setup"; import { initializeRegistry } from "@/server/setup/registry-setup";
import { docker } from "@/server/constants"; import { execAsync } from "@/server/utils/process/execAsync";
export const registryRouter = createTRPCRouter({ export const registryRouter = createTRPCRouter({
create: adminProcedure create: adminProcedure
@@ -57,15 +57,11 @@ export const registryRouter = createTRPCRouter({
.input(apiTestRegistry) .input(apiTestRegistry)
.mutation(async ({ input }) => { .mutation(async ({ input }) => {
try { try {
const result = await docker.checkAuth({ const loginCommand = `echo ${input.password} | docker login ${input.registryUrl} --username ${input.username} --password-stdin`;
username: input.username, await execAsync(loginCommand);
password: input.password,
serveraddress: input.registryUrl,
});
return true; return true;
} catch (error) { } catch (error) {
console.log(error); console.log("Error Registry:", error);
return false; return false;
} }
}), }),

View File

@@ -9,28 +9,35 @@ import {
} from "@/server/utils/traefik/registry"; } from "@/server/utils/traefik/registry";
import { removeService } from "@/server/utils/docker/utils"; import { removeService } from "@/server/utils/docker/utils";
import { initializeRegistry } from "@/server/setup/registry-setup"; import { initializeRegistry } from "@/server/setup/registry-setup";
import { execAsync } from "@/server/utils/process/execAsync";
export type Registry = typeof registry.$inferSelect; export type Registry = typeof registry.$inferSelect;
export const createRegistry = async (input: typeof apiCreateRegistry._type) => { export const createRegistry = async (input: typeof apiCreateRegistry._type) => {
const admin = await findAdmin(); const admin = await findAdmin();
const newRegistry = await db return await db.transaction(async (tx) => {
.insert(registry) const newRegistry = await tx
.values({ .insert(registry)
...input, .values({
adminId: admin.adminId, ...input,
}) adminId: admin.adminId,
.returning() })
.then((value) => value[0]); .returning()
.then((value) => value[0]);
if (!newRegistry) { if (!newRegistry) {
throw new TRPCError({ throw new TRPCError({
code: "BAD_REQUEST", code: "BAD_REQUEST",
message: "Error input: Inserting registry", message: "Error input: Inserting registry",
}); });
} }
return newRegistry;
const loginCommand = `echo ${input.password} | docker login ${input.registryUrl} --username ${input.username} --password-stdin`;
await execAsync(loginCommand);
return newRegistry;
});
}; };
export const removeRegistry = async (registryId: string) => { export const removeRegistry = async (registryId: string) => {
@@ -53,6 +60,8 @@ export const removeRegistry = async (registryId: string) => {
await removeService("dokploy-registry"); await removeService("dokploy-registry");
} }
await execAsync(`docker logout ${response.registryUrl}`);
return response; return response;
} catch (error) { } catch (error) {
throw new TRPCError({ throw new TRPCError({

View File

@@ -108,7 +108,12 @@ const createEnvFile = (compose: ComposeNested) => {
join(COMPOSE_PATH, appName, "docker-compose.yml"); join(COMPOSE_PATH, appName, "docker-compose.yml");
const envFilePath = join(dirname(composeFilePath), ".env"); const envFilePath = join(dirname(composeFilePath), ".env");
const envFileContent = prepareEnvironmentVariables(env).join("\n"); let envContent = env || "";
if (!envContent.includes("DOCKER_CONFIG")) {
envContent += "\nDOCKER_CONFIG=/root/.docker/config.json";
}
const envFileContent = prepareEnvironmentVariables(envContent).join("\n");
if (!existsSync(dirname(envFilePath))) { if (!existsSync(dirname(envFilePath))) {
mkdirSync(dirname(envFilePath), { recursive: true }); mkdirSync(dirname(envFilePath), { recursive: true });