mirror of
https://github.com/LukeHagar/dokploy.git
synced 2025-12-06 04:19:37 +00:00
* feat: add start monitoring remote servers * reafctor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: * refactor: add metrics * feat: add disk monitoring * refactor: translate to english * refacotor: add stats * refactor: remove color * feat: add log server metrics * refactor: remove unused deps * refactor: add origin * refactor: add logs * refactor: update * feat: add series monitoring * refactor: add system monitoring * feat: add benchmark to optimize data * refactor: update fn * refactor: remove comments * refactor: update * refactor: exclude items * feat: add refresh rate * feat: add monitoring remote servers * refactor: update * refactor: remove unsued volumes * refactor: update monitoring * refactor: add more presets * feat: add container metrics * feat: add docker monitoring * refactor: update conversion * refactor: remove unused code * refactor: update * refactor: add docker compose logs * refactor: add docker cli * refactor: add install curl * refactor: add get update * refactor: add monitoring remote servers * refactor: add containers config * feat: add container specification * refactor: update path * refactor: add server filter * refactor: simplify logic * fix: verify if file exist before get stats * refactor: update * refactor: remove unused deps * test: add test for containers * refactor: update * refactor add memory collector * refactor: update * refactor: update * refactor: update * refactor: remove * refactor: add memory * refactor: add server memory usage * refactor: change memory * refactor: update * refactor: update * refactor: add container metrics * refactor: comment code * refactor: mount proc bind * refactor: change interval with node cron * refactor: remove opening file * refactor: use streams * refactor: remove unused ws * refactor: disable live when is all * refactor: add sqlite * refactor: update * feat: add golang benchmark * refactor: update go * refactor: update dockerfile * refactor: update db * refactor: add env * refactor: separate logic * refactor: split logic * refactor: update logs * refactor: update dockerfile * refactor: hide .env * refactor: update * chore: hide ,.ebnv * refactor: add end angle * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update monitoring * refactor: add mount db * refactor: add metrics and url callback * refactor: add middleware * refactor: add threshold property * feat: add memory and cpu threshold notification * feat: send notifications to the server * feat: add metrics for dokploy server * refactor: add dokploy server to monitoring * refactor: update methods * refactor: add admin to useeffect * refactor: stop monitoring containers if elements are 0 * refactor: cancel request if appName is empty * refactor: reuse methods * chore; add feat monitoring * refactor: set base url * refactor: adjust monitoring * refactor: delete migrations * feat: add columns * fix: add missing flag * refactor: add free metrics * refactor: add paid monitoring * refactor: update methods * feat: improve ui * feat: add container stats * refactor: add all container metrics * refactor: add color primary * refactor: change default rate limiting refresher * refactor: update retention days * refactor: use json instead of individual properties * refactor: lint * refactor: pass json env * refactor: update * refactor: delete * refactor: update * refactor: fix types * refactor: add retention days * chore: add license * refactor: create db * refactor: update path * refactor: update setup * refactor: update * refactor: create files * refactor: update * refactor: delete * refactor: update * refactor: update token metrics * fix: typechecks * refactor: setup web server * refactor: update error handling and add monitoring * refactor: add local storage save * refactor: add spacing * refactor: update * refactor: upgrade drizzle * refactor: delete * refactor: uppgrade drizzle kit * refactor: update search with jsonB * chore: upgrade drizzle * chore: update packages * refactor: add missing type * refactor: add serverType * refactor: update url * refactor: update * refactor: update * refactor: hide monitoring on self hosted * refactor: update server * refactor: update * refactor: update * refactor: pin node version
122 lines
2.7 KiB
TypeScript
122 lines
2.7 KiB
TypeScript
import { fs, vol } from "memfs";
|
|
|
|
vi.mock("node:fs", () => ({
|
|
...fs,
|
|
default: fs,
|
|
}));
|
|
|
|
import type { Admin, FileConfig } from "@dokploy/server";
|
|
import {
|
|
createDefaultServerTraefikConfig,
|
|
loadOrCreateConfig,
|
|
updateServerTraefik,
|
|
} from "@dokploy/server";
|
|
import { beforeEach, expect, test, vi } from "vitest";
|
|
|
|
const baseAdmin: Admin = {
|
|
enablePaidFeatures: false,
|
|
metricsConfig: {
|
|
containers: {
|
|
refreshRate: 20,
|
|
services: {
|
|
include: [],
|
|
exclude: [],
|
|
},
|
|
},
|
|
server: {
|
|
type: "Dokploy",
|
|
cronJob: "",
|
|
port: 4500,
|
|
refreshRate: 20,
|
|
retentionDays: 2,
|
|
token: "",
|
|
thresholds: {
|
|
cpu: 0,
|
|
memory: 0,
|
|
},
|
|
urlCallback: "",
|
|
},
|
|
},
|
|
cleanupCacheApplications: false,
|
|
cleanupCacheOnCompose: false,
|
|
cleanupCacheOnPreviews: false,
|
|
createdAt: "",
|
|
authId: "",
|
|
adminId: "string",
|
|
serverIp: null,
|
|
certificateType: "none",
|
|
host: null,
|
|
letsEncryptEmail: null,
|
|
sshPrivateKey: null,
|
|
enableDockerCleanup: false,
|
|
enableLogRotation: false,
|
|
serversQuantity: 0,
|
|
stripeCustomerId: "",
|
|
stripeSubscriptionId: "",
|
|
};
|
|
|
|
beforeEach(() => {
|
|
vol.reset();
|
|
createDefaultServerTraefikConfig();
|
|
});
|
|
|
|
test("Should read the configuration file", () => {
|
|
const config: FileConfig = loadOrCreateConfig("dokploy");
|
|
|
|
expect(config.http?.routers?.["dokploy-router-app"]?.service).toBe(
|
|
"dokploy-service-app",
|
|
);
|
|
});
|
|
|
|
test("Should apply redirect-to-https", () => {
|
|
updateServerTraefik(
|
|
{
|
|
...baseAdmin,
|
|
certificateType: "letsencrypt",
|
|
},
|
|
"example.com",
|
|
);
|
|
|
|
const config: FileConfig = loadOrCreateConfig("dokploy");
|
|
|
|
expect(config.http?.routers?.["dokploy-router-app"]?.middlewares).toContain(
|
|
"redirect-to-https",
|
|
);
|
|
});
|
|
|
|
test("Should change only host when no certificate", () => {
|
|
updateServerTraefik(baseAdmin, "example.com");
|
|
|
|
const config: FileConfig = loadOrCreateConfig("dokploy");
|
|
|
|
expect(config.http?.routers?.["dokploy-router-app-secure"]).toBeUndefined();
|
|
});
|
|
|
|
test("Should not touch config without host", () => {
|
|
const originalConfig: FileConfig = loadOrCreateConfig("dokploy");
|
|
|
|
updateServerTraefik(baseAdmin, null);
|
|
|
|
const config: FileConfig = loadOrCreateConfig("dokploy");
|
|
|
|
expect(originalConfig).toEqual(config);
|
|
});
|
|
|
|
test("Should remove websecure if https rollback to http", () => {
|
|
const originalConfig: FileConfig = loadOrCreateConfig("dokploy");
|
|
|
|
updateServerTraefik(
|
|
{ ...baseAdmin, certificateType: "letsencrypt" },
|
|
"example.com",
|
|
);
|
|
|
|
updateServerTraefik({ ...baseAdmin, certificateType: "none" }, "example.com");
|
|
|
|
const config: FileConfig = loadOrCreateConfig("dokploy");
|
|
|
|
expect(config.http?.routers?.["dokploy-router-app-secure"]).toBeUndefined();
|
|
expect(
|
|
config.http?.routers?.["dokploy-router-app"]?.middlewares,
|
|
).not.toContain("redirect-to-https");
|
|
});
|