mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a93f18eb4a | ||
|
|
77e9617770 | ||
|
|
21e97b0175 | ||
|
|
a6618a14d5 | ||
|
|
59308ab013 | ||
|
|
e19c8d7a7a | ||
|
|
421c93795b | ||
|
|
182f908c31 | ||
|
|
20616363e9 | ||
|
|
d85073b26d | ||
|
|
303d1b1b87 | ||
|
|
60d4e1ba63 | ||
|
|
83d52b68f0 | ||
|
|
af3b1a27f4 | ||
|
|
7f94593c07 | ||
|
|
5df7654873 | ||
|
|
054836fd4c | ||
|
|
484ead1f1f | ||
|
|
fbada4c5de | ||
|
|
491113416b | ||
|
|
c42f5cb799 | ||
|
|
47aa223f87 | ||
|
|
554ac59b97 | ||
|
|
0247898876 | ||
|
|
467acc4d4d | ||
|
|
fc2778db35 | ||
|
|
85d6ff9012 | ||
|
|
522f8baec7 | ||
|
|
01e5cf0852 | ||
|
|
df9fad088f | ||
|
|
2644b638d1 | ||
|
|
acd722678e | ||
|
|
727e50648e | ||
|
|
349bc89851 | ||
|
|
9f6f872536 | ||
|
|
e378d89477 | ||
|
|
63e7eacae9 | ||
|
|
f4ab588516 | ||
|
|
4d8a0ba58f | ||
|
|
e88cd11041 | ||
|
|
5f174a883b | ||
|
|
536a6ba2ff | ||
|
|
213fa08210 | ||
|
|
d5c6a601d8 | ||
|
|
452793c8e5 | ||
|
|
385fbf4af5 | ||
|
|
3590f3bed2 | ||
|
|
9b2fcaea31 | ||
|
|
5abcc82215 | ||
|
|
ee855452e3 | ||
|
|
d000b526d3 | ||
|
|
9bf88b90c3 | ||
|
|
b1a48d4636 | ||
|
|
c34c4b244e | ||
|
|
bb59a0cd3f | ||
|
|
44e6a117dd | ||
|
|
bfdc73f8d1 | ||
|
|
64ada7020a | ||
|
|
4706adc0c0 | ||
|
|
e01d92d1d9 | ||
|
|
fe22890311 | ||
|
|
2b7c7632f4 | ||
|
|
1b7244e841 |
@@ -71,10 +71,9 @@ Run the command that will spin up all the required services and files.
|
||||
pnpm run dokploy:setup
|
||||
```
|
||||
|
||||
Build the server package (If you make any changes after in the packages/server folder, you need to rebuild and run this command)
|
||||
|
||||
Run this script
|
||||
```bash
|
||||
pnpm run server:build
|
||||
pnpm run server:script
|
||||
```
|
||||
|
||||
Now run the development server.
|
||||
|
||||
@@ -15,6 +15,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
# Deploy only the dokploy app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
RUN pnpm --filter=@dokploy/server switch:prod
|
||||
RUN pnpm --filter=@dokploy/server build
|
||||
RUN pnpm --filter=./apps/dokploy run build
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm --filter=@dokploy/server
|
||||
# Deploy only the dokploy app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
RUN pnpm --filter=@dokploy/server switch:prod
|
||||
RUN pnpm --filter=@dokploy/server build
|
||||
RUN pnpm --filter=./apps/dokploy run build
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm --filter=@dokploy/server
|
||||
# Deploy only the dokploy app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
RUN pnpm --filter=@dokploy/server switch:prod
|
||||
RUN pnpm --filter=@dokploy/server build
|
||||
RUN pnpm --filter=./apps/schedules run build
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm --filter=@dokploy/server
|
||||
# Deploy only the dokploy app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
RUN pnpm --filter=@dokploy/server switch:prod
|
||||
RUN pnpm --filter=@dokploy/server build
|
||||
RUN pnpm --filter=./apps/api run build
|
||||
|
||||
|
||||
22
README.md
22
README.md
@@ -15,29 +15,29 @@
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
Dokploy is a free self-hostable Platform as a Service (PaaS) that simplifies the deployment and management of applications and databases.
|
||||
Dokploy is a free, self-hostable Platform as a Service (PaaS) that simplifies the deployment and management of applications and databases.
|
||||
|
||||
### Features
|
||||
|
||||
Dokploy include multiples features to make your life easier.
|
||||
Dokploy includes multiple features to make your life easier.
|
||||
|
||||
- **Applications**: Deploy any type of application (Node.js, PHP, Python, Go, Ruby, etc.).
|
||||
- **Databases**: Create and manage databases with support for MySQL, PostgreSQL, MongoDB, MariaDB, Redis.
|
||||
- **Backups**: Automate backups for databases to a external storage destination.
|
||||
- **Databases**: Create and manage databases with support for MySQL, PostgreSQL, MongoDB, MariaDB, and Redis.
|
||||
- **Backups**: Automate backups for databases to an external storage destination.
|
||||
- **Docker Compose**: Native support for Docker Compose to manage complex applications.
|
||||
- **Multi Node**: Scale applications to multiples nodes using docker swarm to manage the cluster.
|
||||
- **Templates**: Deploy in a single click open source templates (Plausible, Pocketbase, Calcom, etc.).
|
||||
- **Multi Node**: Scale applications to multiple nodes using Docker Swarm to manage the cluster.
|
||||
- **Templates**: Deploy open-source templates (Plausible, Pocketbase, Calcom, etc.) with a single click.
|
||||
- **Traefik Integration**: Automatically integrates with Traefik for routing and load balancing.
|
||||
- **Real-time Monitoring**: Monitor CPU, memory, storage, and network usage, for every resource.
|
||||
- **Real-time Monitoring**: Monitor CPU, memory, storage, and network usage for every resource.
|
||||
- **Docker Management**: Easily deploy and manage Docker containers.
|
||||
- **CLI/API**: Manage your applications and databases using the command line or through the API.
|
||||
- **Notifications**: Get notified when your deployments are successful or failed (Slack, Discord, Telegram, Email, etc.)
|
||||
- **Multi Server**: Deploy and manager your applications remotely to external servers.
|
||||
- **Notifications**: Get notified when your deployments succeed or fail (via Slack, Discord, Telegram, Email, etc.).
|
||||
- **Multi Server**: Deploy and manage your applications remotely to external servers.
|
||||
- **Self-Hosted**: Self-host Dokploy on your VPS.
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
To get started run the following command in a VPS:
|
||||
To get started, run the following command on a VPS:
|
||||
|
||||
```bash
|
||||
curl -sSL https://dokploy.com/install.sh | sh
|
||||
@@ -90,6 +90,8 @@ For detailed documentation, visit [docs.dokploy.com](https://docs.dokploy.com).
|
||||
<div style="display: flex; gap: 30px; flex-wrap: wrap;">
|
||||
<a href="https://steamsets.com/?ref=dokploy"><img src="https://avatars.githubusercontent.com/u/111978405?s=200&v=4" width="60px" alt="Steamsets.com"/></a>
|
||||
<a href="https://rivo.gg/?ref=dokploy"><img src="https://avatars.githubusercontent.com/u/126797452?s=200&v=4" width="60px" alt="Rivo.gg"/></a>
|
||||
<a href="https://photoquest.wedding/?ref=dokploy"><img src="https://photoquest.wedding/favicon/android-chrome-512x512.png" width="60px" alt="Rivo.gg"/></a>
|
||||
|
||||
</div>
|
||||
|
||||
#### Organizations:
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
rebuildRemoteCompose,
|
||||
updateApplicationStatus,
|
||||
updateCompose,
|
||||
} from "@dokploy/server";
|
||||
} from "@dokploy/server/dist";
|
||||
import type { DeployJob } from "./schema";
|
||||
import type { LemonSqueezyLicenseResponse } from "./types";
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@ description: '学习如何在服务器上手动安装 Dokploy。'
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# 确保以根用户身份运行脚本
|
||||
# Ensure the script is run as root
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "This script must be run as root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查 Linux 操作系统(非 macOS 或 Docker 容器内的操作系统)
|
||||
# Check for Linux OS (not macOS or inside a Docker container)
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
echo "This script must be run on Linux" >&2
|
||||
exit 1
|
||||
@@ -32,7 +32,7 @@ if [ -f /.dockerenv ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查端口是否被占用
|
||||
# Check for occupied ports
|
||||
if ss -tulnp | grep ':80 ' >/dev/null; then
|
||||
echo "Error: Port 80 is already in use" >&2
|
||||
exit 1
|
||||
@@ -43,32 +43,53 @@ if ss -tulnp | grep ':443 ' >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查命令是否存在
|
||||
# Function to check if a command exists
|
||||
command_exists() {
|
||||
command -v "$@" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# 如果未安装 Docker 则安装
|
||||
# Install Docker if it is not installed
|
||||
if command_exists docker; then
|
||||
echo "Docker already installed"
|
||||
else
|
||||
curl -sSL https://get.docker.com | sh
|
||||
fi
|
||||
|
||||
# 初始化 Docker Swarm
|
||||
# Initialize Docker Swarm
|
||||
docker swarm leave --force 2>/dev/null
|
||||
advertise_addr=$(curl -s ifconfig.me)
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
echo "Swarm initialized"
|
||||
|
||||
# 创建网络
|
||||
docker network rm -f dokploy-network 2>/dev/null
|
||||
docker network create --driver overlay --attachable dokploy-network
|
||||
echo "Network created"
|
||||
get_ip() {
|
||||
# Try to get IPv4
|
||||
local ipv4=$(curl -4s https://ifconfig.io 2>/dev/null)
|
||||
|
||||
# 准备配置目录
|
||||
mkdir -p /etc/dokploy
|
||||
chmod -R 777 /etc/dokploy
|
||||
if [ -n "$ipv4" ]; then
|
||||
echo "$ipv4"
|
||||
else
|
||||
# Try to get IPv6
|
||||
local ipv6=$(curl -6s https://ifconfig.io 2>/dev/null)
|
||||
if [ -n "$ipv6" ]; then
|
||||
echo "$ipv6"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to initialize Docker Swarm" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker network rm -f dokploy-network 2>/dev/null
|
||||
docker network create --driver overlay --attachable dokploy-network
|
||||
|
||||
echo "Network created"
|
||||
|
||||
mkdir -p /etc/dokploy
|
||||
|
||||
chmod 777 /etc/dokploy
|
||||
|
||||
# Pull and deploy Dokploy
|
||||
docker pull dokploy/dokploy:latest
|
||||
@@ -84,9 +105,10 @@ docker service create \
|
||||
-e PORT=<Value For PORT eg(3000)> \
|
||||
-e TRAEFIK_SSL_PORT=<Value For SSL PORT eg(444)> \
|
||||
-e TRAEFIK_PORT=<VALUE FOR TRAEFIK HTTP PORT eg(81)> \
|
||||
-e ADVERTISE_ADDR=$advertise_addr \
|
||||
dokploy/dokploy:latest
|
||||
|
||||
# 输出成功消息
|
||||
# Output success message
|
||||
GREEN="\033[0;32m"
|
||||
YELLOW="\033[1;33m"
|
||||
BLUE="\033[0;34m"
|
||||
|
||||
@@ -57,18 +57,39 @@ fi
|
||||
|
||||
# Initialize Docker Swarm
|
||||
docker swarm leave --force 2>/dev/null
|
||||
advertise_addr=$(curl -s ifconfig.me)
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
echo "Swarm initialized"
|
||||
|
||||
# Create network
|
||||
docker network rm -f dokploy-network 2>/dev/null
|
||||
docker network create --driver overlay --attachable dokploy-network
|
||||
echo "Network created"
|
||||
get_ip() {
|
||||
# Try to get IPv4
|
||||
local ipv4=$(curl -4s https://ifconfig.io 2>/dev/null)
|
||||
|
||||
# Prepare configuration directory
|
||||
mkdir -p /etc/dokploy
|
||||
chmod -R 777 /etc/dokploy
|
||||
if [ -n "$ipv4" ]; then
|
||||
echo "$ipv4"
|
||||
else
|
||||
# Try to get IPv6
|
||||
local ipv6=$(curl -6s https://ifconfig.io 2>/dev/null)
|
||||
if [ -n "$ipv6" ]; then
|
||||
echo "$ipv6"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to initialize Docker Swarm" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker network rm -f dokploy-network 2>/dev/null
|
||||
docker network create --driver overlay --attachable dokploy-network
|
||||
|
||||
echo "Network created"
|
||||
|
||||
mkdir -p /etc/dokploy
|
||||
|
||||
chmod 777 /etc/dokploy
|
||||
|
||||
# Pull and deploy Dokploy
|
||||
docker pull dokploy/dokploy:latest
|
||||
@@ -84,6 +105,7 @@ docker service create \
|
||||
-e PORT=<Value For PORT eg(3000)> \
|
||||
-e TRAEFIK_SSL_PORT=<Value For SSL PORT eg(444)> \
|
||||
-e TRAEFIK_PORT=<VALUE FOR TRAEFIK HTTP PORT eg(81)> \
|
||||
-e ADVERTISE_ADDR=$advertise_addr \
|
||||
dokploy/dokploy:latest
|
||||
|
||||
# Output success message
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { paths } from "@dokploy/server/dist/constants";
|
||||
import { paths } from "@dokploy/server/constants";
|
||||
const { APPLICATIONS_PATH } = paths();
|
||||
import type { ApplicationNested } from "@dokploy/server";
|
||||
import { unzipDrop } from "@dokploy/server";
|
||||
import AdmZip from "adm-zip";
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("@dokploy/server/constants", async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
return {
|
||||
// @ts-ignore
|
||||
...actual,
|
||||
paths: () => ({
|
||||
APPLICATIONS_PATH: "./__test__/drop/zips/output",
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
if (typeof window === "undefined") {
|
||||
const undici = require("undici");
|
||||
globalThis.File = undici.File as any;
|
||||
@@ -82,16 +93,6 @@ const baseApp: ApplicationNested = {
|
||||
dockerContextPath: null,
|
||||
};
|
||||
|
||||
vi.mock("@dokploy/server/dist/constants", async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
return {
|
||||
// @ts-ignore
|
||||
...actual,
|
||||
paths: () => ({
|
||||
APPLICATIONS_PATH: "./__test__/drop/zips/output",
|
||||
}),
|
||||
};
|
||||
});
|
||||
describe("unzipDrop using real zip files", () => {
|
||||
// const { APPLICATIONS_PATH } = paths();
|
||||
beforeAll(async () => {
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import path from "node:path";
|
||||
import tsconfigPaths from "vite-tsconfig-paths";
|
||||
import { defineConfig } from "vitest/config";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
tsconfigPaths({
|
||||
root: "./",
|
||||
projects: ["tsconfig.json"],
|
||||
}),
|
||||
],
|
||||
test: {
|
||||
include: ["__test__/**/*.test.ts"], // Incluir solo los archivos de test en el directorio __test__
|
||||
exclude: ["**/node_modules/**", "**/dist/**", "**/.docker/**"],
|
||||
@@ -18,4 +13,12 @@ export default defineConfig({
|
||||
NODE: "test",
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"@dokploy/server": path.resolve(
|
||||
__dirname,
|
||||
"../../../packages/server/src",
|
||||
),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dokploy",
|
||||
"version": "v0.10.2",
|
||||
"version": "v0.10.4",
|
||||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
@@ -11,7 +11,7 @@
|
||||
"build-next": "next build",
|
||||
"setup": "tsx -r dotenv/config setup.ts && sleep 5 && pnpm run migration:run",
|
||||
"reset-password": "node -r dotenv/config dist/reset-password.mjs",
|
||||
"dev": "tsx -r dotenv/config ./server/server.ts --project tsconfig.server.json ",
|
||||
"dev": "TURBOPACK=1 tsx -r dotenv/config ./server/server.ts --project tsconfig.server.json ",
|
||||
"studio": "drizzle-kit studio --config ./server/db/drizzle.config.ts",
|
||||
"migration:generate": "drizzle-kit generate --config ./server/db/drizzle.config.ts",
|
||||
"migration:run": "tsx -r dotenv/config migration.ts",
|
||||
@@ -90,7 +90,7 @@
|
||||
"lucia": "^3.0.1",
|
||||
"lucide-react": "^0.312.0",
|
||||
"nanoid": "3",
|
||||
"next": "^14.1.3",
|
||||
"next": "^15.0.1",
|
||||
"next-themes": "^0.2.1",
|
||||
"node-pty": "1.0.0",
|
||||
"node-schedule": "2.1.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { db } from "@/server/db";
|
||||
import { applications } from "@/server/db/schema";
|
||||
import type { DeploymentJob } from "@/server/queues/deployments-queue";
|
||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||
import { myQueue } from "@/server/queues/queueSetup";
|
||||
import { deploy } from "@/server/utils/deploy";
|
||||
import { IS_CLOUD } from "@dokploy/server";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { db } from "@/server/db";
|
||||
import { compose } from "@/server/db/schema";
|
||||
import type { DeploymentJob } from "@/server/queues/deployments-queue";
|
||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||
import { myQueue } from "@/server/queues/queueSetup";
|
||||
import { deploy } from "@/server/utils/deploy";
|
||||
import { IS_CLOUD } from "@dokploy/server";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { db } from "@/server/db";
|
||||
import { applications, compose, github } from "@/server/db/schema";
|
||||
import type { DeploymentJob } from "@/server/queues/deployments-queue";
|
||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||
import { myQueue } from "@/server/queues/queueSetup";
|
||||
import { deploy } from "@/server/utils/deploy";
|
||||
import { IS_CLOUD } from "@dokploy/server";
|
||||
|
||||
@@ -110,9 +110,11 @@ const Service = (
|
||||
<div className="flex flex-row h-fit w-fit gap-2">
|
||||
<Badge
|
||||
variant={
|
||||
data?.server?.serverStatus === "active"
|
||||
!data?.serverId
|
||||
? "default"
|
||||
: "destructive"
|
||||
: data?.server?.serverStatus === "active"
|
||||
? "default"
|
||||
: "destructive"
|
||||
}
|
||||
>
|
||||
{data?.server?.name || "Dokploy Server"}
|
||||
|
||||
@@ -105,9 +105,11 @@ const Service = (
|
||||
<div className="flex flex-row h-fit w-fit gap-2">
|
||||
<Badge
|
||||
variant={
|
||||
data?.server?.serverStatus === "active"
|
||||
!data?.serverId
|
||||
? "default"
|
||||
: "destructive"
|
||||
: data?.server?.serverStatus === "active"
|
||||
? "default"
|
||||
: "destructive"
|
||||
}
|
||||
>
|
||||
{data?.server?.name || "Dokploy Server"}
|
||||
|
||||
@@ -93,9 +93,11 @@ const Mariadb = (
|
||||
<div className="flex flex-row h-fit w-fit gap-2">
|
||||
<Badge
|
||||
variant={
|
||||
data?.server?.serverStatus === "active"
|
||||
!data?.serverId
|
||||
? "default"
|
||||
: "destructive"
|
||||
: data?.server?.serverStatus === "active"
|
||||
? "default"
|
||||
: "destructive"
|
||||
}
|
||||
>
|
||||
{data?.server?.name || "Dokploy Server"}
|
||||
|
||||
@@ -94,9 +94,11 @@ const Mongo = (
|
||||
<div className="flex flex-row h-fit w-fit gap-2">
|
||||
<Badge
|
||||
variant={
|
||||
data?.server?.serverStatus === "active"
|
||||
!data?.serverId
|
||||
? "default"
|
||||
: "destructive"
|
||||
: data?.server?.serverStatus === "active"
|
||||
? "default"
|
||||
: "destructive"
|
||||
}
|
||||
>
|
||||
{data?.server?.name || "Dokploy Server"}
|
||||
|
||||
@@ -92,9 +92,11 @@ const MySql = (
|
||||
<div className="flex flex-row h-fit w-fit gap-2">
|
||||
<Badge
|
||||
variant={
|
||||
data?.server?.serverStatus === "active"
|
||||
!data?.serverId
|
||||
? "default"
|
||||
: "destructive"
|
||||
: data?.server?.serverStatus === "active"
|
||||
? "default"
|
||||
: "destructive"
|
||||
}
|
||||
>
|
||||
{data?.server?.name || "Dokploy Server"}
|
||||
|
||||
@@ -93,9 +93,11 @@ const Postgresql = (
|
||||
<div className="flex flex-row h-fit w-fit gap-2">
|
||||
<Badge
|
||||
variant={
|
||||
data?.server?.serverStatus === "active"
|
||||
!data?.serverId
|
||||
? "default"
|
||||
: "destructive"
|
||||
: data?.server?.serverStatus === "active"
|
||||
? "default"
|
||||
: "destructive"
|
||||
}
|
||||
>
|
||||
{data?.server?.name || "Dokploy Server"}
|
||||
|
||||
@@ -92,9 +92,11 @@ const Redis = (
|
||||
<div className="flex flex-row h-fit w-fit gap-2">
|
||||
<Badge
|
||||
variant={
|
||||
data?.server?.serverStatus === "active"
|
||||
!data?.serverId
|
||||
? "default"
|
||||
: "destructive"
|
||||
: data?.server?.serverStatus === "active"
|
||||
? "default"
|
||||
: "destructive"
|
||||
}
|
||||
>
|
||||
{data?.server?.name || "Dokploy Server"}
|
||||
|
||||
@@ -19,11 +19,8 @@ import {
|
||||
apiUpdateApplication,
|
||||
applications,
|
||||
} from "@/server/db/schema";
|
||||
import {
|
||||
type DeploymentJob,
|
||||
cleanQueuesByApplication,
|
||||
} from "@/server/queues/deployments-queue";
|
||||
import { myQueue } from "@/server/queues/queueSetup";
|
||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||
import { cleanQueuesByApplication, myQueue } from "@/server/queues/queueSetup";
|
||||
import { deploy } from "@/server/utils/deploy";
|
||||
import { uploadFileSchema } from "@/utils/schema";
|
||||
import {
|
||||
|
||||
@@ -9,11 +9,7 @@ import {
|
||||
apiUpdateCompose,
|
||||
compose,
|
||||
} from "@/server/db/schema";
|
||||
import {
|
||||
type DeploymentJob,
|
||||
cleanQueuesByCompose,
|
||||
} from "@/server/queues/deployments-queue";
|
||||
import { myQueue } from "@/server/queues/queueSetup";
|
||||
import { cleanQueuesByCompose, myQueue } from "@/server/queues/queueSetup";
|
||||
import { templates } from "@/templates/templates";
|
||||
import type { TemplatesKeys } from "@/templates/types/templates-data.type";
|
||||
import {
|
||||
@@ -28,6 +24,7 @@ import _ from "lodash";
|
||||
import { nanoid } from "nanoid";
|
||||
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
||||
|
||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||
import { deploy } from "@/server/utils/deploy";
|
||||
import {
|
||||
IS_CLOUD,
|
||||
@@ -41,7 +38,6 @@ import {
|
||||
createComposeByTemplate,
|
||||
createDomain,
|
||||
createMount,
|
||||
findAdmin,
|
||||
findAdminById,
|
||||
findComposeById,
|
||||
findDomainsByComposeId,
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from "@dokploy/server/dist/db/schema";
|
||||
export * from "@dokploy/server/db/schema";
|
||||
|
||||
@@ -11,29 +11,8 @@ import {
|
||||
updateCompose,
|
||||
} from "@dokploy/server";
|
||||
import { type Job, Worker } from "bullmq";
|
||||
import { myQueue, redisConfig } from "./queueSetup";
|
||||
|
||||
type DeployJob =
|
||||
| {
|
||||
applicationId: string;
|
||||
titleLog: string;
|
||||
descriptionLog: string;
|
||||
server?: boolean;
|
||||
type: "deploy" | "redeploy";
|
||||
applicationType: "application";
|
||||
serverId?: string;
|
||||
}
|
||||
| {
|
||||
composeId: string;
|
||||
titleLog: string;
|
||||
descriptionLog: string;
|
||||
server?: boolean;
|
||||
type: "deploy" | "redeploy";
|
||||
applicationType: "compose";
|
||||
serverId?: string;
|
||||
};
|
||||
|
||||
export type DeploymentJob = DeployJob;
|
||||
import type { DeploymentJob } from "./queue-types";
|
||||
import { redisConfig } from "./redis-connection";
|
||||
|
||||
export const deploymentWorker = new Worker(
|
||||
"deployments",
|
||||
@@ -114,25 +93,3 @@ export const deploymentWorker = new Worker(
|
||||
connection: redisConfig,
|
||||
},
|
||||
);
|
||||
|
||||
export const cleanQueuesByApplication = async (applicationId: string) => {
|
||||
const jobs = await myQueue.getJobs(["waiting", "delayed"]);
|
||||
|
||||
for (const job of jobs) {
|
||||
if (job?.data?.applicationId === applicationId) {
|
||||
await job.remove();
|
||||
console.log(`Removed job ${job.id} for application ${applicationId}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const cleanQueuesByCompose = async (composeId: string) => {
|
||||
const jobs = await myQueue.getJobs(["waiting", "delayed"]);
|
||||
|
||||
for (const job of jobs) {
|
||||
if (job?.data?.composeId === composeId) {
|
||||
await job.remove();
|
||||
console.log(`Removed job ${job.id} for compose ${composeId}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
21
apps/dokploy/server/queues/queue-types.ts
Normal file
21
apps/dokploy/server/queues/queue-types.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
type DeployJob =
|
||||
| {
|
||||
applicationId: string;
|
||||
titleLog: string;
|
||||
descriptionLog: string;
|
||||
server?: boolean;
|
||||
type: "deploy" | "redeploy";
|
||||
applicationType: "application";
|
||||
serverId?: string;
|
||||
}
|
||||
| {
|
||||
composeId: string;
|
||||
titleLog: string;
|
||||
descriptionLog: string;
|
||||
server?: boolean;
|
||||
type: "deploy" | "redeploy";
|
||||
applicationType: "compose";
|
||||
serverId?: string;
|
||||
};
|
||||
|
||||
export type DeploymentJob = DeployJob;
|
||||
@@ -1,8 +1,6 @@
|
||||
import { type ConnectionOptions, Queue } from "bullmq";
|
||||
import { Queue } from "bullmq";
|
||||
import { redisConfig } from "./redis-connection";
|
||||
|
||||
export const redisConfig: ConnectionOptions = {
|
||||
host: process.env.NODE_ENV === "production" ? "dokploy-redis" : "127.0.0.1",
|
||||
};
|
||||
const myQueue = new Queue("deployments", {
|
||||
connection: redisConfig,
|
||||
});
|
||||
@@ -21,4 +19,26 @@ myQueue.on("error", (error) => {
|
||||
}
|
||||
});
|
||||
|
||||
export const cleanQueuesByApplication = async (applicationId: string) => {
|
||||
const jobs = await myQueue.getJobs(["waiting", "delayed"]);
|
||||
|
||||
for (const job of jobs) {
|
||||
if (job?.data?.applicationId === applicationId) {
|
||||
await job.remove();
|
||||
console.log(`Removed job ${job.id} for application ${applicationId}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const cleanQueuesByCompose = async (composeId: string) => {
|
||||
const jobs = await myQueue.getJobs(["waiting", "delayed"]);
|
||||
|
||||
for (const job of jobs) {
|
||||
if (job?.data?.composeId === composeId) {
|
||||
await job.remove();
|
||||
console.log(`Removed job ${job.id} for compose ${composeId}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export { myQueue };
|
||||
|
||||
5
apps/dokploy/server/queues/redis-connection.ts
Normal file
5
apps/dokploy/server/queues/redis-connection.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { ConnectionOptions } from "bullmq";
|
||||
|
||||
export const redisConfig: ConnectionOptions = {
|
||||
host: process.env.NODE_ENV === "production" ? "dokploy-redis" : "127.0.0.1",
|
||||
};
|
||||
@@ -19,15 +19,12 @@ import { setupDockerContainerLogsWebSocketServer } from "./wss/docker-container-
|
||||
import { setupDockerContainerTerminalWebSocketServer } from "./wss/docker-container-terminal";
|
||||
import { setupDockerStatsMonitoringSocketServer } from "./wss/docker-stats";
|
||||
import { setupDeploymentLogsWebSocketServer } from "./wss/listen-deployment";
|
||||
import {
|
||||
getPublicIpWithFallback,
|
||||
setupTerminalWebSocketServer,
|
||||
} from "./wss/terminal";
|
||||
import { setupTerminalWebSocketServer } from "./wss/terminal";
|
||||
|
||||
config({ path: ".env" });
|
||||
const PORT = Number.parseInt(process.env.PORT || "3000", 10);
|
||||
const dev = process.env.NODE_ENV !== "production";
|
||||
const app = next({ dev });
|
||||
const app = next({ dev, turbopack: dev });
|
||||
const handle = app.getRequestHandler();
|
||||
void app.prepare().then(async () => {
|
||||
try {
|
||||
@@ -55,7 +52,6 @@ void app.prepare().then(async () => {
|
||||
await initializeRedis();
|
||||
|
||||
initCronJobs();
|
||||
welcomeServer();
|
||||
|
||||
// Timeout to wait for the database to be ready
|
||||
await new Promise((resolve) => setTimeout(resolve, 7000));
|
||||
@@ -78,18 +74,3 @@ void app.prepare().then(async () => {
|
||||
console.error("Main Server Error", e);
|
||||
}
|
||||
});
|
||||
|
||||
async function welcomeServer() {
|
||||
const ip = await getPublicIpWithFallback();
|
||||
console.log(
|
||||
[
|
||||
"",
|
||||
"",
|
||||
"Dokploy server is up and running!",
|
||||
"Please wait for 15 seconds before opening the browser.",
|
||||
` http://${ip}:${PORT}`,
|
||||
"",
|
||||
"",
|
||||
].join("\n"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { findServerById } from "@dokploy/server";
|
||||
import type { DeploymentJob } from "../queues/deployments-queue";
|
||||
import type { DeploymentJob } from "../queues/queue-types";
|
||||
|
||||
export const deploy = async (jobData: DeploymentJob) => {
|
||||
try {
|
||||
|
||||
@@ -3,15 +3,15 @@ import {
|
||||
createDefaultServerTraefikConfig,
|
||||
createDefaultTraefikConfig,
|
||||
initializeTraefik,
|
||||
} from "@dokploy/server/dist/setup/traefik-setup";
|
||||
} from "@dokploy/server/setup/traefik-setup";
|
||||
|
||||
import { setupDirectories } from "@dokploy/server/dist/setup/config-paths";
|
||||
import { initializePostgres } from "@dokploy/server/dist/setup/postgres-setup";
|
||||
import { initializeRedis } from "@dokploy/server/dist/setup/redis-setup";
|
||||
import { setupDirectories } from "@dokploy/server/setup/config-paths";
|
||||
import { initializePostgres } from "@dokploy/server/setup/postgres-setup";
|
||||
import { initializeRedis } from "@dokploy/server/setup/redis-setup";
|
||||
import {
|
||||
initializeNetwork,
|
||||
initializeSwarm,
|
||||
} from "@dokploy/server/dist/setup/setup";
|
||||
} from "@dokploy/server/setup/setup";
|
||||
(async () => {
|
||||
try {
|
||||
setupDirectories();
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
/* Path Aliases */
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
"@/*": ["./*"],
|
||||
"@dokploy/server/*": ["../../packages/server/src/*"]
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"moduleResolution": "Node",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
"@/*": ["./*"],
|
||||
"@dokploy/server/*": ["../../packages/server/src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "./server/**/*"]
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
runMongoBackup,
|
||||
runMySqlBackup,
|
||||
runPostgresBackup,
|
||||
} from "@dokploy/server";
|
||||
} from "@dokploy/server/dist";
|
||||
import { db } from "@dokploy/server/dist/db";
|
||||
import { backups, server } from "@dokploy/server/dist/db/schema";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
@@ -305,6 +305,19 @@ export const ShowSponsors = () => {
|
||||
alt="Rivo.gg"
|
||||
/>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://photoquest.wedding/?ref=dokploy"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<img
|
||||
src="https://photoquest.wedding/favicon/android-chrome-512x512.png"
|
||||
className="rounded-xl"
|
||||
width="60px"
|
||||
alt="Rivo.gg"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 md:gap-8 justify-start">
|
||||
|
||||
@@ -57,7 +57,7 @@ install_dokploy() {
|
||||
fi
|
||||
}
|
||||
|
||||
advertise_addr=$(get_ip)
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
|
||||
@@ -92,6 +92,7 @@ install_dokploy() {
|
||||
--update-order stop-first \
|
||||
--constraint 'node.role == manager' \
|
||||
-e RELEASE_TAG=canary \
|
||||
-e ADVERTISE_ADDR=$advertise_addr \
|
||||
dokploy/dokploy:canary
|
||||
|
||||
GREEN="\033[0;32m"
|
||||
|
||||
@@ -41,7 +41,23 @@ install_dokploy() {
|
||||
fi
|
||||
|
||||
docker swarm leave --force 2>/dev/null
|
||||
advertise_addr=$(curl -s ifconfig.me)
|
||||
|
||||
get_ip() {
|
||||
# Try to get IPv4
|
||||
local ipv4=$(curl -4s https://ifconfig.io 2>/dev/null)
|
||||
|
||||
if [ -n "$ipv4" ]; then
|
||||
echo "$ipv4"
|
||||
else
|
||||
# Try to get IPv6
|
||||
local ipv6=$(curl -6s https://ifconfig.io 2>/dev/null)
|
||||
if [ -n "$ipv6" ]; then
|
||||
echo "$ipv6"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
|
||||
@@ -76,6 +92,7 @@ install_dokploy() {
|
||||
--update-order stop-first \
|
||||
--constraint 'node.role == manager' \
|
||||
-e RELEASE_TAG=feature \
|
||||
-e ADVERTISE_ADDR=$advertise_addr \
|
||||
dokploy/dokploy:feature
|
||||
|
||||
GREEN="\033[0;32m"
|
||||
|
||||
@@ -56,7 +56,7 @@ install_dokploy() {
|
||||
fi
|
||||
}
|
||||
|
||||
advertise_addr=$(get_ip)
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
|
||||
@@ -90,6 +90,7 @@ install_dokploy() {
|
||||
--update-parallelism 1 \
|
||||
--update-order stop-first \
|
||||
--constraint 'node.role == manager' \
|
||||
-e ADVERTISE_ADDR=$advertise_addr \
|
||||
dokploy/dokploy:latest
|
||||
|
||||
GREEN="\033[0;32m"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"dokploy:build": "pnpm --filter=dokploy run build",
|
||||
"dokploy:start": "pnpm --filter=dokploy run start",
|
||||
"test": "pnpm --filter=dokploy run test",
|
||||
"server:script": "pnpm --filter=server run switch:dev",
|
||||
"server:dev": "pnpm --filter=server run dev",
|
||||
"server:build": "pnpm --filter=server run build",
|
||||
"docker:build:canary": "./apps/dokploy/docker/build.sh canary",
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
// import { build } from "esbuild";
|
||||
// import alias from "esbuild-plugin-alias";
|
||||
// import path from "node:path";
|
||||
// import { fileURLToPath } from "node:url";
|
||||
// const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
|
||||
// const __dirname = path.dirname(__filename);
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { build } from "esbuild";
|
||||
import alias from "esbuild-plugin-alias";
|
||||
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
// build({
|
||||
// entryPoints: ["./src/**/*.ts"],
|
||||
// // outfile: "./dist/index.js",
|
||||
// outdir: "./dist",
|
||||
// bundle: true,
|
||||
// minify: false,
|
||||
// platform: "node",
|
||||
// target: "esnext",
|
||||
// format: "esm",
|
||||
// plugins: [
|
||||
// alias({
|
||||
// "@/server": path.resolve(__dirname, "src"),
|
||||
// }),
|
||||
// ],
|
||||
// packages: "external",
|
||||
// // Opcional: si deseas emitir declaraciones de tipos con esbuild-plugin-dts
|
||||
// })
|
||||
// .then(() => {
|
||||
// console.log("Build successful");
|
||||
// })
|
||||
// .catch(() => process.exit(1));
|
||||
build({
|
||||
entryPoints: ["./src/**/*.ts"],
|
||||
// outfile: "./dist/index.js",
|
||||
outdir: "./dist",
|
||||
bundle: true,
|
||||
minify: false,
|
||||
platform: "node",
|
||||
target: "esnext",
|
||||
format: "esm",
|
||||
plugins: [
|
||||
alias({
|
||||
"@dokploy/server": path.resolve(__dirname, "src"),
|
||||
}),
|
||||
],
|
||||
packages: "external",
|
||||
// Opcional: si deseas emitir declaraciones de tipos con esbuild-plugin-dts
|
||||
})
|
||||
.then(() => {
|
||||
console.log("Build successful");
|
||||
})
|
||||
.catch(() => process.exit(1));
|
||||
|
||||
@@ -1,14 +1,42 @@
|
||||
{
|
||||
"name": "@dokploy/server",
|
||||
"version": "1.0.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"main": "./src/index.ts",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./db": {
|
||||
"import": "./src/db/index.ts",
|
||||
"require": "./dist/db/index.cjs.js"
|
||||
},
|
||||
"./setup/*": {
|
||||
"import": "./src/setup/*.ts",
|
||||
"require": "./dist/setup/index.cjs.js"
|
||||
},
|
||||
"./constants": {
|
||||
"import": "./src/constants/index.ts",
|
||||
"require": "./dist/constants.cjs.js"
|
||||
},
|
||||
"./dist": {
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.cjs.js"
|
||||
},
|
||||
"./dist/db": {
|
||||
"import": "./dist/db/index.js",
|
||||
"require": "./dist/db/*.cjs"
|
||||
},
|
||||
"./dist/db/schema": {
|
||||
"import": "./dist/db/schema/index.js",
|
||||
"require": "./dist/db/schema/*.cjs"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm -rf ./dist && tsc --project tsconfig.server.json && tsc-alias -p tsconfig.server.json",
|
||||
"build:types": "tsc --emitDeclarationOnly --experimenta-dts",
|
||||
"switch:dev": "node scripts/switchToSrc.js",
|
||||
"switch:prod": "node scripts/switchToDist.js",
|
||||
"dev": "rm -rf ./dist && pnpm esbuild && tsc --emitDeclarationOnly --outDir dist -p tsconfig.server.json",
|
||||
"esbuild": "tsx ./esbuild.config.ts",
|
||||
"esbuild": "tsx ./esbuild.config.ts && tsc --project tsconfig.server.json --emitDeclarationOnly ",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -49,6 +77,7 @@
|
||||
"ssh2": "1.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild-plugin-alias": "0.2.1",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"tsx": "^4.7.1",
|
||||
"tsc-alias": "1.8.10",
|
||||
|
||||
27
packages/server/scripts/switchToDist.js
Normal file
27
packages/server/scripts/switchToDist.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const packagePath = path.resolve(__dirname, "../package.json");
|
||||
const pkg = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
|
||||
|
||||
pkg.exports = {
|
||||
".": {
|
||||
import: "./dist/index.js",
|
||||
require: "./dist/index.cjs.js",
|
||||
},
|
||||
"./db": {
|
||||
import: "./dist/db/index.js",
|
||||
require: "./dist/db/index.cjs.js",
|
||||
},
|
||||
"./*": {
|
||||
import: "./dist/*",
|
||||
require: "./dist/*.cjs",
|
||||
},
|
||||
};
|
||||
|
||||
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2));
|
||||
console.log("Switched exports to use dist for production");
|
||||
45
packages/server/scripts/switchToSrc.js
Normal file
45
packages/server/scripts/switchToSrc.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const packagePath = path.resolve(__dirname, "../package.json");
|
||||
|
||||
// Leer el archivo package.json
|
||||
const pkg = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
|
||||
|
||||
// Modificar los exports
|
||||
pkg.exports = {
|
||||
".": "./src/index.ts",
|
||||
"./db": {
|
||||
import: "./src/db/index.ts",
|
||||
require: "./dist/db/index.cjs.js",
|
||||
},
|
||||
"./setup/*": {
|
||||
import: "./src/setup/*.ts",
|
||||
require: "./dist/setup/index.cjs.js",
|
||||
},
|
||||
"./constants": {
|
||||
import: "./src/constants/index.ts",
|
||||
require: "./dist/constants.cjs.js",
|
||||
},
|
||||
"./dist": {
|
||||
import: "./dist/index.js",
|
||||
require: "./dist/index.cjs.js",
|
||||
},
|
||||
|
||||
"./dist/db": {
|
||||
import: "./dist/db/index.js",
|
||||
require: "./dist/db/*.cjs",
|
||||
},
|
||||
"./dist/db/schema": {
|
||||
import: "./dist/db/schema/index.js",
|
||||
require: "./dist/db/schema/*.cjs",
|
||||
},
|
||||
};
|
||||
|
||||
// Guardar los cambios en package.json
|
||||
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2));
|
||||
console.log("Switched exports to use src for development");
|
||||
@@ -1,7 +1,7 @@
|
||||
import { webcrypto } from "node:crypto";
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
import { findAdminByAuthId } from "@/server/services/admin";
|
||||
import { findUserByAuthId } from "@/server/services/user";
|
||||
import { findAdminByAuthId } from "@dokploy/server/services/admin";
|
||||
import { findUserByAuthId } from "@dokploy/server/services/user";
|
||||
import { DrizzlePostgreSQLAdapter } from "@lucia-auth/adapter-drizzle";
|
||||
import { TimeSpan } from "lucia";
|
||||
import { Lucia } from "lucia/dist/core.js";
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { randomBytes } from "node:crypto";
|
||||
import { db } from "@/server/db";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
admins,
|
||||
type apiCreateUserInvitation,
|
||||
auth,
|
||||
users,
|
||||
} from "@/server/db/schema";
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import * as bcrypt from "bcrypt";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
@@ -1,38 +1,41 @@
|
||||
import { docker } from "@/server/constants";
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateApplication, applications } from "@/server/db/schema";
|
||||
import { generateAppName } from "@/server/db/schema";
|
||||
import { getAdvancedStats } from "@/server/monitoring/utilts";
|
||||
import { generatePassword } from "@/server/templates/utils";
|
||||
import { docker } from "@dokploy/server/constants";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateApplication,
|
||||
applications,
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { generateAppName } from "@dokploy/server/db/schema";
|
||||
import { getAdvancedStats } from "@dokploy/server/monitoring/utilts";
|
||||
import { generatePassword } from "@dokploy/server/templates/utils";
|
||||
import {
|
||||
buildApplication,
|
||||
getBuildCommand,
|
||||
mechanizeDockerContainer,
|
||||
} from "@/server/utils/builders";
|
||||
import { sendBuildErrorNotifications } from "@/server/utils/notifications/build-error";
|
||||
import { sendBuildSuccessNotifications } from "@/server/utils/notifications/build-success";
|
||||
import { execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
} from "@dokploy/server/utils/builders";
|
||||
import { sendBuildErrorNotifications } from "@dokploy/server/utils/notifications/build-error";
|
||||
import { sendBuildSuccessNotifications } from "@dokploy/server/utils/notifications/build-success";
|
||||
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
|
||||
import {
|
||||
cloneBitbucketRepository,
|
||||
getBitbucketCloneCommand,
|
||||
} from "@/server/utils/providers/bitbucket";
|
||||
} from "@dokploy/server/utils/providers/bitbucket";
|
||||
import {
|
||||
buildDocker,
|
||||
buildRemoteDocker,
|
||||
} from "@/server/utils/providers/docker";
|
||||
} from "@dokploy/server/utils/providers/docker";
|
||||
import {
|
||||
cloneGitRepository,
|
||||
getCustomGitCloneCommand,
|
||||
} from "@/server/utils/providers/git";
|
||||
} from "@dokploy/server/utils/providers/git";
|
||||
import {
|
||||
cloneGithubRepository,
|
||||
getGithubCloneCommand,
|
||||
} from "@/server/utils/providers/github";
|
||||
} from "@dokploy/server/utils/providers/github";
|
||||
import {
|
||||
cloneGitlabRepository,
|
||||
getGitlabCloneCommand,
|
||||
} from "@/server/utils/providers/gitlab";
|
||||
import { createTraefikConfig } from "@/server/utils/traefik/application";
|
||||
} from "@dokploy/server/utils/providers/gitlab";
|
||||
import { createTraefikConfig } from "@dokploy/server/utils/traefik/application";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { encodeBase64 } from "../utils/docker/utils";
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { randomBytes } from "node:crypto";
|
||||
import { db } from "@/server/db";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
admins,
|
||||
type apiCreateAdmin,
|
||||
type apiCreateUser,
|
||||
auth,
|
||||
users,
|
||||
} from "@/server/db/schema";
|
||||
import { getPublicIpWithFallback } from "@/server/wss/terminal";
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { getPublicIpWithFallback } from "@dokploy/server/wss/terminal";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import * as bcrypt from "bcrypt";
|
||||
import { eq } from "drizzle-orm";
|
||||
@@ -43,7 +43,8 @@ export const createAdmin = async (input: typeof apiCreateAdmin._type) => {
|
||||
.values({
|
||||
authId: newAuth.id,
|
||||
...(!IS_CLOUD && {
|
||||
serverIp: await getPublicIpWithFallback(),
|
||||
serverIp:
|
||||
process.env.ADVERTISE_ADDR || (await getPublicIpWithFallback()),
|
||||
}),
|
||||
})
|
||||
.returning();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateBackup, backups } from "@/server/db/schema";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateBackup, backups } from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { db } from "@/server/db";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateBitbucket,
|
||||
type apiUpdateBitbucket,
|
||||
bitbucket,
|
||||
gitProvider,
|
||||
} from "@/server/db/schema";
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { paths } from "@/server/constants";
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateCertificate, certificates } from "@/server/db/schema";
|
||||
import { removeDirectoryIfExistsContent } from "@/server/utils/filesystem/directory";
|
||||
import { paths } from "@dokploy/server/constants";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateCertificate,
|
||||
certificates,
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { removeDirectoryIfExistsContent } from "@dokploy/server/utils/filesystem/directory";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { dump } from "js-yaml";
|
||||
|
||||
@@ -1,44 +1,47 @@
|
||||
import { join } from "node:path";
|
||||
import { paths } from "@/server/constants";
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateCompose, compose } from "@/server/db/schema";
|
||||
import { generateAppName } from "@/server/db/schema";
|
||||
import { generatePassword } from "@/server/templates/utils";
|
||||
import { paths } from "@dokploy/server/constants";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateCompose, compose } from "@dokploy/server/db/schema";
|
||||
import { generateAppName } from "@dokploy/server/db/schema";
|
||||
import { generatePassword } from "@dokploy/server/templates/utils";
|
||||
import {
|
||||
buildCompose,
|
||||
getBuildComposeCommand,
|
||||
} from "@/server/utils/builders/compose";
|
||||
import { randomizeSpecificationFile } from "@/server/utils/docker/compose";
|
||||
} from "@dokploy/server/utils/builders/compose";
|
||||
import { randomizeSpecificationFile } from "@dokploy/server/utils/docker/compose";
|
||||
import {
|
||||
cloneCompose,
|
||||
cloneComposeRemote,
|
||||
loadDockerCompose,
|
||||
loadDockerComposeRemote,
|
||||
} from "@/server/utils/docker/domain";
|
||||
import type { ComposeSpecification } from "@/server/utils/docker/types";
|
||||
import { sendBuildErrorNotifications } from "@/server/utils/notifications/build-error";
|
||||
import { sendBuildSuccessNotifications } from "@/server/utils/notifications/build-success";
|
||||
import { execAsync, execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
} from "@dokploy/server/utils/docker/domain";
|
||||
import type { ComposeSpecification } from "@dokploy/server/utils/docker/types";
|
||||
import { sendBuildErrorNotifications } from "@dokploy/server/utils/notifications/build-error";
|
||||
import { sendBuildSuccessNotifications } from "@dokploy/server/utils/notifications/build-success";
|
||||
import {
|
||||
execAsync,
|
||||
execAsyncRemote,
|
||||
} from "@dokploy/server/utils/process/execAsync";
|
||||
import {
|
||||
cloneBitbucketRepository,
|
||||
getBitbucketCloneCommand,
|
||||
} from "@/server/utils/providers/bitbucket";
|
||||
} from "@dokploy/server/utils/providers/bitbucket";
|
||||
import {
|
||||
cloneGitRepository,
|
||||
getCustomGitCloneCommand,
|
||||
} from "@/server/utils/providers/git";
|
||||
} from "@dokploy/server/utils/providers/git";
|
||||
import {
|
||||
cloneGithubRepository,
|
||||
getGithubCloneCommand,
|
||||
} from "@/server/utils/providers/github";
|
||||
} from "@dokploy/server/utils/providers/github";
|
||||
import {
|
||||
cloneGitlabRepository,
|
||||
getGitlabCloneCommand,
|
||||
} from "@/server/utils/providers/gitlab";
|
||||
} from "@dokploy/server/utils/providers/gitlab";
|
||||
import {
|
||||
createComposeFile,
|
||||
getCreateComposeFileCommand,
|
||||
} from "@/server/utils/providers/raw";
|
||||
} from "@dokploy/server/utils/providers/raw";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { encodeBase64 } from "../utils/docker/utils";
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { existsSync, promises as fsPromises } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { paths } from "@/server/constants";
|
||||
import { db } from "@/server/db";
|
||||
import { paths } from "@dokploy/server/constants";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateDeployment,
|
||||
type apiCreateDeploymentCompose,
|
||||
type apiCreateDeploymentServer,
|
||||
deployments,
|
||||
} from "@/server/db/schema";
|
||||
import { removeDirectoryIfExistsContent } from "@/server/utils/filesystem/directory";
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { removeDirectoryIfExistsContent } from "@dokploy/server/utils/filesystem/directory";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { format } from "date-fns";
|
||||
import { desc, eq } from "drizzle-orm";
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
import { type Compose, findComposeById, updateCompose } from "./compose";
|
||||
import { type Server, findServerById } from "./server";
|
||||
|
||||
import { execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
|
||||
|
||||
export type Deployment = typeof deployments.$inferSelect;
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateDestination, destinations } from "@/server/db/schema";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateDestination,
|
||||
destinations,
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { and, eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { execAsync, execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
import {
|
||||
execAsync,
|
||||
execAsyncRemote,
|
||||
} from "@dokploy/server/utils/process/execAsync";
|
||||
|
||||
export const getContainers = async (serverId?: string | null) => {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { db } from "@/server/db";
|
||||
import { generateRandomDomain } from "@/server/templates/utils";
|
||||
import { manageDomain } from "@/server/utils/traefik/domain";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { generateRandomDomain } from "@dokploy/server/templates/utils";
|
||||
import { manageDomain } from "@dokploy/server/utils/traefik/domain";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { type apiCreateDomain, domains } from "../db/schema";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { db } from "@/server/db";
|
||||
import { gitProvider } from "@/server/db/schema";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { gitProvider } from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateGithub, gitProvider, github } from "@/server/db/schema";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateGithub,
|
||||
gitProvider,
|
||||
github,
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { db } from "@/server/db";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateGitlab,
|
||||
type bitbucket,
|
||||
gitProvider,
|
||||
type github,
|
||||
gitlab,
|
||||
} from "@/server/db/schema";
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateMariaDB, backups, mariadb } from "@/server/db/schema";
|
||||
import { generateAppName } from "@/server/db/schema";
|
||||
import { generatePassword } from "@/server/templates/utils";
|
||||
import { buildMariadb } from "@/server/utils/databases/mariadb";
|
||||
import { pullImage } from "@/server/utils/docker/utils";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateMariaDB,
|
||||
backups,
|
||||
mariadb,
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { generateAppName } from "@dokploy/server/db/schema";
|
||||
import { generatePassword } from "@dokploy/server/templates/utils";
|
||||
import { buildMariadb } from "@dokploy/server/utils/databases/mariadb";
|
||||
import { pullImage } from "@dokploy/server/utils/docker/utils";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq, getTableColumns } from "drizzle-orm";
|
||||
import { validUniqueServerAppName } from "./project";
|
||||
|
||||
import { execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
|
||||
|
||||
export type Mariadb = typeof mariadb.$inferSelect;
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateMongo, backups, mongo } from "@/server/db/schema";
|
||||
import { generateAppName } from "@/server/db/schema";
|
||||
import { generatePassword } from "@/server/templates/utils";
|
||||
import { buildMongo } from "@/server/utils/databases/mongo";
|
||||
import { pullImage } from "@/server/utils/docker/utils";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateMongo, backups, mongo } from "@dokploy/server/db/schema";
|
||||
import { generateAppName } from "@dokploy/server/db/schema";
|
||||
import { generatePassword } from "@dokploy/server/templates/utils";
|
||||
import { buildMongo } from "@dokploy/server/utils/databases/mongo";
|
||||
import { pullImage } from "@dokploy/server/utils/docker/utils";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq, getTableColumns } from "drizzle-orm";
|
||||
import { validUniqueServerAppName } from "./project";
|
||||
|
||||
import { execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
|
||||
|
||||
export type Mongo = typeof mongo.$inferSelect;
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import path from "node:path";
|
||||
import { paths } from "@/server/constants";
|
||||
import { db } from "@/server/db";
|
||||
import { paths } from "@dokploy/server/constants";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type ServiceType,
|
||||
type apiCreateMount,
|
||||
mounts,
|
||||
} from "@/server/db/schema";
|
||||
import { createFile, getCreateFileCommand } from "@/server/utils/docker/utils";
|
||||
import { removeFileOrDirectory } from "@/server/utils/filesystem/directory";
|
||||
import { execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
} from "@dokploy/server/db/schema";
|
||||
import {
|
||||
createFile,
|
||||
getCreateFileCommand,
|
||||
} from "@dokploy/server/utils/docker/utils";
|
||||
import { removeFileOrDirectory } from "@dokploy/server/utils/filesystem/directory";
|
||||
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { type SQL, eq, sql } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateMySql, backups, mysql } from "@/server/db/schema";
|
||||
import { generateAppName } from "@/server/db/schema";
|
||||
import { generatePassword } from "@/server/templates/utils";
|
||||
import { buildMysql } from "@/server/utils/databases/mysql";
|
||||
import { pullImage } from "@/server/utils/docker/utils";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateMySql, backups, mysql } from "@dokploy/server/db/schema";
|
||||
import { generateAppName } from "@dokploy/server/db/schema";
|
||||
import { generatePassword } from "@dokploy/server/templates/utils";
|
||||
import { buildMysql } from "@dokploy/server/utils/databases/mysql";
|
||||
import { pullImage } from "@dokploy/server/utils/docker/utils";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq, getTableColumns } from "drizzle-orm";
|
||||
import { validUniqueServerAppName } from "./project";
|
||||
|
||||
import { execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
|
||||
|
||||
export type MySql = typeof mysql.$inferSelect;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { db } from "@/server/db";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateDiscord,
|
||||
type apiCreateEmail,
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
notifications,
|
||||
slack,
|
||||
telegram,
|
||||
} from "@/server/db/schema";
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreatePort, ports } from "@/server/db/schema";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreatePort, ports } from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreatePostgres, backups, postgres } from "@/server/db/schema";
|
||||
import { generateAppName } from "@/server/db/schema";
|
||||
import { generatePassword } from "@/server/templates/utils";
|
||||
import { buildPostgres } from "@/server/utils/databases/postgres";
|
||||
import { pullImage } from "@/server/utils/docker/utils";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreatePostgres,
|
||||
backups,
|
||||
postgres,
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { generateAppName } from "@dokploy/server/db/schema";
|
||||
import { generatePassword } from "@dokploy/server/templates/utils";
|
||||
import { buildPostgres } from "@dokploy/server/utils/databases/postgres";
|
||||
import { pullImage } from "@dokploy/server/utils/docker/utils";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq, getTableColumns } from "drizzle-orm";
|
||||
import { validUniqueServerAppName } from "./project";
|
||||
|
||||
import { execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
|
||||
|
||||
export type Postgres = typeof postgres.$inferSelect;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { db } from "@/server/db";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateProject,
|
||||
applications,
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
postgres,
|
||||
projects,
|
||||
redis,
|
||||
} from "@/server/db/schema";
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateRedirect, redirects } from "@/server/db/schema";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateRedirect, redirects } from "@dokploy/server/db/schema";
|
||||
import {
|
||||
createRedirectMiddleware,
|
||||
removeRedirectMiddleware,
|
||||
updateRedirectMiddleware,
|
||||
} from "@/server/utils/traefik/redirect";
|
||||
} from "@dokploy/server/utils/traefik/redirect";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { desc, eq } from "drizzle-orm";
|
||||
import type { z } from "zod";
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateRedis, redis } from "@/server/db/schema";
|
||||
import { generateAppName } from "@/server/db/schema";
|
||||
import { generatePassword } from "@/server/templates/utils";
|
||||
import { buildRedis } from "@/server/utils/databases/redis";
|
||||
import { pullImage } from "@/server/utils/docker/utils";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateRedis, redis } from "@dokploy/server/db/schema";
|
||||
import { generateAppName } from "@dokploy/server/db/schema";
|
||||
import { generatePassword } from "@dokploy/server/templates/utils";
|
||||
import { buildRedis } from "@dokploy/server/utils/databases/redis";
|
||||
import { pullImage } from "@dokploy/server/utils/docker/utils";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { validUniqueServerAppName } from "./project";
|
||||
|
||||
import { execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
|
||||
|
||||
export type Redis = typeof redis.$inferSelect;
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateRegistry, registry } from "@/server/db/schema";
|
||||
import { execAsync, execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateRegistry, registry } from "@dokploy/server/db/schema";
|
||||
import {
|
||||
execAsync,
|
||||
execAsyncRemote,
|
||||
} from "@dokploy/server/utils/process/execAsync";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { IS_CLOUD } from "../constants";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateSecurity, security } from "@/server/db/schema";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateSecurity, security } from "@dokploy/server/db/schema";
|
||||
import {
|
||||
createSecurityMiddleware,
|
||||
removeSecurityMiddleware,
|
||||
} from "@/server/utils/traefik/security";
|
||||
} from "@dokploy/server/utils/traefik/security";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { z } from "zod";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { db } from "@/server/db";
|
||||
import { type apiCreateServer, server } from "@/server/db/schema";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateServer, server } from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { desc, eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { readdirSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { docker } from "@/server/constants";
|
||||
import { getServiceContainer } from "@/server/utils/docker/utils";
|
||||
import { execAsyncRemote } from "@/server/utils/process/execAsync";
|
||||
import { docker } from "@dokploy/server/constants";
|
||||
import { getServiceContainer } from "@dokploy/server/utils/docker/utils";
|
||||
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
|
||||
// import packageInfo from "../../../package.json";
|
||||
|
||||
const updateIsAvailable = async () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { db } from "@/server/db";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
type apiCreateSshKey,
|
||||
type apiFindOneSshKey,
|
||||
type apiRemoveSshKey,
|
||||
type apiUpdateSshKey,
|
||||
sshKeys,
|
||||
} from "@/server/db/schema";
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { db } from "@/server/db";
|
||||
import { users } from "@/server/db/schema";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { users } from "@dokploy/server/db/schema";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
||||
@@ -32,16 +32,18 @@ export const initializePostgres = async () => {
|
||||
Replicas: 1,
|
||||
},
|
||||
},
|
||||
EndpointSpec: {
|
||||
Ports: [
|
||||
{
|
||||
TargetPort: 5432,
|
||||
PublishedPort: process.env.NODE_ENV === "development" ? 5432 : 0,
|
||||
Protocol: "tcp",
|
||||
PublishMode: "host",
|
||||
},
|
||||
],
|
||||
},
|
||||
...(process.env.NODE_ENV === "development" && {
|
||||
EndpointSpec: {
|
||||
Ports: [
|
||||
{
|
||||
TargetPort: 5432,
|
||||
PublishedPort: 5432,
|
||||
Protocol: "tcp",
|
||||
PublishMode: "host",
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
};
|
||||
try {
|
||||
await pullImage(imageName);
|
||||
|
||||
@@ -29,16 +29,18 @@ export const initializeRedis = async () => {
|
||||
Replicas: 1,
|
||||
},
|
||||
},
|
||||
EndpointSpec: {
|
||||
Ports: [
|
||||
{
|
||||
TargetPort: 6379,
|
||||
PublishedPort: process.env.NODE_ENV === "development" ? 6379 : 0,
|
||||
Protocol: "tcp",
|
||||
PublishMode: "host",
|
||||
},
|
||||
],
|
||||
},
|
||||
...(process.env.NODE_ENV === "development" && {
|
||||
EndpointSpec: {
|
||||
Ports: [
|
||||
{
|
||||
TargetPort: 6379,
|
||||
PublishedPort: 6379,
|
||||
Protocol: "tcp",
|
||||
PublishMode: "host",
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
};
|
||||
try {
|
||||
await pullImage(imageName);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { createWriteStream } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { paths } from "@/server/constants";
|
||||
import { paths } from "@dokploy/server/constants";
|
||||
import {
|
||||
createServerDeployment,
|
||||
updateDeploymentStatus,
|
||||
} from "@/server/services/deployment";
|
||||
import { findServerById } from "@/server/services/server";
|
||||
} from "@dokploy/server/services/deployment";
|
||||
import { findServerById } from "@dokploy/server/services/server";
|
||||
import {
|
||||
getDefaultMiddlewares,
|
||||
getDefaultServerTraefikConfig,
|
||||
} from "@/server/setup/traefik-setup";
|
||||
} from "@dokploy/server/setup/traefik-setup";
|
||||
import { Client } from "ssh2";
|
||||
import { recreateDirectory } from "../utils/filesystem/directory";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { randomBytes } from "node:crypto";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import type { Domain } from "@/server/services/domain";
|
||||
import type { Domain } from "@dokploy/server/services/domain";
|
||||
|
||||
export interface Schema {
|
||||
serverIp: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type * as schema from "@/server/db/schema";
|
||||
import type * as schema from "@dokploy/server/db/schema";
|
||||
import type {
|
||||
BuildQueryResult,
|
||||
DBQueryConfig,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IS_CLOUD, paths } from "@/server/constants";
|
||||
import { updateAdmin } from "@/server/services/admin";
|
||||
import { IS_CLOUD, paths } from "@dokploy/server/constants";
|
||||
import { updateAdmin } from "@dokploy/server/services/admin";
|
||||
import { type RotatingFileStream, createStream } from "rotating-file-stream";
|
||||
import { db } from "../../db";
|
||||
import { execAsync } from "../process/execAsync";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { findAdmin } from "@/server/services/admin";
|
||||
import { getAllServers } from "@/server/services/server";
|
||||
import { findAdmin } from "@dokploy/server/services/admin";
|
||||
import { getAllServers } from "@dokploy/server/services/server";
|
||||
import { scheduleJob } from "node-schedule";
|
||||
import { db } from "../../db/index";
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import path from "node:path";
|
||||
import type { BackupSchedule } from "@/server/services/backup";
|
||||
import type { Mariadb } from "@/server/services/mariadb";
|
||||
import { findProjectById } from "@/server/services/project";
|
||||
import type { BackupSchedule } from "@dokploy/server/services/backup";
|
||||
import type { Mariadb } from "@dokploy/server/services/mariadb";
|
||||
import { findProjectById } from "@dokploy/server/services/project";
|
||||
import {
|
||||
getRemoteServiceContainer,
|
||||
getServiceContainer,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import path from "node:path";
|
||||
import type { BackupSchedule } from "@/server/services/backup";
|
||||
import type { Mongo } from "@/server/services/mongo";
|
||||
import { findProjectById } from "@/server/services/project";
|
||||
import type { BackupSchedule } from "@dokploy/server/services/backup";
|
||||
import type { Mongo } from "@dokploy/server/services/mongo";
|
||||
import { findProjectById } from "@dokploy/server/services/project";
|
||||
import {
|
||||
getRemoteServiceContainer,
|
||||
getServiceContainer,
|
||||
@@ -29,7 +29,7 @@ export const runMongoBackup = async (mongo: Mongo, backup: BackupSchedule) => {
|
||||
mongo.serverId,
|
||||
appName,
|
||||
);
|
||||
const mongoDumpCommand = `docker exec ${containerId} sh -c "mongodump -d '${database}' -u '${databaseUser}' -p '${databasePassword}' --authenticationDatabase=admin --gzip"`;
|
||||
const mongoDumpCommand = `docker exec ${containerId} sh -c "mongodump -d '${database}' -u '${databaseUser}' -p '${databasePassword}' --archive --authenticationDatabase=admin --gzip"`;
|
||||
|
||||
await execAsyncRemote(
|
||||
mongo.serverId,
|
||||
@@ -37,7 +37,7 @@ export const runMongoBackup = async (mongo: Mongo, backup: BackupSchedule) => {
|
||||
);
|
||||
} else {
|
||||
const { Id: containerId } = await getServiceContainer(appName);
|
||||
const mongoDumpCommand = `docker exec ${containerId} sh -c "mongodump -d '${database}' -u '${databaseUser}' -p '${databasePassword}' --authenticationDatabase=admin --gzip"`;
|
||||
const mongoDumpCommand = `docker exec ${containerId} sh -c "mongodump -d '${database}' -u '${databaseUser}' -p '${databasePassword}' --archive --authenticationDatabase=admin --gzip"`;
|
||||
await execAsync(`${mongoDumpCommand} | ${rcloneCommand}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { unlink } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { BackupSchedule } from "@/server/services/backup";
|
||||
import type { MySql } from "@/server/services/mysql";
|
||||
import { findProjectById } from "@/server/services/project";
|
||||
import type { BackupSchedule } from "@dokploy/server/services/backup";
|
||||
import type { MySql } from "@dokploy/server/services/mysql";
|
||||
import { findProjectById } from "@dokploy/server/services/project";
|
||||
import {
|
||||
getRemoteServiceContainer,
|
||||
getServiceContainer,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import path from "node:path";
|
||||
import type { BackupSchedule } from "@/server/services/backup";
|
||||
import type { Postgres } from "@/server/services/postgres";
|
||||
import { findProjectById } from "@/server/services/project";
|
||||
import type { BackupSchedule } from "@dokploy/server/services/backup";
|
||||
import type { Postgres } from "@dokploy/server/services/postgres";
|
||||
import { findProjectById } from "@dokploy/server/services/project";
|
||||
import {
|
||||
getRemoteServiceContainer,
|
||||
getServiceContainer,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { BackupSchedule } from "@/server/services/backup";
|
||||
import type { Destination } from "@/server/services/destination";
|
||||
import type { BackupSchedule } from "@dokploy/server/services/backup";
|
||||
import type { Destination } from "@dokploy/server/services/destination";
|
||||
import { scheduleJob, scheduledJobs } from "node-schedule";
|
||||
import { runMariadbBackup } from "./mariadb";
|
||||
import { runMongoBackup } from "./mongo";
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { paths } from "@/server/constants";
|
||||
import type { InferResultType } from "@/server/types/with";
|
||||
import { paths } from "@dokploy/server/constants";
|
||||
import type { InferResultType } from "@dokploy/server/types/with";
|
||||
import boxen from "boxen";
|
||||
import {
|
||||
writeDomainsToCompose,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { WriteStream } from "node:fs";
|
||||
import { prepareEnvironmentVariables } from "@/server/utils/docker/utils";
|
||||
import { prepareEnvironmentVariables } from "@dokploy/server/utils/docker/utils";
|
||||
import type { ApplicationNested } from ".";
|
||||
import {
|
||||
getBuildAppDirectory,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path, { join } from "node:path";
|
||||
import { paths } from "@/server/constants";
|
||||
import type { Application } from "@/server/services/application";
|
||||
import { findServerById } from "@/server/services/server";
|
||||
import { paths } from "@dokploy/server/constants";
|
||||
import type { Application } from "@dokploy/server/services/application";
|
||||
import { findServerById } from "@dokploy/server/services/server";
|
||||
import AdmZip from "adm-zip";
|
||||
import { Client, type SFTPWrapper } from "ssh2";
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createWriteStream } from "node:fs";
|
||||
import type { InferResultType } from "@/server/types/with";
|
||||
import type { InferResultType } from "@dokploy/server/types/with";
|
||||
import type { CreateServiceOptions } from "dockerode";
|
||||
import { uploadImage } from "../cluster/upload";
|
||||
import {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { type WriteStream, existsSync, mkdirSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { buildStatic, getStaticCommand } from "@/server/utils/builders/static";
|
||||
import {
|
||||
buildStatic,
|
||||
getStaticCommand,
|
||||
} from "@dokploy/server/utils/builders/static";
|
||||
import { nanoid } from "nanoid";
|
||||
import type { ApplicationNested } from ".";
|
||||
import { prepareEnvironmentVariables } from "../docker/utils";
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { WriteStream } from "node:fs";
|
||||
import {
|
||||
buildCustomDocker,
|
||||
getDockerCommand,
|
||||
} from "@/server/utils/builders/docker-file";
|
||||
} from "@dokploy/server/utils/builders/docker-file";
|
||||
import type { ApplicationNested } from ".";
|
||||
import { createFile, getCreateFileCommand } from "../docker/utils";
|
||||
import { getBuildAppDirectory } from "../filesystem/directory";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InferResultType } from "@/server/types/with";
|
||||
import type { InferResultType } from "@dokploy/server/types/with";
|
||||
import type { CreateServiceOptions } from "dockerode";
|
||||
import {
|
||||
calculateResources,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InferResultType } from "@/server/types/with";
|
||||
import type { InferResultType } from "@dokploy/server/types/with";
|
||||
import type { CreateServiceOptions } from "dockerode";
|
||||
import {
|
||||
calculateResources,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InferResultType } from "@/server/types/with";
|
||||
import type { InferResultType } from "@dokploy/server/types/with";
|
||||
import type { CreateServiceOptions } from "dockerode";
|
||||
import {
|
||||
calculateResources,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InferResultType } from "@/server/types/with";
|
||||
import type { InferResultType } from "@dokploy/server/types/with";
|
||||
import type { CreateServiceOptions } from "dockerode";
|
||||
import {
|
||||
calculateResources,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InferResultType } from "@/server/types/with";
|
||||
import type { InferResultType } from "@dokploy/server/types/with";
|
||||
import type { CreateServiceOptions } from "dockerode";
|
||||
import {
|
||||
calculateResources,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import crypto from "node:crypto";
|
||||
import { findComposeById } from "@/server/services/compose";
|
||||
import { findComposeById } from "@dokploy/server/services/compose";
|
||||
import { dump, load } from "js-yaml";
|
||||
import { addSuffixToAllConfigs } from "./compose/configs";
|
||||
import { addSuffixToAllNetworks } from "./compose/network";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import fs, { existsSync, readFileSync } from "node:fs";
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { paths } from "@/server/constants";
|
||||
import type { Compose } from "@/server/services/compose";
|
||||
import type { Domain } from "@/server/services/domain";
|
||||
import { paths } from "@dokploy/server/constants";
|
||||
import type { Compose } from "@dokploy/server/services/compose";
|
||||
import type { Domain } from "@dokploy/server/services/domain";
|
||||
import { dump, load } from "js-yaml";
|
||||
import { execAsyncRemote } from "../process/execAsync";
|
||||
import {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user